gcc/libgcc
Jakub Jelinek d7ceffab96 libgcc: Avoid -Wbuiltin-declaration-mismatch warnings in emutls.c
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.
2023-12-06 12:27:12 +01:00
..
config [committed] Fix rx build failure in libgcc 2023-12-02 22:07:59 -07:00
soft-fp libgcc: Add {unsigned ,}__int128 <-> _Decimal{32,64,128} conversion support [PR65833] 2023-11-09 09:14:07 +01:00
ChangeLog Daily bump. 2023-12-06 00:17:50 +00:00
config.host arm: libgcc: provide implementations of __sync_synchronize 2023-11-24 14:15:26 +00:00
config.in gcov: use mmap pools for KVP. 2021-03-03 14:21:45 +01:00
configure Deprecate a.out support for NetBSD targets. 2023-08-07 22:59:41 +02:00
configure.ac LoongArch Port: libgcc 2022-03-29 17:43:35 +08:00
crtstuff.c Update copyright years. 2023-01-16 11:52:17 +01:00
dfp-bit.c Update copyright years. 2023-01-16 11:52:17 +01:00
dfp-bit.h Update copyright years. 2023-01-16 11:52:17 +01:00
divmod.c Update copyright years. 2023-01-16 11:52:17 +01:00
emutls.c libgcc: Avoid -Wbuiltin-declaration-mismatch warnings in emutls.c 2023-12-06 12:27:12 +01:00
enable-execute-stack-empty.c
enable-execute-stack-mprotect.c Update copyright years. 2023-01-16 11:52:17 +01:00
find-symver.awk Update copyright years. 2023-01-16 11:52:17 +01:00
fixed-bit.c Update copyright years. 2023-01-16 11:52:17 +01:00
fixed-bit.h Update copyright years. 2023-01-16 11:52:17 +01:00
fixed-obj.mk
floatunsidf.c
floatunsisf.c
floatunsitf.c
floatunsixf.c
fp-bit.c Update copyright years. 2023-01-16 11:52:17 +01:00
fp-bit.h Update copyright years. 2023-01-16 11:52:17 +01:00
gbl-ctors.h Update copyright years. 2023-01-16 11:52:17 +01:00
gcov.h Update copyright years. 2023-01-16 11:52:17 +01:00
gen-fixed.sh
generic-morestack-thread.c Update copyright years. 2023-01-16 11:52:17 +01:00
generic-morestack.c Update copyright years. 2023-01-16 11:52:17 +01:00
generic-morestack.h Update copyright years. 2023-01-16 11:52:17 +01:00
gstdint.h
gthr-posix.h Update copyright years. 2023-01-16 11:52:17 +01:00
gthr-single.h Update copyright years. 2023-01-16 11:52:17 +01:00
gthr.h Update copyright years. 2023-01-16 11:52:17 +01:00
hardcfr.c libgcc: mark __hardcfr_check_fail as always_inline 2023-11-23 17:31:40 +01:00
libgcc2.c libgcc _BitInt helper documentation [PR102989] 2023-09-06 17:42:37 +02:00
libgcc2.h Introduce strub: machine-independent stack scrubbing 2023-12-05 21:07:36 -03:00
libgcc-std.ver.in Introduce strub: machine-independent stack scrubbing 2023-12-05 21:07:36 -03:00
libgcov-driver-system.c Update copyright years. 2023-01-16 11:52:17 +01:00
libgcov-driver.c Update copyright years. 2023-01-16 11:52:17 +01:00
libgcov-interface.c Update copyright years. 2023-01-16 11:52:17 +01:00
libgcov-merge.c Update copyright years. 2023-01-16 11:52:17 +01:00
libgcov-profiler.c Update copyright years. 2023-01-16 11:52:17 +01:00
libgcov-util.c Update copyright years. 2023-01-16 11:52:17 +01:00
libgcov.h gcov: Fix use of __LIBGCC_HAVE_LIBATOMIC 2023-12-01 09:54:24 +01:00
Makefile.in Introduce strub: machine-independent stack scrubbing 2023-12-05 21:07:36 -03:00
memcmp.c
memcpy.c
memmove.c
memset.c
mkheader.sh Update copyright years. 2023-01-16 11:52:17 +01:00
mkmap-flat.awk Update copyright years. 2023-01-16 11:52:17 +01:00
mkmap-symver.awk Update copyright years. 2023-01-16 11:52:17 +01:00
offloadstuff.c openmp: Add support for the 'indirect' clause in C/C++ 2023-11-07 15:44:50 +00:00
shared-object.mk
siditi-object.mk
static-object.mk
strub.c Introduce strub: machine-independent stack scrubbing 2023-12-05 21:07:36 -03:00
sync.c Update copyright years. 2023-01-16 11:52:17 +01:00
udivhi3.c Update copyright years. 2023-01-16 11:52:17 +01:00
udivmod.c Update copyright years. 2023-01-16 11:52:17 +01:00
udivmodhi4.c Update copyright years. 2023-01-16 11:52:17 +01:00
udivmodsi4.c Update copyright years. 2023-01-16 11:52:17 +01:00
unwind-arm-common.inc Update copyright years. 2023-01-16 11:52:17 +01:00
unwind-c.c Update copyright years. 2023-01-16 11:52:17 +01:00
unwind-compat.c Update copyright years. 2023-01-16 11:52:17 +01:00
unwind-compat.h Update copyright years. 2023-01-16 11:52:17 +01:00
unwind-dw2-btree.h Update copyright years. 2023-01-16 11:52:17 +01:00
unwind-dw2-execute_cfa.h libgcc: Fix uninitialized RA signing on AArch64 [PR107678] 2023-01-18 12:20:35 +00:00
unwind-dw2-fde-compat.c Update copyright years. 2023-01-16 11:52:17 +01:00
unwind-dw2-fde-dip.c libgcc: Fix -Wint-conversion warning in find_fde_tail 2023-07-11 06:19:39 +02:00
unwind-dw2-fde.c preserve base pointer for __deregister_frame [PR110956] 2023-08-11 09:20:27 -06:00
unwind-dw2-fde.h Update copyright years. 2023-01-16 11:52:17 +01:00
unwind-dw2.c libgcc: Fix uninitialized RA signing on AArch64 [PR107678] 2023-01-18 12:20:35 +00:00
unwind-dw2.h libgcc: Fix uninitialized RA signing on AArch64 [PR107678] 2023-01-18 12:20:35 +00:00
unwind-generic.h Update copyright years. 2023-01-16 11:52:17 +01:00
unwind-pe.h [committed] Fix build of libgcc on ports using FDPIC 2023-12-02 22:45:48 -07:00
unwind-seh.c Update copyright years. 2023-01-16 11:52:17 +01:00
unwind-sjlj.c Update copyright years. 2023-01-16 11:52:17 +01:00
unwind.inc Update copyright years. 2023-01-16 11:52:17 +01:00
vtv_end_preinit.c Update copyright years. 2023-01-16 11:52:17 +01:00
vtv_end.c Update copyright years. 2023-01-16 11:52:17 +01:00
vtv_start_preinit.c Update copyright years. 2023-01-16 11:52:17 +01:00
vtv_start.c Update copyright years. 2023-01-16 11:52:17 +01:00