<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 - clang doesn't include two headers symlinked to the same target"
href="https://bugs.llvm.org/show_bug.cgi?id=42500">42500</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang doesn't include two headers symlinked to the same target
</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>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Driver
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>karen@codesynthesis.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=22191" name="attach_22191" title="Test program">attachment 22191</a> <a href="attachment.cgi?id=22191&action=edit" title="Test program">[details]</a></span>
Test program
Hello,
My system is Fedora 28 with clang 6.0.1 installed as the
clang-6.0.1-2.fc28.x86_64 package.
When compiling a C source file that includes two headers which are different
symlinks to the same target, then the second header is not included.
The issue is reproduced by the attached test program:
$ tar xfz test.tar.gz
$ cd test
$ tree --charset ascii
.
|-- a
| |-- linux.h
| `-- platform.h -> ../platform.h
|-- b
| |-- linux.h
| `-- platform.h -> ../platform.h
|-- main.c
`-- platform.h
$ clang -I. main.c
main.c:8:7: error: use of undeclared identifier 'B'
r = B;
^
1 error generated.
The only explanation why the macro B is not defined is that the header
b/platform.h is not included.
Note that gcc compiles with no errors:
$ gcc -I. main.c
$ ls a.out
a.out
Also note that if to replace the b/platform.h symlink with its target then
clang compiles with no errors either:
$ rm a.out b/platform.h
$ cp platform.h b/
$ clang -I. main.c
$ ls a.out
a.out</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>