[llvm-bugs] [Bug 32631] New: undef is printed on the wrong line by -E -CC -dD with comment in macro

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Apr 11 12:58:25 PDT 2017


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

            Bug ID: 32631
           Summary: undef is printed on the wrong line by -E -CC -dD with
                    comment in macro
           Product: clang
           Version: 4.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jonathanmueller.dev at gmail.com
                CC: llvm-bugs at lists.llvm.org

If you run `clang++ -E -CC -dD` on this file:

```
#define FOO /*a
b
c*/

FOO

#undef FOO
```

The output is:

```
predefine macros here...

# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "file.cpp" 2
#define FOO /*a
b
c*/



/*a
b
c*/#undef FOO
# 7 "file.cpp"


```

This is incorrect, the `#undef` is on the same line as the expansion but should
be on its own line.
The error still happens when the macro contains additional code, but doesn't
happen anymore if it contains a comment with a line number other than three.

I know that this is *really* obscure, but I parse the output of `clang++ -E`
and can't detect the `#undef` if it is on the same line.

-- 
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/20170411/eb374a88/attachment-0001.html>


More information about the llvm-bugs mailing list