mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-23 19:03:59 +08:00
d7ceffab96
When libgcc is being built in --disable-tls configuration or on a target without native TLS support, one gets annoying warnings: ../../../../libgcc/emutls.c:61:7: warning: conflicting types for built-in function ‘__emutls_get_address’; expected ‘void *(void *)’ [-Wbuiltin-declaration-mismatch] 61 | void *__emutls_get_address (struct __emutls_object *); | ^~~~~~~~~~~~~~~~~~~~ ../../../../libgcc/emutls.c:63:6: warning: conflicting types for built-in function ‘__emutls_register_common’; expected ‘void(void *, unsigned int, unsigned int, void *)’ +[-Wbuiltin-declaration-mismatch] 63 | void __emutls_register_common (struct __emutls_object *, word, word, void *); | ^~~~~~~~~~~~~~~~~~~~~~~~ ../../../../libgcc/emutls.c:140:1: warning: conflicting types for built-in function ‘__emutls_get_address’; expected ‘void *(void *)’ [-Wbuiltin-declaration-mismatch] 140 | __emutls_get_address (struct __emutls_object *obj) | ^~~~~~~~~~~~~~~~~~~~ ../../../../libgcc/emutls.c:204:1: warning: conflicting types for built-in function ‘__emutls_register_common’; expected ‘void(void *, unsigned int, unsigned int, void *)’ +[-Wbuiltin-declaration-mismatch] 204 | __emutls_register_common (struct __emutls_object *obj, | ^~~~~~~~~~~~~~~~~~~~~~~~ The thing is that in that case __emutls_get_address and __emutls_register_common are builtins, and are declared with void * arguments rather than struct __emutls_object *. Now, struct __emutls_object is a type private to libgcc/emutls.c and the middle-end creates on demand when calling the builtins a similar structure (with small differences, like not having the union in there). We have a precedent for this e.g. for fprintf or strftime builtins where the builtins are created with magic fileptr_type_node or const_tm_ptr_type_node types and then match it with user definition of pointers to some structure, but I think for this case users should never define these functions themselves nor call them and having special types for them in the compiler would mean extra compile time spent during compiler initialization and more GC data, so I think it is better to keep the compiler as is. On the library side, there is an option to just follow what the compiler is doing and do EMUTLS_ATTR void -__emutls_register_common (struct __emutls_object *obj, +__emutls_register_common (void *xobj, word size, word align, void *templ) { + struct __emutls_object *obj = (struct __emutls_object *) xobj; but that will make e.g. libabigail complain about ABI change in libgcc. So, the patch just turns the warning off. 2023-12-06 Thomas Schwinge <thomas@codesourcery.com> Jakub Jelinek <jakub@redhat.com> PR libgcc/109289 * emutls.c: Add GCC diagnostic ignored "-Wbuiltin-declaration-mismatch" pragma. |
||
---|---|---|
.. | ||
config | ||
soft-fp | ||
ChangeLog | ||
config.host | ||
config.in | ||
configure | ||
configure.ac | ||
crtstuff.c | ||
dfp-bit.c | ||
dfp-bit.h | ||
divmod.c | ||
emutls.c | ||
enable-execute-stack-empty.c | ||
enable-execute-stack-mprotect.c | ||
find-symver.awk | ||
fixed-bit.c | ||
fixed-bit.h | ||
fixed-obj.mk | ||
floatunsidf.c | ||
floatunsisf.c | ||
floatunsitf.c | ||
floatunsixf.c | ||
fp-bit.c | ||
fp-bit.h | ||
gbl-ctors.h | ||
gcov.h | ||
gen-fixed.sh | ||
generic-morestack-thread.c | ||
generic-morestack.c | ||
generic-morestack.h | ||
gstdint.h | ||
gthr-posix.h | ||
gthr-single.h | ||
gthr.h | ||
hardcfr.c | ||
libgcc2.c | ||
libgcc2.h | ||
libgcc-std.ver.in | ||
libgcov-driver-system.c | ||
libgcov-driver.c | ||
libgcov-interface.c | ||
libgcov-merge.c | ||
libgcov-profiler.c | ||
libgcov-util.c | ||
libgcov.h | ||
Makefile.in | ||
memcmp.c | ||
memcpy.c | ||
memmove.c | ||
memset.c | ||
mkheader.sh | ||
mkmap-flat.awk | ||
mkmap-symver.awk | ||
offloadstuff.c | ||
shared-object.mk | ||
siditi-object.mk | ||
static-object.mk | ||
strub.c | ||
sync.c | ||
udivhi3.c | ||
udivmod.c | ||
udivmodhi4.c | ||
udivmodsi4.c | ||
unwind-arm-common.inc | ||
unwind-c.c | ||
unwind-compat.c | ||
unwind-compat.h | ||
unwind-dw2-btree.h | ||
unwind-dw2-execute_cfa.h | ||
unwind-dw2-fde-compat.c | ||
unwind-dw2-fde-dip.c | ||
unwind-dw2-fde.c | ||
unwind-dw2-fde.h | ||
unwind-dw2.c | ||
unwind-dw2.h | ||
unwind-generic.h | ||
unwind-pe.h | ||
unwind-seh.c | ||
unwind-sjlj.c | ||
unwind.inc | ||
vtv_end_preinit.c | ||
vtv_end.c | ||
vtv_start_preinit.c | ||
vtv_start.c |