From patchwork Fri Oct 28 17:35:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 59597 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BB1A5381E729 for ; Fri, 28 Oct 2022 17:37:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BB1A5381E729 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666978664; bh=1qw2BRUeSHcNY/+2DsKqTj3d2RdHrBIvisn0iSQ1jpQ=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=Lr/1pWzNLpTzI2mQWMTKvAIG27iWOtdzgYKPbILcutCWAgD7SwXNVsIL/W6BfZX/s HUrZrKI6hYnJKM93Y/WXjWjSNuM0VIhML/dcKO0guxrYCltszs1BYKoCPU8UiSiw+M uZaVzSWJDz9rK1yPDeWpCH+H03gQSiDyOi/B7cRA= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-oi1-x22e.google.com (mail-oi1-x22e.google.com [IPv6:2607:f8b0:4864:20::22e]) by sourceware.org (Postfix) with ESMTPS id 5BA613857BAF for ; Fri, 28 Oct 2022 17:35:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5BA613857BAF Received: by mail-oi1-x22e.google.com with SMTP id l5so6850448oif.7 for ; Fri, 28 Oct 2022 10:35:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1qw2BRUeSHcNY/+2DsKqTj3d2RdHrBIvisn0iSQ1jpQ=; b=S5pjpfNoQ1Mpnb0BP+ElkQfdWpwfGEPRrM74vSzLXR5qNjEb1cgEzS6TyBEalxykQY mkxgjvuq1yivS7EqylMl9XqggjhELrN8R7kJspZ0LBLzo0AjBHEcyAXCVeeQy56EaHB5 yZOn5QeUSd7k+6dQ8M02qY4P92Lg1zVNQPo5hBj5UwFPECopttSxwUwpre3LsbDiRHfN 6Q395QOkoyRZONP+x5LeRruZIaXS5kb+pUcsgSeb/1PO7BL+sV+6Y7hXaAonrnNlkQGy /RJ+nQS9PltJkDILzEBj36wUTaJbcnuutHoxcSpyUicyx9lQRYJNtvDiE96Ja5SE3cVa zzJw== X-Gm-Message-State: ACrzQf3zbeYLVesJ6EVieZ3I5dLhYmuMRbn3IpNM6RT4J+3Ltx255LUf gBVxsCanwxELQYs2JfJbAMrKFrqFgmCtUMFV X-Google-Smtp-Source: AMsMyM7gp7mwcFhhvZxKEUjapkF2ztxuSN0k+NOq9erWrxbIVIYSfCXjWoRuTu6qfhXjWP8HsbtERw== X-Received: by 2002:a05:6808:1599:b0:359:568c:740 with SMTP id t25-20020a056808159900b00359568c0740mr8593512oiw.180.1666978550594; Fri, 28 Oct 2022 10:35:50 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c0:17c8:6484:1100:1451:7f3f]) by smtp.gmail.com with ESMTPSA id v10-20020a056870b50a00b0012779ba00fesm2434998oap.2.2022.10.28.10.35.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Oct 2022 10:35:50 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 08/11] configure: Use -Wno-ignored-attributes if compiler warns about multiple aliases Date: Fri, 28 Oct 2022 14:35:29 -0300 Message-Id: <20221028173532.876027-9-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221028173532.876027-1-adhemerval.zanella@linaro.org> References: <20221028173532.876027-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" 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. Howerver, this is a common pattern for weak_alias, where multiple alias are set to same symbol. Reviewed-by: Fangrui Song --- 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 1f5916af3f..939c3e094f 100755 --- a/configure +++ b/configure @@ -6257,6 +6257,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 c207503c8a..98bd9c01f8 100644 --- a/configure.ac +++ b/configure.ac @@ -1403,6 +1403,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 when a double alias redirection is used, to warn +dnl the the original symbol will be used even when weak definition is overridden. +dnl This is a common pattern for weak_alias, where multiple alias are set 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)