<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:richard-llvm@metafoo.co.uk" title="Richard Smith <richard-llvm@metafoo.co.uk>"> <span class="fn">Richard Smith</span></a>
</span> changed
              <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - Possible defect in implementation of clang compiler headers, vis-a-vis include_next"
   href="https://llvm.org/bugs/show_bug.cgi?id=24754">bug 24754</a>
        <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>NEW
           </td>
           <td>RESOLVED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>---
           </td>
           <td>INVALID
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - Possible defect in implementation of clang compiler headers, vis-a-vis include_next"
   href="https://llvm.org/bugs/show_bug.cgi?id=24754#c3">Comment # 3</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - Possible defect in implementation of clang compiler headers, vis-a-vis include_next"
   href="https://llvm.org/bugs/show_bug.cgi?id=24754">bug 24754</a>
              from <span class="vcard"><a class="email" href="mailto:richard-llvm@metafoo.co.uk" title="Richard Smith <richard-llvm@metafoo.co.uk>"> <span class="fn">Richard Smith</span></a>
</span></b>
        <pre>(In reply to <a href="show_bug.cgi?id=24754#c2">comment #2</a>)
<span class="quote">> Hardly spelunking.</span >

It really is. The existence of these files is an implementation detail of the
compiler; we've recently been discussing the possibility of baking them into
the compiler and not making them present on the file system at all.

<span class="quote">> Also, such an implementation would not rely on an extension like
> include_next but instead attempt to detect and include the first stdint.h
> header otherwise found by the normal search in the include search paths and
> roll the normal include chain from there.</span >

There's no portable way for it to detect those headers, and as you've seen
here, including them does not work portably either (even if they exist as
on-disk files and you can figure out a way to include them). The right thing to
do is to use #include_next (for the compilers that support it).

Note also that your proposed technique doesn't even work: if someone includes
your C++ standard library header by an include path (which you seem to be
claiming is reasonable), they will include clang's header, whose include_next
will include the C++ standard library header (or maybe something even earlier
on the include path), and if that header has a normal include guard, we will
never reach the C library's header.

<span class="quote">> Anyways, the point is that (at least) the stdint.h compiler header is
> crafted in a way that prevents this use and it seems like an arbitrary
> restriction with no other purpose than that.</span >

It's not arbitrary and purposeless, it's following the normal include guard
idiom. It would be weird if it did anything else.</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>