-MM doesn't ignore system headers

luoyi@wslab$ pgCC -V

pgCC (aka pgcpp) 6.2-5 32-bit target on x86 Linux 
Copyright 1989-2000, The Portland Group, Inc.  All Rights Reserved.
Copyright 2000-2006, STMicroelectronics, Inc.  All Rights Reserved.
luoyi@wslab$ pgCC -c -M source/common/func/common.cpp > M
luoyi@wslab$ pgCC -c -MM source/common/func/common.cpp > MM
luoyi@wslab$ diff M MM
luoyi@wslab$ head -5 M 
common.o: source/common/func/common.cpp
common.o: /opt/pgi/linux86/6.2/include/CC/string
common.o: /opt/pgi/linux86/6.2/include/CC/stl/_prolog.h
common.o: /opt/pgi/linux86/6.2/include/CC/stl/_config.h
common.o: /opt/pgi/linux86/6.2/include/CC/stl_user_config.h

We can see that -MM generate the same resule as -M, and they all doesn’t ignore the system header files.

BTW: can I change the output file format to GCC-style, as like :

luoyi@wslab$ gcc -c -MM source/common/func/common.cpp > gcc_MM
luoyi@wslab$ cat gcc_MM
common.o: source/common/func/common.cpp source/common/func/common.h

hope you can help me ~!

Hi luoyi,

Thank you for the report. This looks like a bug in the C++ front end so I’ve filed a technical problem report (TPR#4038). We’ll have a compiler engineer look at the issue in more depth soon.

Thanks again,

thx for your rapid reply. hope I can get a patch for that soon, because my Makefile system is based on gcc’s dependent-file output format.

PS: Intel C++ also use EDG’s front-end, and they can do the same thing as gcc.

Hi luoyi,

It was simple misconfiguration problem. It has been fixed internally and should be available in the next release (7.0) due out in a few weeks.

Unfortunantely, a few of the internal header files contain quoted include files so they get printed as well. I’ll ask that compiler engineers look at that to see if anything can be done.

As a side note, pgcc works as expected, it’s just pgcpp that has this issue.

  • Mat

luoyi@wslab$ pgcc -c -MM dbarray.c
dbarray.o : dbarray.c ./dbarray.h ./utils.h /usr/include/stdlib.h

Same issue that I mentioned above. I’ve made our engineer’s aware of the issue,.

I’ve tried 7.0 , and it doesn’t get solved:

luoyi@skyking:~/qp/source/common/func$ pgCC -c -MM -I/home/luoyi/qp/include/common common.cpp
common.o : common.cpp
luoyi@skyking:~/qp/source/common/func$ pgCC -V

pgCC 7.0-2 32-bit target on x86 Linux
Copyright 1989-2000, The Portland Group, Inc. All Rights Reserved.
Copyright 2000-2007, STMicroelectronics, Inc. All Rights Reserved.

Hi luoyi,

“-MM” is working as expected since quoted include files are added to the dependancy chain. syslimits.h is coming from GNU’s limits.h.

From GNU’s /usr/lib/gcc-lib/i586-suse-linux/3.3.3/include/limits.h

/* Use “…” so that we find syslimits.h only in this same directory. */
#include “syslimits.h”

  • Mat