[2.24 PATCH 1/3] Add utility macros for clang detection, and deprecation with messages.

Paul Eggert eggert@cs.ucla.edu
Mon Aug 1 03:29:00 GMT 2016


Zack Weinberg wrote:
> +#if __GNUC_PREREQ (4,5) || \
> +    __glibc_clang_has_extension (__attribute_deprecated_with_message__)

This sort of condition should be reworded to be simpler, like this:

#if __glibc_has_extension (__attribute_deprecated_with_message__)

with an implementation that looks something like this:

#ifdef __has_extension
# define __glibc_has_extension(ext) __has_extension (ext)
#else
# define __glibc_has_extension(ext) __glibc_has_extension##ext
# define __glibc_has_extension__attribute_deprecated_with_message__ 
__GNUC_PREREQ (4,5)
#endif

This will be easier to maintain, as only the implementation will need to worry 
about GCC version numbers.



More information about the Libc-alpha mailing list