Issue 142327
Summary Behaviour of quotation marks in C++-style when running clang cpp with `-traditional-cpp`
Labels clang
Assignees
Reporter myzhang1029
    Using the `-traditional-cpp` flag (or invoking as `cpp` directly), clang seems to be mis-parsing quotation marks inside C++-style comments.

Test code:
```c
// Test "double
// Try 'single
```
Command:
```
$CC -traditional-cpp -E test.c | cat
```
(piping through `cat` to separate `stderr` from `stdout`)

Output from `clang` (Homebrew clang version 20.1.6)
(omitting line number directives)
```
test.c:1:9: warning: missing terminating '"' character [-Winvalid-pp-token]
    1 | // Test "double
 |         ^
test.c:2:8: warning: missing terminating ' character [-Winvalid-pp-token]
    2 | // Try 'single
      |        ^
2 warnings generated.

// Test "double
// Try 'single
```

The `invalid-pp-token` warning seems to be bogus.

Output from GCC (clean output)
```
// Test "double
// Try 'single
```

Honestly, since this seems to be a small issue, I am personally fine with this becoming a wont fix or a `FIXME` inside `test/Preprocessor/traditional-cpp.c`.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to