In gcc 3.4, option -M outputs different rules when used with -g:

$ cat foo.c
#include <foo.h>
$ 
$ touch foo.h
$ 
$ gcc -M -I. foo.c
foo.o: foo.c foo.h
$ 
$ gcc -g -M -I. foo.c
# 1 "/home/user//"
foo.o: foo.c ./foo.h
$ 

This was not the case with gcc 3.3. While the output is arguably correct since
'#' is a valid comment in a Makefile, there are a few problems with this change:

1) Is it useful in any way? If not, it should be avoided since it can break 
things.

2) Actually it does break things. It breaks dependency generation as described
in the GNU manual or other better sources:
http://www.gnu.org/software/make/manual/html_node/make_47.html
http://make.paulandlesley.org/autodep.html

3) Also why output 'foo.h' without -g and './foo.h' with -g? This is 
inconsistent.

Therefore I see this as a 3.4 regression.

-- 
           Summary: -M output different with -g
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: preprocessor
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: papadopo at shfj dot cea dot fr
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19290

Reply via email to