<html>
    <head>
      <base href="http://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 --- - clang's stdint.h forwarding can silently result in no standard integer types being defined."
   href="http://llvm.org/bugs/show_bug.cgi?id=16988">16988</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang's stdint.h forwarding can silently result in no standard integer types being defined.
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>zalman@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The clang internal version of stdint.h (llvm/tools/clang/lib/Headers/stdint.h)
forwards to a system version of stdint.h via include_next in certain
situations. If the next stdint.h file found via that forwarding is also clang's
header (e.g. the same file in a different tree of includes), it silently does
nothing since the file level include guard (__CLANG_STDINT_H) is already
defined at the time of forwarding.

Now I'm not sure if this is a serious issue in valid configurations or just a
hassle in strange cross compilation setups. An example of a valid case would be
the system compiler is clang and one is building a different version of clang.
Perhaps one is not supposed to use clang's internal stdint.h in e.g.
/usr/include. Even if so, it would be nice for this to turn into an error
instead of silently producing no definitions for stdint types.

One possible fix is to not define the include guard if forwarding. That would
involve moving the include guard inside the #else part of the #if that controls
forwarding. (This should never result in an infinite loop as the include_next
should finitely iterate a list of possible includes.) Another possible fix is
to do something like the following before "# include_next <stdint.h>":

    #define _CLANG_STDINT_H_FORWARDED

and before the include guard in llvm/tools/clang/lib/Headers/stdint.h put:

    #ifdef _CLANG_STDINT_H_FORWARDED
    #error "clang internal stdint.h forwarding to self. Bad compiler
configuration."
    #endif</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>