From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 11128385769A; Tue, 1 Nov 2022 13:08:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 11128385769A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667308135; bh=Oph/PZNzgsDoeIzokja7LKdHPHaeqb1jTYiQi1puhew=; h=From:To:Subject:Date:From; b=qNvWJp/LgToyi5/4jyC1EmXodEMxEjxTdjPy2JRHUokoXM/1JFdiWMAQz/6EDBqlu r5lQuL0whh1oHDt1gq9N3agqhLNbjUULleeALTUuRdGZFb6zt5K2xq0OX5LH34YNAc qbhqphpwzNYClSB3FgMX32m/J10tg3ClMJNpsOrw= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Adhemerval Zanella To: glibc-cvs@sourceware.org Subject: [glibc] configure: Use -Wno-ignored-attributes if compiler warns about multiple aliases X-Act-Checkin: glibc X-Git-Author: Adhemerval Zanella X-Git-Refname: refs/heads/master X-Git-Oldrev: 5c5a8b99cf96b71940e36a9db66d3a61bc315016 X-Git-Newrev: 8d98c7c00f3f06545de9e5ce5cf778d2ab2450a4 Message-Id: <20221101130855.11128385769A@sourceware.org> Date: Tue, 1 Nov 2022 13:08:55 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=8d98c7c00f3f06545de9e5ce5cf778d2ab2450a4 commit 8d98c7c00f3f06545de9e5ce5cf778d2ab2450a4 Author: Adhemerval Zanella Date: Fri Mar 11 10:40:44 2022 -0300 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: --- argp/Makefile | 7 ++++--- configure | 29 +++++++++++++++++++++++++++++ configure.ac | 22 ++++++++++++++++++++++ dirent/Makefile | 1 + inet/Makefile | 3 +++ io/Makefile | 18 ++++++++++-------- libio/Makefile | 14 +++++++++++--- login/Makefile | 1 + misc/Makefile | 2 ++ posix/Makefile | 6 +++--- resolv/Makefile | 1 + resource/Makefile | 3 +++ socket/Makefile | 10 +++++----- stdio-common/Makefile | 2 ++ stdlib/Makefile | 12 ++++++++++++ string/Makefile | 9 +++++++++ sysdeps/aarch64/Makefile | 1 + sysdeps/arm/Makefile | 4 ++++ sysdeps/wordsize-64/Makefile | 5 +++++ termios/Makefile | 1 + time/Makefile | 1 + wcsmbs/Makefile | 24 ++++++++++++++++-------- wctype/Makefile | 2 ++ 23 files changed, 148 insertions(+), 30 deletions(-) diff --git a/argp/Makefile b/argp/Makefile index 586136f2fe..8de8fd6113 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 adf263d06d..fc3d7842de 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 c5c4b383a3..9fc1fb1c1c 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 17fb1c5b72..6a9559e5f5 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 da4226c8c8..d5cea717a9 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 2fa934751f..db7764f664 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 54ed9fe51e..1490dd17b2 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 470275b90c..dc6e2c93ad 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 4af102a3f6..aaa067fc69 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 a3540203cc..79d9608cb9 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)