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: unassignedclangb...@nondot.org
Reporter: matthias.and...@gmx.de
CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
neeil...@live.com, richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs