From patchwork Sun Dec 22 00:04:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 852899 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp2774486wrq; Sat, 21 Dec 2024 16:34:51 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWO3D+hOCgwSGgqFSSIEWDUFvSJnaZ+hu+KG3T1Wbmh1Ddb4ySUF5zLccYGcqEw77hgMm8+MQ==@linaro.org X-Google-Smtp-Source: AGHT+IFLRnwJzMJNPVqo5s9ptrC3iLj82B7w3K0ap73RlSfWyPTaWNZn3RblznSNjPk1RevPqo9V X-Received: by 2002:a05:620a:2449:b0:7b6:e8d4:9b7d with SMTP id af79cd13be357-7b9ba7a3630mr1589750085a.30.1734827690919; Sat, 21 Dec 2024 16:34:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1734827690; cv=pass; d=google.com; s=arc-20240605; b=TVvHzqZlbGN/LLYVh4o1uDJQ5CjI9URdxh3ybpTJtmJrVzuwgISI0lydH954xxcCTB CI5ZIDL0NcxRzBpkzmL/6anl0sPona71LWqCjoBTiWhf8hQGwz09PldimfetR/tSrBNL yWin0qWGveA6nBTOwwxymo/abE3XsEhc8zimJrjrinaT+BgnlX5h9bO0i0o6IEHTILtz 4t2dSTkulE/gVFvgQCVMea4X1w1clqykNHXZmIgPKdx5VuWPlfrKLBiUTpBZrs7ywXdO UGJFFdChvwjdenCzVpptZqDK+820jf3R0EpseBu+HP2FTjVl3l0MeXu4TUxJMsHIoeh8 +KDw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:dkim-filter:arc-filter:dmarc-filter :delivered-to:dkim-filter; bh=x81pIe9TPEVQHB7z1ABuhVi1V7eFPEH0BsguEnIbkUE=; fh=uKlFkH9AUukvL1xmvBA9M7Oe4ntiJIR8HCR4+3TPd4w=; b=LrB3xzIciDhtr4w4dW9nYxQwS77Z9qPi1SHccgfMzSDsJ5C1gTUT6JS2M8aomUjQId n1TdExPb6SqndSLu7+jvRleTx7H6ieVMjNyIZqPG/7LZeT6gVSWDGpJCsnz425U17H+F gYn0c5QyxpNTCiKusJOYHGvYPKlMztDe0rQgxCOrRBlZo8fbgwed+RKVjfCsQMsW+wkA LQU1mtKBXiI2cqWseqyoXoMjNBR+oOUjKc8bTABoQXgAP3GDsrAYyr+KGpLWPld6oWLg IOLhl3O81LZppBnjJoxq1TwWMBmcTcHCkaXXADFPvLIiqP1kf+rQtmmfjf9+LxpT5GCP eYjA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=CMI5rYQL; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="libc-alpha-bounces~patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id af79cd13be357-7b9ac54ebfdsi763928485a.678.2024.12.21.16.34.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Dec 2024 16:34:50 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=CMI5rYQL; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="libc-alpha-bounces~patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 964EA3858424 for ; Sun, 22 Dec 2024 00:34:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 964EA3858424 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=CMI5rYQL X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by sourceware.org (Postfix) with ESMTPS id 93C593858027 for ; Sun, 22 Dec 2024 00:05:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 93C593858027 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 93C593858027 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::635 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734825931; cv=none; b=ZnJYpz+ILE6hW/lg6MSROjLmddWpQUnPrV6JlXWKS4zLRuhTv5/tvlkDitP5QLtGbsz88jxlYR7HFeoAGpr18Ez05ZKRlcRKCk8mTdSeQvQUL4kLD04v8j/uzDcCiCZPOmZTLxAwOJdxcOJWLk6ujRj7bnMkMZYTng6/yNFvIpo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734825931; c=relaxed/simple; bh=KdBIDXTbq9bsn67eRK0ZcNO00AjaH+Jmar1tjPvyy9E=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Y0s21cMVkTxcC/0r7ZdsIokiiZwcyLQU+ttbWbOMnICY5uyRIUEPVpVgqcdcx3yz/sbJZoBeG7paLSyI1udIEtAjFjTSsZScu22YylZEDfK/+6mHzAS9OrLm1dr6pPK7B1/kZgDfNyUY34C7J207ujWfbx46TS6dKrAdj6guDR4= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 93C593858027 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-216426b0865so28124975ad.0 for ; Sat, 21 Dec 2024 16:05:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734825925; x=1735430725; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=x81pIe9TPEVQHB7z1ABuhVi1V7eFPEH0BsguEnIbkUE=; b=CMI5rYQL8s7CEmG7CJ96i/Ab1G3Osu4h9IvLeDHyYNIs5pA59n/S1VFHqcPzjBHmw0 HnCmMVjFmAt68F7S9JuYZrJUcAgoHM81LtS3OMNo7e1bFtqatgvXBF5bmALeq/J2ygID XS02lGBSQqfizin1/ojxcNdVcQGHK9ctSVSSzJkSzWsRzWGpGbj6Q+CLxBJYoHBSbdtH icKNWl3rCWyY/ge4kq4Kmu3ee6wYxm3xp+iZwES2A4kE1iu2wEsi2VBHE4/gumw+Kkrn LdQWHHpLHN73mrbO7eaKGMnd54ns3k4OTnNJ5joxriw9zvLhb3vtNrftRIqaAAlgKK/+ VboQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734825925; x=1735430725; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=x81pIe9TPEVQHB7z1ABuhVi1V7eFPEH0BsguEnIbkUE=; b=WGkT3nqQVWAAGcIFxPrpsyRhQ2jgoJg5DdLZDZzQ3XKz0kgxXDbwqsTLxKwQS/0QQf NqL2+sXL3RsbzkCrYz/oFH4n0h5bjW3aQ1A3KG9ZR92Z9IFagKAWGLnKmp3DBrqFbZqG aUdLmD/azKUPOgAslU/fiXXSdtHNKKv27Ki3ZNK7GcvGBpYKnB9sD2XLlBUvysjqLsvD Jo36nHO4qyaTytgL0jOob/6iB/mbtRFnq7pTnio1EfX5j56BbMv54OmEpw6wbFaIWPFJ jZb2cIU3NCJqmcuKZCtEafjiutMBNdZqMJI7gbNdPkHqG4rZdxgS+1abwCpGh6U7SBP3 HzLw== X-Gm-Message-State: AOJu0YzLSnuBEV70ZlcLsK/l+q7LxsfuvGMuWYctvLHTUhvR0kyqj6BF GjBKIFeqkW8Fy/SlAnf/78QBT1osPRs5VqUsmVLEYw7uzhJPjvuD X-Gm-Gg: ASbGncvpmouHml0c+/WzVttfydDMKy8CUwda4VdS5uNiMTTiZcDvYep3gSPzIqZ5ybf WmQ21NrLyfZjOaCFMzI+JIpePzpXwga9xuB0H6lzAATqYpapHGq88oHLyQS1rgAs/b8noAX62Yt jTpK37DuoyYUkjmy3p2HCNQAPeeXxXRy68hptdV3vXjZRhjwsKUJHjMrshBcSnChAqBTtcgXT8j kmMfoAIsH18ssfB897ngtNwnlpWdtyylux4HjJbNCTcnocurRl7Gj1hmND+AX561SzqH1E= X-Received: by 2002:a17:902:d48c:b0:216:5b8b:232c with SMTP id d9443c01a7336-219e6f284efmr101924465ad.54.1734825925325; Sat, 21 Dec 2024 16:05:25 -0800 (PST) Received: from gnu-tgl-3.localdomain ([120.204.185.181]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dca0256dsm49059125ad.258.2024.12.21.16.05.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Dec 2024 16:05:24 -0800 (PST) Received: from gnu-tgl-3.lan (localhost [IPv6:::1]) by gnu-tgl-3.localdomain (Postfix) with ESMTP id 58F22C0B44; Sun, 22 Dec 2024 08:05:15 +0800 (CST) From: "H.J. Lu" To: libc-alpha@sourceware.org Cc: sam@gentoo.org, Adhemerval Zanella Subject: [PATCH 27/39] Check if TEST_CC supports -Wno-restrict before using it Date: Sun, 22 Dec 2024 08:04:50 +0800 Message-ID: <20241222000509.2205895-28-hjl.tools@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241222000509.2205895-1-hjl.tools@gmail.com> References: <20241222000509.2205895-1-hjl.tools@gmail.com> MIME-Version: 1.0 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patch=linaro.org@sourceware.org From: Adhemerval Zanella Check if TEST_CC supports -Wno-restrict before using it to avoid Clang error: error: unknown warning option '-Wno-restrict' [-Werror,-Wunknown-warning-option] Co-Authored-By: H.J. Lu Reviewed-by: Sam James --- configure | 34 ++++++++++++++++++++++++++++++++++ configure.ac | 10 ++++++++++ libio/Makefile | 6 ++++-- 3 files changed, 48 insertions(+), 2 deletions(-) diff --git a/configure b/configure index f5e8096099..04b21f0308 100755 --- a/configure +++ b/configure @@ -7968,6 +7968,40 @@ have-test-cc-trampoline = $libc_cv_test_cc_trampolines" +saved_CC="$CC" +CC="$TEST_CC" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking -Wno-restrict in testing" >&5 +printf %s "checking -Wno-restrict in testing... " >&6; } +if test ${libc_cv_test_cflags_wno_restrict+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if { ac_try='${CC-cc} -c -Werror -finput-charset=ascii -xc /dev/null -S -o /dev/null' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } +then : + libc_cv_test_cflags_wno_restrict=-Wno-restrict +else case e in #( + e) libc_cv_test_cflags_wno_restrict= + ;; +esac +fi ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_test_cflags_wno_restrict" >&5 +printf "%s\n" "$libc_cv_test_cflags_wno_restrict" >&6; } + +CC="$saved_CC" + + +config_vars="$config_vars +test-config-cflags-wno-restrict = $libc_cv_test_cflags_wno_restrict" + + + saved_CC="$CC" CC="$TEST_CC" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking -finput-charset=ascii in testing" >&5 diff --git a/configure.ac b/configure.ac index e331557350..a5445f0b05 100644 --- a/configure.ac +++ b/configure.ac @@ -1580,6 +1580,16 @@ LIBC_TRY_TEST_CC_COMMAND([support for trampolines], LIBC_CONFIG_VAR([have-test-cc-trampoline], [$libc_cv_test_cc_trampolines]) +dnl Check if TEST_CC supports -Wno-restrict. +LIBC_TRY_TEST_CC_OPTION([-Wno-restrict], + [-c -Werror -finput-charset=ascii], + libc_cv_test_cflags_wno_restrict, + [libc_cv_test_cflags_wno_restrict=-Wno-restrict], + [libc_cv_test_cflags_wno_restrict=] +) +LIBC_CONFIG_VAR([test-config-cflags-wno-restrict], + [$libc_cv_test_cflags_wno_restrict]) + dnl Check if TEST_CC supports -finput-charset=ascii. LIBC_TRY_TEST_CC_OPTION([-finput-charset=ascii], [-c -Werror -finput-charset=ascii], diff --git a/libio/Makefile b/libio/Makefile index 4370152964..a879e8c2ba 100644 --- a/libio/Makefile +++ b/libio/Makefile @@ -250,8 +250,10 @@ CFLAGS-tst-bz24153.c += $(no-fortify-source) CFLAGS-tst_putwc.c += -DOBJPFX=\"$(objpfx)\" # These test cases intentionally use overlapping arguments -CFLAGS-tst-sprintf-ub.c += -Wno-restrict $(no-fortify-source) -CFLAGS-tst-sprintf-chk-ub.c += -Wno-restrict $(no-fortify-source) +CFLAGS-tst-sprintf-ub.c += $(test-config-cflags-wno-restrict) \ + $(no-fortify-source) +CFLAGS-tst-sprintf-chk-ub.c += $(test-config-cflags-wno-restrict) \ + $(no-fortify-source) LDFLAGS-tst-bz24228 = -Wl,--version-script=tst-bz24228.map