[LLVMbugs] [Bug 15642] New: clang -MMD doesn't escape dollar signs in output

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Apr 1 14:43:26 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=15642

            Bug ID: 15642
           Summary: clang -MMD doesn't escape dollar signs in output
           Product: clang
           Version: 3.2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: abbeyj at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

When using "clang -MMD" with filenames that contain dollar signs, the dollar
signs are not escaped.  If this output is used with make it won't be able to
find the prerequisites.  For example:

$ /bin/ls -l
-rw-r--r-- 1 abbeyj users 75 Apr  1 17:36 Makefile
-rw-r--r-- 1 abbeyj users  0 Apr  1 17:35 dollar$sign.h
-rw-r--r-- 1 abbeyj users 25 Apr  1 17:32 main.c

$ cat Makefile
main.o: main.c
        $(CC) -MMD -c main.c
-include main.d
clean:
        $(RM) *.o *.d

$ cat main.c
#include "dollar$sign.h"

# works fine with gcc
$ make CC=gcc
gcc -MMD -c main.c
$ cat main.d
main.o: main.c dollar$$sign.h
$ make CC=gcc
make: `main.o' is up to date.

$ make clean

# fails with clang (once .d file has been created)
$ make CC=clang
clang -MMD -c main.c
$ cat main.d
main.o: main.c dollar$sign.h
$ make CC=clang
make: *** No rule to make target `dollarign.h', needed by `main.o'.  Stop.



Since the dollar sign is not doubled, make tries to expand "$s" and gets an
empty string making it think the desired filename is "dollarign.h".  Since that
file doesn't exist, the make then fails.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130401/c92e766f/attachment.html>


More information about the llvm-bugs mailing list