From 74b93e4d32633fc896ec61ca73b79f7d4725e2a3 Mon Sep 17 00:00:00 2001 From: Yann Sionneau Date: Tue, 17 Aug 2021 22:09:53 +0200 Subject: Fix warnings due to missing attributes for __EI_ prefixed symbols With new compiler (gcc >= 9 ?) building uClibc-ng now gives this sort of warnings: ./include/libc-symbols.h:426:25: warning: '__EI_localeconv' specifies less restrictive attribute than its target 'localeconv': 'nothrow' [-Wmissing-attributes] 426 | extern __typeof (name) __EI_##name __attribute__((alias (__hidden_asmname1 (,#local)))) | ^~~~~ ./include/libc-symbols.h:429:29: note: in expansion of macro '__hidden_ver1' 429 | # define hidden_def(name) __hidden_ver1(__GI_##name, name, name); | ^~~~~~~~~~~~~ ./include/libc-symbols.h:497:32: note: in expansion of macro 'hidden_def' 497 | # define libc_hidden_def(name) hidden_def (name) | ^~~~~~~~~~ libc/misc/locale/locale.c:306:1: note: in expansion of macro 'libc_hidden_def' 306 | libc_hidden_def(localeconv) | ^~~~~~~~~~~~~~~ In file included from libc/misc/locale/localeconv.c:8: libc/misc/locale/locale.c:261:15: note: '__EI_localeconv' target declared here 261 | struct lconv *localeconv(void) | ^~~~~~~~~~ The fix is mostly being backported/adapted from glibc. --- include/sys/cdefs.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include/sys/cdefs.h') diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h index a4359a05c..5c4daebcd 100644 --- a/include/sys/cdefs.h +++ b/include/sys/cdefs.h @@ -330,6 +330,17 @@ # endif #endif +/* Undefine (also defined in libc-symbols.h). */ +#undef __attribute_copy__ +#if __GNUC_PREREQ (9, 0) +/* Copies attributes from the declaration or type referenced by + the argument. */ +# define __attribute_copy__(arg) __attribute__ ((__copy__ (arg))) +#else +# define __attribute_copy__(arg) +#endif + + /* GCC 4.3 and above allow passing all anonymous arguments of an __extern_always_inline function to some other vararg function. */ #if __GNUC_PREREQ (4,3) -- cgit v1.2.3