[LLVMbugs] [Bug 14066] New: clang-check doesn't do correct shell-unescaping for -D flags

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Oct 11 04:35:22 PDT 2012


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

             Bug #: 14066
           Summary: clang-check doesn't do correct shell-unescaping for -D
                    flags
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: nicolasweber at gmx.de
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Look at this:

Nicos-MacBook-Pro:tmp thakis$ cat compile_commands.json 
[
  { "directory": "/Users/thakis/src/tmp",
    "command": "clang++ '-DFOO=\"test.h\"' test.cc",
    "file": "test.cc" },
]
Nicos-MacBook-Pro:tmp thakis$ cat test.h 
#error
Nicos-MacBook-Pro:tmp thakis$ cat test.cc 
#include FOO
Nicos-MacBook-Pro:tmp thakis$ ~/src/llvm/Release+Asserts/bin/clang-check
test.cc 
Processing: /Users/thakis/src/tmp/test.cc.
warning: '-DFOO=test.h': 'linker' input unused
test.cc:1:10: error: expected "FILENAME" or <FILENAME>
#include FOO
         ^
1 error generated.
Error while processing /Users/thakis/src/tmp/test.cc.



clang-check shouldn't ignore the '-DFOO=test.h'. It works as expected when not
using '' quotes:

Nicos-MacBook-Pro:tmp thakis$ cat compile_commands.json 
[
  { "directory": "/Users/thakis/src/tmp",
    "command": "clang++ -DFOO=\\\"test.h\\\" test.cc",
    "file": "test.cc" },
]
Nicos-MacBook-Pro:tmp thakis$ ~/src/llvm/Release+Asserts/bin/clang-check
test.cc 
Processing: /Users/thakis/src/tmp/test.cc.
In file included from test.cc:1:
./test.h:1:2: error: 
#error
 ^
1 error generated.
Error while processing /Users/thakis/src/tmp/test.cc.

(This also says "error", but this error I expect.)

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list