From: Adhemerval Zanella Date: Fri, 11 Mar 2022 13:40:44 +0000 (-0300) Subject: configure: Use -Wno-ignored-attributes if compiler warns about multiple aliases X-Git-Tag: upstream/2.37~192 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8d98c7c00f3f06545de9e5ce5cf778d2ab2450a4;p=platform%2Fupstream%2Fglibc.git configure: Use -Wno-ignored-attributes if compiler warns about multiple aliases clang emits an warning when a double alias redirection is used, to warn the the original symbol will be used even when weak definition is overridden. However, this is a common pattern for weak_alias, where multiple alias are set to same symbol. Reviewed-by: Fangrui Song --- diff --git a/argp/Makefile b/argp/Makefile index 586136f..8de8fd6 100644 --- a/argp/Makefile +++ b/argp/Makefile @@ -29,9 +29,10 @@ routines = $(addprefix argp-, ba fmtstream fs-xinl help parse pv \ tests = argp-test tst-argp1 bug-argp1 tst-argp2 bug-argp2 \ tst-ldbl-argp -CFLAGS-argp-help.c += $(uses-callbacks) -fexceptions -CFLAGS-argp-parse.c += $(uses-callbacks) -CFLAGS-argp-fmtstream.c += -fexceptions +CFLAGS-argp-help.c += $(uses-callbacks) -fexceptions $(config-cflags-wno-ignored-attributes) +CFLAGS-argp-parse.c += $(uses-callbacks) $(config-cflags-wno-ignored-attributes) +CFLAGS-argp-fmtstream.c += -fexceptions $(config-cflags-wno-ignored-attributes) +CFLAGS-argp-fs-xinl.c += $(config-cflags-wno-ignored-attributes) bug-argp1-ARGS = -- --help bug-argp2-ARGS = -- -d 111 --dstaddr 222 -p 333 --peer 444 diff --git a/configure b/configure index adf263d..fc3d784 100755 --- a/configure +++ b/configure @@ -6347,6 +6347,35 @@ $as_echo "$libc_cv_mtls_dialect_gnu2" >&6; } config_vars="$config_vars have-mtls-dialect-gnu2 = $libc_cv_mtls_dialect_gnu2" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if -Wno-ignored-attributes is required for aliases" >&5 +$as_echo_n "checking if -Wno-ignored-attributes is required for aliases... " >&6; } +if ${libc_cv_wno_ignored_attributes+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.c <&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } +then + libc_cv_wno_ignored_attributes="-Wno-ignored-attributes" +fi +rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_wno_ignored_attributes" >&5 +$as_echo "$libc_cv_wno_ignored_attributes" >&6; } +config_vars="$config_vars +config-cflags-wno-ignored-attributes = $libc_cv_wno_ignored_attributes" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc puts quotes around section names" >&5 $as_echo_n "checking whether cc puts quotes around section names... " >&6; } if ${libc_cv_have_section_quotes+:} false; then : diff --git a/configure.ac b/configure.ac index c5c4b38..9fc1fb1 100644 --- a/configure.ac +++ b/configure.ac @@ -1404,6 +1404,28 @@ rm -f conftest*]) AC_SUBST(libc_cv_mtls_dialect_gnu2) LIBC_CONFIG_VAR([have-mtls-dialect-gnu2], [$libc_cv_mtls_dialect_gnu2]) +dnl clang emits an warning for a double alias redirection, to warn the +dnl original symbol is sed even when weak definition overriddes it. +dnl It is a usual pattern for weak_alias, where multiple alias point to +dnl same symbol. +AC_CACHE_CHECK([if -Wno-ignored-attributes is required for aliases], + libc_cv_wno_ignored_attributes, [dnl +cat > conftest.c < conftest.c < $@; \ diff --git a/sysdeps/aarch64/Makefile b/sysdeps/aarch64/Makefile index 17fb1c5..6a9559e 100644 --- a/sysdeps/aarch64/Makefile +++ b/sysdeps/aarch64/Makefile @@ -57,6 +57,7 @@ endif ifeq ($(subdir),math) CPPFLAGS += -I../soft-fp +CFLAGS-feupdateenv.c += $(config-cflags-wno-ignored-attributes) endif ifeq ($(subdir),misc) diff --git a/sysdeps/arm/Makefile b/sysdeps/arm/Makefile index da4226c..d5cea71 100644 --- a/sysdeps/arm/Makefile +++ b/sysdeps/arm/Makefile @@ -54,6 +54,10 @@ ifeq ($(subdir),gmon) sysdep_routines += arm-mcount endif +ifeq ($(subdir),math) +CFLAGS-feupdateenv.c += $(config-cflags-wno-ignored-attributes) +endif + ifeq ($(subdir),rt) librt-sysdep_routines += rt-aeabi_unwind_cpp_pr1 rt-arm-unwind-resume librt-shared-only-routines += rt-aeabi_unwind_cpp_pr1 rt-arm-unwind-resume diff --git a/sysdeps/wordsize-64/Makefile b/sysdeps/wordsize-64/Makefile index 2fa9347..db7764f 100644 --- a/sysdeps/wordsize-64/Makefile +++ b/sysdeps/wordsize-64/Makefile @@ -1,3 +1,8 @@ ifeq ($(subdir),misc) tests += tst-writev endif + +# strtol is aliased to stroll +CFLAGS-strtol.c += -fno-builtin-strtoll $(config-cflags-wno-ignored-attributes) +# strtoul is aliased to strtoull +CFLAGS-strtoul.c += -fno-builtin-strtoull $(config-cflags-wno-ignored-attributes) diff --git a/termios/Makefile b/termios/Makefile index 54ed9fe..1490dd1 100644 --- a/termios/Makefile +++ b/termios/Makefile @@ -31,3 +31,4 @@ routines := speed cfsetspeed tcsetattr tcgetattr tcgetpgrp tcsetpgrp \ include ../Rules CFLAGS-tcdrain.c += -fexceptions -fasynchronous-unwind-tables +CFLAGS-tcsetattr.c += $(config-cflags-wno-ignored-attributes) diff --git a/time/Makefile b/time/Makefile index 470275b..dc6e2c9 100644 --- a/time/Makefile +++ b/time/Makefile @@ -98,6 +98,7 @@ CFLAGS-tzset.c += $(tz-cflags) CFLAGS-getdate.c += -fexceptions CFLAGS-clock_nanosleep.c += -fexceptions -fasynchronous-unwind-tables CFLAGS-nanosleep.c += -fexceptions -fasynchronous-unwind-tables +CFLAGS-mktime.c += $(config-cflags-wno-ignored-attributes) # Don't warn about Y2k problem in strftime format string. CFLAGS-test_time.c += -Wno-format diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile index 4af102a..aaa067f 100644 --- a/wcsmbs/Makefile +++ b/wcsmbs/Makefile @@ -84,24 +84,32 @@ CFLAGS-wcwidth.c += -I../wctype CFLAGS-wcswidth.c += -I../wctype strtox-CFLAGS = -I../include -CFLAGS-wcstol.c += $(strtox-CFLAGS) -CFLAGS-wcstoul.c += $(strtox-CFLAGS) +CFLAGS-wcstol.c += $(strtox-CFLAGS) $(config-cflags-wno-ignored-attributes) +CFLAGS-wcstoul.c += $(strtox-CFLAGS) $(config-cflags-wno-ignored-attributes) CFLAGS-wcstoll.c += $(strtox-CFLAGS) CFLAGS-wcstoull.c += $(strtox-CFLAGS) -CFLAGS-wcstod.c += $(strtox-CFLAGS) -CFLAGS-wcstold.c += $(strtox-CFLAGS) +CFLAGS-wcstod.c += $(strtox-CFLAGS) $(config-cflags-wno-ignored-attributes) +CFLAGS-wcstold.c += $(strtox-CFLAGS) $(config-cflags-wno-ignored-attributes) CFLAGS-wcstof128.c += $(strtox-CFLAGS) -CFLAGS-wcstof.c += $(strtox-CFLAGS) +CFLAGS-wcstof.c += $(strtox-CFLAGS) $(config-cflags-wno-ignored-attributes) CFLAGS-wcstol_l.c += $(strtox-CFLAGS) CFLAGS-wcstoul_l.c += $(strtox-CFLAGS) CFLAGS-wcstoll_l.c += $(strtox-CFLAGS) CFLAGS-wcstoull_l.c += $(strtox-CFLAGS) -CFLAGS-wcstod_l.c += $(strtox-CFLAGS) -CFLAGS-wcstold_l.c += $(strtox-CFLAGS) +CFLAGS-wcstod_l.c += $(strtox-CFLAGS) $(config-cflags-wno-ignored-attributes) +CFLAGS-wcstold_l.c += $(strtox-CFLAGS) $(config-cflags-wno-ignored-attributes) CFLAGS-wcstof128_l.c += $(strtox-CFLAGS) -CFLAGS-wcstof_l.c += $(strtox-CFLAGS) +CFLAGS-wcstof_l.c += $(strtox-CFLAGS) $(config-cflags-wno-ignored-attributes) CPPFLAGS-tst-wchar-h.c += -D_FORTIFY_SOURCE=2 +CFLAGS-wcschr.c += $(config-cflags-wno-ignored-attributes) +CFLAGS-wmemchr.c += $(config-cflags-wno-ignored-attributes) +CFLAGS-wmemset.c += $(config-cflags-wno-ignored-attributes) +CFLAGS-mbrtowc.c += $(config-cflags-wno-ignored-attributes) +CFLAGS-wcrtomb.c += $(config-cflags-wno-ignored-attributes) +CFLAGS-wcstoll.c += $(config-cflags-wno-ignored-attributes) +CFLAGS-wcstoull.c += $(config-cflags-wno-ignored-attributes) + CFLAGS-isoc99_wscanf.c += -fexceptions CFLAGS-isoc99_fwscanf.c += -fexceptions CFLAGS-isoc99_vwscanf.c += -fexceptions diff --git a/wctype/Makefile b/wctype/Makefile index a354020..79d9608 100644 --- a/wctype/Makefile +++ b/wctype/Makefile @@ -29,3 +29,5 @@ routines := wcfuncs wctype iswctype wctrans towctrans \ tests := test_wctype test_wcfuncs bug-wctypeh include ../Rules + +CFLAGS-wcfuncs.c += $(config-cflags-wno-ignored-attributes)