[cfe-dev] linux build fix

Neil Booth neil at daikokuya.co.uk
Sun Dec 9 14:38:59 PST 2007


Chris Lattner wrote:-

> #define CHAR_BIT  __builtin_config_info("target_char_bit")
> #define SCHAR_MAX __builtin_config_info("target_schar_max")

Hmm, sounds familiar :)

> The 'risk' to this is that it will change the preprocessed output of  
> the compiler vs GCC.  For example, something silly like this will  
> expand differently.
> 
> #define foo(x) # x
> 
> foo(CHAR_BIT);
> 
> However, anything that relies on that is dangerously non-conformant  
> anyway, so I don't feel too bad about breaking it :)

?  That always produces "CHAR_BIT".  If you an extra level of
indirection, so that it is actually expanded, presumably you and
GCC would get "8" each too.  I don't see a problem here.

Neil.



More information about the cfe-dev mailing list