<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 - C18 standard conformance non-compliance."
href="https://bugs.llvm.org/show_bug.cgi?id=42226">42226</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>C18 standard conformance non-compliance.
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>6.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>escanorexpress@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>This report is a technical point more than anything. Both the C90 and C18
standards have a "conformance chapter", chapter 4 on C18, that states the
following on section 1:
"In this International Standard, “shall” is to be interpreted as a requirement
on an implementation or on a program; conversely, “shall not” is to be
interpreted as a prohibition"
The technical point is the following, in section 5.1.1.2 in C18 , there is a
similar section in C90, phase 2 states the following:
"Each instance of a backslash character (\) immediately followed by a new-line
character is deleted, splicing physical source lines to form logical source
lines. Only the last backslash on any physical source line shall be eligible
for being part of such a splice. A source file that is not empty shall end in a
new-line character, which shall not be immediately preceded by a backslash
character before any such splicing takes place."
Consider the following program:
simple_case.c
"
int main(){ return 0; }
\
"
clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
gcc (Ubuntu 8.3.0-6ubuntu1~18.04) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
The clang version above compiles it just fine, and the gcc version above issues
the following warning:
"c.c:2:1: warning: backslash-newline at end of file
\
"
If instead we have:
elaborate_case.c
"
int main(){ return 0; }
\
"
then they both compile fine without warning.
Question: according to the standard "A source file that is not empty shall end
in a new-line character, which shall not be immediately preceded by a backslash
character before any such splicing takes place.", are we not required by the
standard to treat such a text file, the elaborate_case.c, as not a "source
file"? That is, it should not compile.</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>