[llvm-bugs] [Bug 27622] New: -Wbackslash-newline-escape printed twice, but only when other warning is present

via llvm-bugs llvm-bugs at lists.llvm.org
Tue May 3 12:07:57 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=27622

            Bug ID: 27622
           Summary: -Wbackslash-newline-escape printed twice, but only
                    when other warning is present
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: doug.coleman at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

The -Wbackslash-newline-escape is printed twice, but only when other warnings
are present. Case 1) demonstrates the bug, cases 2) and 3) are each
warning/error by themselves, where the warning is not erroneously printed
twice.


1) This program demonstrates the bug. Notice that the ``hello.c:1:19`` warning
is displayed twice. (There's a space character after the \, not the text
[space])

Program```
#include <stdio.h\[space]
"
```

Output```
ergmac:~ erg$ clang hello.c
hello.c:1:19: warning: backslash and newline separated by space
[-Wbackslash-newline-escape]
#include <stdio.h\
                  ^
hello.c:1:19: warning: backslash and newline separated by space
[-Wbackslash-newline-escape]
hello.c:1:18: warning: missing terminating '"' character [-Winvalid-pp-token]
#include <stdio.h\
                 ^
hello.c:2:2: error: expected "FILENAME" or <FILENAME>
"
 ^
3 warnings and 1 error generated.
```


2) The same program with the correct terminator character only displays the
warning once. (No space after the \)

Program```
ergmac:~ erg$ cat hello.c
#include <stdio.h\
>
```

Output```
ergmac:~ erg$ clang hello.c
hello.c:1:19: warning: backslash and newline separated by space
[-Wbackslash-newline-escape]
#include <stdio.h\
                  ^
1 warning generated.
```


3) The same program without the space but with the wrong terminator.

Program```
ergmac:~ erg$ cat hello.c
#include <stdio.h\
"
```

Output```
ergmac:~ erg$ clang hello.c
hello.c:1:18: warning: missing terminating '"' character [-Winvalid-pp-token]
#include <stdio.h\
                 ^
hello.c:2:2: error: expected "FILENAME" or <FILENAME>
"
 ^
1 warning and 1 error generated.
```

-- 
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/20160503/c7a60475/attachment.html>


More information about the llvm-bugs mailing list