<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - Unexpected #include_next behavior on clang 3.8"
   href="https://llvm.org/bugs/show_bug.cgi?id=28993">28993</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Unexpected #include_next behavior on clang 3.8
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.8
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </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>Frontend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>pumpkin@me.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=16964" name="attach_16964" title="Small reproduction">attachment 16964</a> <a href="attachment.cgi?id=16964&action=edit" title="Small reproduction">[details]</a></span>
Small reproduction

As of 3.8, libc++ now bundles a small stdlib.h that does #include_next to get
the real stdlib.h. My issues arise in the following scenario:

- I'm building libc++abi 3.8.0
- I'm building it on a host with llvm/clang/libc++/libc++abi all at 3.8.0
- To build, I need to provide libc++abi's build process with the libc++ source
code
- My libc++abi build fails complaining about a bunch of missing stdlib.h
identifiers
- Upon deeper investigation, it turns out that the proper glibc stdlib.h never
gets #included into the compilation

>From what I can gather from -v, my search path looks something like:

1. Headers from libc++ source tree I pass to libc++abi build
2. System libc++ headers
3. A couple more unrelated things
4. glibc headers (which I've checked indeed do contain a valid stdlib.h)

Judging by -E and -H, clang++ seems to decide that it's included enough after
step #2 above, and never makes its way down to #4 to get my system stdlib.h.


I'm attaching a reduced test case that demonstrates my confusion. The tarball
contains test.sh and test2.sh that demonstrate the problem with both -I and
-isystem on a brand new vanilla Ubuntu 14.04 instance that I just installed
clang 3.8 onto as well as standard development tools to get system headers.

Not sure if I'm doing something wrong, but this behavior doesn't fit what I'd
expect of #include_next.</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>