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

            Bug ID: 43982
           Summary: clang -frewrite-includes fails to remove __has_include
                    if behind a macro.
           Product: clang
           Version: 9.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangb...@nondot.org
          Reporter: emi...@crisal.io
                CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
                    neeil...@live.com, richard-l...@metafoo.co.uk

Created attachment 22801
  --> https://bugs.llvm.org/attachment.cgi?id=22801&action=edit
test-case.cpp

Minimal test-case attached. STR:

$ touch t.h
$ clang -frewrite-includes -E test-case.cpp > pre-processed.cpp
$ rm t.h
$ clang pre-processed.cpp
t.cpp:10:3: error: use of undeclared identifier 'std'
  std::cout << "Hello world" << std::endl;
  ^
t.cpp:10:33: error: use of undeclared identifier 'std'
  std::cout << "Hello world" << std::endl;

This is because:

 * The __has_include check is not removed when expanding, and...
 * The second <iostream> expansion is suppressed.

This is causing problems when building Firefox on Linux with distributed
compilers, because glibc has started using this pattern:
https://sourceware.org/ml/libc-alpha/2019-06/msg00254.html

I plan to try and submit a glibc workaround, but it'd be great if it wasn't
needed :)

-- 
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