[llvm-bugs] [Bug 31886] New: in -traditional mode, the preprocessor should only process directives whose '#' appears in column 1
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Feb 6 13:48:29 PST 2017
https://llvm.org/bugs/show_bug.cgi?id=31886
Bug ID: 31886
Summary: in -traditional mode, the preprocessor should only
process directives whose '#' appears in column 1
Product: clang
Version: unspecified
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: froydnj at gmail.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
Relaying this bug report on behalf of Zack Weinberg:
In -traditional mode, the preprocessor should only process directives
whose '#' appears in column 1. For instance, in this fragment ...
#ifndef foo
#ifdef bar
quux
#endif
#endif
... no tokens survive preprocessing in the standard mode, but the
expected output of 'cc -E -traditional' (ignoring blank lines and line
number annotations) is
#ifdef bar
quux
#endif
clang, however, has a bug in which the nested #endif is *not* ignored,
causing the subsequent non-nested #endif to trigger an error:
#ifdef bar
quux
test.c:5:2: error: #endif without #if
#endif
^
1 error generated.
This may not just affect #endif: clang preprocesses *this* fragment ...
/* this comment is not indented */
#ifdef bar
quux
#else
greeble
#endif
... to just 'greeble' and no errors, with or without -traditional.
I observe this behavior with both
'clang version 3.8.1-17 (tags/RELEASE_381/final)' and
'clang version 3.9.1-4 (tags/RELEASE_391/rc2)' as supplied by Debian.
Another person has reported identical behavior with
'Apple LLVM version 8.0.0 (clang-800.0.42.1)'.
--
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/20170206/83d5bdee/attachment-0001.html>
More information about the llvm-bugs
mailing list