[PATCH] Fix dependency file escaping

Paul Robinson Paul_Robinson at playstation.sony.com
Wed Apr 22 15:20:46 PDT 2015


================
Comment at: lib/Frontend/DependencyFile.cpp:298
@@ -295,3 +297,3 @@
   for (unsigned i = 0, e = Filename.size(); i != e; ++i) {
-    if (Filename[i] == ' ' || Filename[i] == '#')
+    if (Filename[i] == ' ' || Filename[i] == '#') {
       OS << '\\';
----------------
silvas wrote:
> Why `#` also? We are trying to be gcc-compatible. See https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libcpp/mkdeps.c;h=78bbf09a0cc8c3ba0fe974b55e1ededf02c66665;hb=HEAD#l47
No, we're trying to produce something that GNU Make can use.  What gcc produces is broken by any definition.

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

http://reviews.llvm.org/D9208

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list