[llvm-bugs] [Bug 43982] New: clang -frewrite-includes fails to remove __has_include if behind a macro.

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Nov 12 10:19:21 PST 2019


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: unassignedclangbugs at nondot.org
          Reporter: emilio at crisal.io
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191112/a1135ed8/attachment-0001.html>


More information about the llvm-bugs mailing list