Revisão | 74b93e4d32633fc896ec61ca73b79f7d4725e2a3 (tree) |
---|---|
Hora | 2021-08-25 21:14:02 |
Autor | Yann Sionneau <ysionneau@kalr...> |
Commiter | Waldemar Brodkorb |
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]
./include/libc-symbols.h:429:29: note: in expansion of macro 'hidden_ver1'
./include/libc-symbols.h:497:32: note: in expansion of macro 'hidden_def'
libc/misc/locale/locale.c:306:1: note: in expansion of macro 'libc_hidden_def'
In file included from libc/misc/locale/localeconv.c:8:
libc/misc/locale/locale.c:261:15: note: 'EI_localeconv' target declared here
The fix is mostly being backported/adapted from glibc.
@@ -156,6 +156,11 @@ | ||
156 | 156 | # define ASM_LINE_SEP ; |
157 | 157 | #endif |
158 | 158 | |
159 | +#ifndef __attribute_copy__ | |
160 | +/* Provide an empty definition when cdefs.h is not included. */ | |
161 | +# define __attribute_copy__(arg) | |
162 | +#endif | |
163 | + | |
159 | 164 | #ifndef __ASSEMBLER__ |
160 | 165 | /* GCC understands weak symbols and aliases; use its interface where |
161 | 166 | possible, instead of embedded assembly language. */ |
@@ -163,13 +168,13 @@ | ||
163 | 168 | /* Define ALIASNAME as a strong alias for NAME. */ |
164 | 169 | # define strong_alias(name, aliasname) _strong_alias(name, aliasname) |
165 | 170 | # define _strong_alias(name, aliasname) \ |
166 | - extern __typeof (name) aliasname __attribute__ ((alias (#name))); | |
171 | + extern __typeof (name) aliasname __attribute__ ((alias (#name))) __attribute_copy__ (name); | |
167 | 172 | /* Same, but does not check for type match. Use sparingly. |
168 | 173 | Example: strong_alias(stat,stat64) may fail, this one works: */ |
169 | 174 | # define strong_alias_untyped(name, aliasname) \ |
170 | 175 | _strong_alias_untyped(name, aliasname) |
171 | 176 | # define _strong_alias_untyped(name, aliasname) \ |
172 | - extern __typeof (aliasname) aliasname __attribute__ ((alias (#name))); | |
177 | + extern __typeof (aliasname) aliasname __attribute__ ((alias (#name))) __attribute_copy__ (name); | |
173 | 178 | |
174 | 179 | # ifdef HAVE_WEAK_SYMBOLS |
175 | 180 |
@@ -182,7 +187,7 @@ | ||
182 | 187 | If weak aliases are not available, this defines a strong alias. */ |
183 | 188 | # define weak_alias(name, aliasname) _weak_alias (name, aliasname) |
184 | 189 | # define _weak_alias(name, aliasname) \ |
185 | - extern __typeof (name) aliasname __attribute__ ((weak, alias (#name))); | |
190 | + extern __typeof (name) aliasname __attribute__ ((weak, alias (#name))) __attribute_copy__ (name); | |
186 | 191 | |
187 | 192 | /* Declare SYMBOL as weak undefined symbol (resolved to 0 if not defined). */ |
188 | 193 | # define weak_extern(symbol) _weak_extern (weak symbol) |
@@ -423,7 +428,8 @@ FIXME! - ? | ||
423 | 428 | # define __hidden_asmname2(prefix, name) #prefix name |
424 | 429 | # define __hidden_ver1(local, internal, name) \ |
425 | 430 | extern __typeof (name) __EI_##name __asm__(__hidden_asmname (#internal)); \ |
426 | - extern __typeof (name) __EI_##name __attribute__((alias (__hidden_asmname1 (,#local)))) | |
431 | + extern __typeof (name) __EI_##name __attribute__((alias (__hidden_asmname1 (,#local)))) \ | |
432 | + __attribute_copy__ (name) | |
427 | 433 | # define hidden_ver(local, name) __hidden_ver1(local, __GI_##name, name); |
428 | 434 | # define hidden_data_ver(local, name) hidden_ver(local, name) |
429 | 435 | # define hidden_def(name) __hidden_ver1(__GI_##name, name, name); |
@@ -330,6 +330,17 @@ | ||
330 | 330 | # endif |
331 | 331 | #endif |
332 | 332 | |
333 | +/* Undefine (also defined in libc-symbols.h). */ | |
334 | +#undef __attribute_copy__ | |
335 | +#if __GNUC_PREREQ (9, 0) | |
336 | +/* Copies attributes from the declaration or type referenced by | |
337 | + the argument. */ | |
338 | +# define __attribute_copy__(arg) __attribute__ ((__copy__ (arg))) | |
339 | +#else | |
340 | +# define __attribute_copy__(arg) | |
341 | +#endif | |
342 | + | |
343 | + | |
333 | 344 | /* GCC 4.3 and above allow passing all anonymous arguments of an |
334 | 345 | __extern_always_inline function to some other vararg function. */ |
335 | 346 | #if __GNUC_PREREQ (4,3) |