<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - -pedantic complains about multi-line comments // ... \"
href="https://bugs.llvm.org/show_bug.cgi?id=45285">45285</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>-pedantic complains about multi-line comments // ... \
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>matthias.andree@gmx.de
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>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</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>