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: unassignedclangb...@nondot.org
          Reporter: doug.cole...@gmail.com
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to