This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug preprocessor/65852] New: Incorrect escaping in depfiles


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65852

            Bug ID: 65852
           Summary: Incorrect escaping in depfiles
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: paul_robinson at playstation dot sony.com

When gcc creates a depfile, and a target or dependency has a space or # in it,
the filespec in the depfile is escaped with a backslash so GNU Make won't
interpret it as a delimiter or comment character.
GNU Make also expects backslashes to be escaped, which can lead to some
misinterpretation if a backslash in the original filename is immediately
followed by a space or # character.

gcc will take care to double the backslashes immediately preceding a space,
but does not do the same for #, which results in a bogus depfile.


$ cat tspace.c
#include "foo\ bar.h"
#include "bar\#foo.h"
int i;
$ ls
bar\#foo.h foo\ bar.h tspace.c
$ gcc -c -MMD tspace.c
$ cat tspace.d
tspace.o: tspace.c foo\\\ bar.h bar\\#foo.h
$ make -f tspace.d tspace.o
make: *** No rule to make target `bar\', needed by `tspace.o'. Stop.
$


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]