[LLVMbugs] [Bug 10594] New: C99 _Pragma unary operator should not expand into one line

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Aug 5 03:05:18 PDT 2011


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

           Summary: C99 _Pragma unary operator should not expand into one
                    line
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: lockalsash at gmail.com
                CC: llvmbugs at cs.uiuc.edu


Current _Pragma expansion method in some cases can produce wrong preprocessed
code if comments are not discarded.

This testcase can explain the problem much better:

int main() {
    #define MACRO _Pragma("something")
    MACRO // evil comment
    test  // this line is dead
}

The result of "clang -E -C" is or "clang -E -CC" is
...
int main() {

#pragma something
 // evil comment test // this line is dead
}

Note that the test line is commented out.

The -C option can be used for static code analysis tools. The -CC option is
generally used to support lint comments. 

Proposed code is something like
...
int main() {


# 3 "main.cpp"
#pragma something
# 3 "main.cpp"
 // evil comment
 test // this line is dead
}

-- 
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