[cfe-dev] math.h on Windows

Douglas Gregor dgregor at apple.com
Fri Oct 23 11:53:51 PDT 2009


On Oct 23, 2009, at 11:48 AM, John Thompson wrote:

> That (__has_include etc.) sounds good.  I'm assuming that is for use  
> in a #if?

Yes, just like __has_builtin and __has_feature.

It probably makes sense to allow the same forms as include directives,  
e.g.,

	__has_include(<stdlib.h>)
	__has_include("stdlib.h")
	__has_include_next(<stdlib.h>)
	__has_include_next("stdlib.h")


> Would you like me to take a stab at it>

That would be great!

	- Doug

> -John
> On Fri, Oct 23, 2009 at 9:33 AM, Douglas Gregor <dgregor at apple.com>  
> wrote:
>
> 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
>
>
>
> -- 
> John Thompson
> John.Thompson.JTSoftware at gmail.com
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20091023/1b84001b/attachment.html>


More information about the cfe-dev mailing list