[llvm-bugs] [Bug 26577] New: #include_next distinguish between double quotes and angle brackets inclusion
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Feb 11 11:21:26 PST 2016
https://llvm.org/bugs/show_bug.cgi?id=26577
Bug ID: 26577
Summary: #include_next distinguish between double quotes and
angle brackets inclusion
Product: clang
Version: 3.7
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: lugovskoy at gmail.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
Clang preprocessor goes to infinite loop trying to resolve #include_next
directive.
According to GCC specification for #include_next extension (that is also known
as Wrapper Headers):
`#include_next' does not distinguish between <file> and "file" inclusion, nor
does it check that the file you specify has the same name as the current file.
It simply looks for the file named, starting with the directory in the search
path after the one where the current file was found.
At the same time clang preprocessor handles #include_next directives
differently if filenames are enclosed with double quotes and angle brackets.
Let's see the example:
'test.c':
#include "mystd.h"
'mystd.h':
#include_next "mystd.h"
'inc/mystd.h':
int a;
$gcc -E -Iinc test.c
...
int a;
...
$clang --version
clang version 3.7.1 (tags/RELEASE_371/final)
$clang -E -Iinc test.c
...
...
...
never ending infinite loop
...
...
clang preprocessor recursively includes 'mystd.h' header file
If 'mystd.h' is changed to enclose filename with angle brackets then clang
works fine:
'mystd.h':
#include_next <mystd.h>
$clang -E -Iinc test.c
...
int a;
...
Clang preprocessor should not depend on enclosing methods to process
#include_next directives.
--
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/20160211/4ff45e18/attachment.html>
More information about the llvm-bugs
mailing list