diff options
Diffstat (limited to 'include/libc-symbols.h')
-rw-r--r-- | include/libc-symbols.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/include/libc-symbols.h b/include/libc-symbols.h index 0783ade0b3..18f26b2e61 100644 --- a/include/libc-symbols.h +++ b/include/libc-symbols.h @@ -892,5 +892,48 @@ for linking") #else # define inhibit_loop_to_libcall #endif + +/* These macros facilitate sharing source files with gnulib. + + They are here instead of sys/cdefs.h because they should not be + used in public header files. + + Their definitions should be kept consistent with the definitions in + gnulib-common.m4, but it is not necessary to cater to old non-GCC + compilers, since they will only be used while building glibc itself. + (Note that _GNUC_PREREQ cannot be used in this file.) */ + +/* Define as a marker that can be attached to declarations that might not + be used. This helps to reduce warnings, such as from + GCC -Wunused-parameter. */ +#if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) +# define _GL_UNUSED __attribute__ ((__unused__)) +#else +# define _GL_UNUSED +#endif + +/* gcc supports the "unused" attribute on possibly unused labels, and + g++ has since version 4.5. Note to support C++ as well as C, + _GL_UNUSED_LABEL should be used with a trailing ; */ +#if !defined __cplusplus || __GNUC__ > 4 \ + || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) +# define _GL_UNUSED_LABEL _GL_UNUSED +#else +# define _GL_UNUSED_LABEL +#endif + +/* The __pure__ attribute was added in gcc 2.96. */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#else +# define _GL_ATTRIBUTE_PURE /* empty */ +#endif + +/* The __const__ attribute was added in gcc 2.95. */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) +#else +# define _GL_ATTRIBUTE_CONST /* empty */ +#endif #endif /* libc-symbols.h */ |