diff options
author | Yao Zi <ziyao@disroot.org> | 2024-04-11 11:02:38 +0000 |
---|---|---|
committer | Waldemar Brodkorb <wbx@openadk.org> | 2024-04-14 16:01:17 +0200 |
commit | e1c1afff0e672a9026de005d73c7bc2e221ef3e1 (patch) | |
tree | 50a19071b1d6452b99a8627ff08c2d5534ea847c /include | |
parent | 4d6636f6b22718a4181833db4579a003c0893683 (diff) |
libuargp: restrict compatibility macros in argp.h only
Macros __attribute__, __format__ and __printf__ are defined in argp.h
for compatibility with ANSI and old gccs. But leaving them effective
out of the scope of the header may break applications relying on
these compiler attributes even with __STRICT_ANSI__ defined. So undef
the macros after using.
Signed-off-by: Yao Zi <ziyao@disroot.org>
Reviewed-by: Petr Vorel <petr.vorel@gmail.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/argp.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/argp.h b/include/argp.h index 8e8674296..d57920970 100644 --- a/include/argp.h +++ b/include/argp.h @@ -46,12 +46,14 @@ /* This feature is available in gcc versions 2.5 and later. */ # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || defined(__STRICT_ANSI__) # define __attribute__(Spec) /* empty */ +# define __UCLIBC_ATTRIBUTE_FALLBACK__ # endif /* The __-protected variants of `format' and `printf' attributes are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */ # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) || defined(__STRICT_ANSI__) # define __format__ format # define __printf__ printf +# define __UCLIBC_PRINTF_FALLBACK__ # endif #endif @@ -562,4 +564,13 @@ __NTH (__option_is_end (__const struct argp_option *__opt)) } #endif +#ifdef __UCLIBC_ATTRIBUTE_FALLBACK__ +# undef __attribute__ +#endif + +#ifdef __UCLIBC_PRINTF_FALLBACK__ +# undef __format__ +# undef __printf__ +#endif + #endif /* argp.h */ |