[llvm-bugs] [Bug 42500] New: clang doesn't include two headers symlinked to the same target

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jul 3 11:17:22 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=42500

            Bug ID: 42500
           Summary: clang doesn't include two headers symlinked to the
                    same target
           Product: clang
           Version: 6.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Driver
          Assignee: unassignedclangbugs at nondot.org
          Reporter: karen at codesynthesis.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

Created attachment 22191
  --> https://bugs.llvm.org/attachment.cgi?id=22191&action=edit
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

-- 
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/20190703/0e9a93d9/attachment.html>


More information about the llvm-bugs mailing list