[cfe-dev] math.h on Windows

Douglas Gregor dgregor at apple.com
Fri Oct 23 09:33:48 PDT 2009


On Oct 23, 2009, at 9:10 AM, Daniel Dunbar wrote:

> On Thu, Oct 15, 2009 at 5:23 PM, Douglas Gregor <dgregor at apple.com>  
> wrote:
>>> Also, could someone look at the enclosed patch for stdint.h?  This  
>>> also
>>> fixes some failing tests, since VC++ doesn't have stdint.h.  Who  
>>> is point on
>>> this?
>>
>> I'm not thrilled about using _M_IX86 and _M_X64 to detect what is  
>> really a
>> library issue. I guess in the worst case we could have a configure- 
>> time
>> check that determines whether we can #include_next <stdint.h>, but
>> that's.... horrible.
>> Unless someone has a better idea... ?
>
> No configure-time check. :P
>
> We could always invent a clang specific internal define for this,
> which targets can set in their predefines. For example,
> __STDC_INCLUDES_STDINT__ or so.


It seems to me that target information should be limited to  
information about the ABI, linker, assembler, and other parts of the  
toolchain, but not the (C or C++) standard library, since standard  
libraries are meant to be interchangeable.

However, I have an idea. Clang's <stdint.h> looks like this:

/* If we're hosted, fall back to the system's stdint.h, which might have
  * additional definitions.
  */
#if __STDC_HOSTED__
# include_next <stdint.h>
#else
// our own definitions of <stdint.h>
#endif

why not add new __has_include and __has_include_next preprocessor  
primitives, so that we can *really* detect whether we have a system  
<stdint.h>?

This also gets us closer to eliminating the need for configure :D

	- Doug



More information about the cfe-dev mailing list