Feature request - a macro defined for GCC
Joseph S. Myers
joseph@codesourcery.com
Thu Jul 3 22:05:00 GMT 2008
On Thu, 3 Jul 2008, Chris Lattner wrote:
> is much better than some mismash of version checking, which isn't guaranteed
> to be right in the future. One disadvantage of this is that it will put even
> more burden on the already overloaded preprocessor. It would be much nicer to
> have a feature query system that doesn't rely on one macro per system.
> Perhaps something like:
>
> #if __feature_supported(nested_functions) &&
> __feature_supported(transparent_union) &&
> __feature_supported(attribute_aligned)
> ...
This looks rather like a reinvention of the #assert system (which is
deprecated, or at least recommended against in the manual).
> Taking an approach reduces startup time of the preprocessor, because it
> doesn't have to populate the identifier table with tons of predefines.
I'd hope this is not a significant cost (certainly not compared to the
thousands of built-in functions on some target), though I haven't seen
recent figures for startup costs.
We have some existing practice for feature macros (__GNUC_GNU_INLINE__,
__GNUC_STDC_INLINE__, __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1, ...).
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Gcc
mailing list