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: unassignedclangb...@nondot.org
          Reporter: ka...@codesynthesis.com
                CC: llvm-bugs@lists.llvm.org, neeil...@live.com,
                    richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to