[llvm-bugs] [Bug 45285] New: -pedantic complains about multi-line comments // ... \
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Mar 23 14:31:07 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=45285
Bug ID: 45285
Summary: -pedantic complains about multi-line comments // ... \
Product: clang
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: matthias.andree at gmx.de
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
neeilans at live.com, richard-llvm at metafoo.co.uk
Greetings,
clang (tried multiple versions) warns about legal multi-line //-style comments,
as part of -Wcomment which is default-enabled.
Minimal code (to try with, for instance, -std=c99, =c11, =c++11), save as
/tmp/try.c, and them compile with:
clang -pedantic-errors -std=c11 -O -c /tmp/try.c
clang -pedantic-errors -std=c++11 -O -c /tmp/try.c
// \
%
void foo(void) {}
Yields:
/tmp/try.c:1:4: error: multi-line // comment [-Werror,-Wcomment]
// \
^
1 error generated.
Expected output:
none, and compilation succeeds.
I am mentining these three languages because I've read up on the latest draft
specs. All three language specifications (their final drafts at any rate)
concur about phases of compilation that:
* phase 2 in a single-pass motion removes a single backslash followed by line
break
* phase 3 replaces comments by one space
And if I understand correctly, this is not a language extension, so -pedantic
should not complain. The code above should be equivalent to (line end marker
¶), after phase 3:
¶
void foo(void) {}¶
Looking at GCC, 9.2.0 and 10 as of 20200315 accept the code above without
diagnostics or warnings.
Please check if LLVM should disable the warning under -pedantic.
I was testing on FreeBSD 12.1-RELEASE-p3, amd64 (aka x86_64),
llvm80-8.0.1_3 LLVM and Clang
llvm90-9.0.1 LLVM and Clang
llvm10-10.0.0.r4 LLVM and Clang
llvm-devel-11.0.d20200117 LLVM and Clang
--
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/20200323/40d3685c/attachment.html>
More information about the llvm-bugs
mailing list