From patchwork Sun Nov 9 21:53:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alejandro Colomar X-Patchwork-Id: 123842 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 4DFDF3858419 for ; Sun, 9 Nov 2025 22:00:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4DFDF3858419 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=CSHuJ69B X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from sea.source.kernel.org (sea.source.kernel.org [IPv6:2600:3c0a:e001:78e:0:1991:8:25]) by sourceware.org (Postfix) with ESMTPS id B6B6D385840D for ; Sun, 9 Nov 2025 21:53:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B6B6D385840D Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B6B6D385840D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2600:3c0a:e001:78e:0:1991:8:25 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1762725220; cv=none; b=kVzn98cZCmyGfX9QWrh26Pf7w3w4LWp0Ryua7X8H2HOv+PqJOjjgQRLgZtM6Ofzti1EnRZelH4alyqV4KRPMcPk43Y8/YEg+DxhHnNiyc4pn4MEeTp46vKayE69hTNU90eF7MoAaRUFtiHbVY378lA4NvV5GLmr7atZ6BPFlxkY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1762725220; c=relaxed/simple; bh=Xg2SA2wqE1gCjkZAOp8IM78NOYUw/Zhbmi3uz6KzZWU=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=wVQpjn026b+XPPBd3qTD/YZ9HVavI6f1jr7ZH5tKSkKjFmjY2b3+hzuiytEkaviJ7I66N41ClcIoPXZDWqV/qCIe/o7rMtXRNAP8zEQqKeCDQvoAtr6CGvDI/Y+gEAgVGqM7MpKwYzyLRtBhWdJGee9jxu3HiJC48byNlVvDWps= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B6B6D385840D Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 1C6E64369A for ; Sun, 9 Nov 2025 21:53:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5073EC116B1; Sun, 9 Nov 2025 21:53:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1762725220; bh=Xg2SA2wqE1gCjkZAOp8IM78NOYUw/Zhbmi3uz6KzZWU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CSHuJ69BQjcQksuhjm8mIJaYFUJ5LfYDRhIl4EkafBTc3tgBNZmSRssKHkyZYwxHd YsHyNZEASgCoxDWpZApqr1MvKGskXkV1ZovDz4xNFVITgVDOBhJ+bAWqDDLmkxomol 1XSKEcn7AtYQHN0+RpAZDABayT/PTEdMwVepKCD1nRpuS+rqp0pQnls7waVZ8HMCPL DIrC4XxZOekkEJ9Y06VmOoVkb2R08cQ6eubKiKWHoTg40JOYT5V0OhomHkt+Aff/89 VhDRW3kZ3LQh2cNemkLPR/DROkorDmclui50HgF4iopwxXrJW60oFzSN2669pszfFQ 9bNCkCs9s7QZA== Date: Sun, 9 Nov 2025 22:53:37 +0100 From: Alejandro Colomar To: libc-alpha@sourceware.org Cc: Alejandro Colomar Subject: [PATCH v1 20/35] Assume #pragma GCC diagnostic is supported by the compiler Message-ID: X-Mailer: git-send-email 2.51.0 References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-10.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org We already assume that GCC is at least GCC 5, and we also assume that Clang is at least Clang 4. Clang added support for this pragma in Clang 2.6: llvm.git 504af1177d9c (2009-04-19; "implement "#pragma GCC diagnostic".") $ git describe --contains 504af1177d9c llvmorg-2.6.0~8194 Also, Clang added support for -Wcast-qual in Clang 3.6: llvm.git d5178014938d (2014-11-21; "Implement -Wcast-qual, fixing #13772.") $ git describe --contains d5178014938d llvmorg-3.6.0-rc1~3098 Also, Clang added support for -Wvla in Clang 2.8: llvm.git 4b636a70d93d (2010-05-23; "Put the VLA-is-an-extension warning into its own warning group (-Wvla) so that it can be selectively enabled/disabled.") $ git describe --contains 4b636a70d93d llvmorg-2.8.0-rc0~6649 Signed-off-by: Alejandro Colomar --- bits/stdlib-bsearch.h | 4 ---- posix/regex.c | 2 +- posix/regex.h | 4 ---- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/bits/stdlib-bsearch.h b/bits/stdlib-bsearch.h index 5ca67857e5..aa3ea53b21 100644 --- a/bits/stdlib-bsearch.h +++ b/bits/stdlib-bsearch.h @@ -29,14 +29,10 @@ bsearch (const void *__key, const void *__base, size_t __nmemb, size_t __size, __comparison = (*__compar) (__key, __p); if (__comparison == 0) { -#if __GNUC_PREREQ(4, 6) # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wcast-qual" -#endif return (void *) __p; -#if __GNUC_PREREQ(4, 6) # pragma GCC diagnostic pop -#endif } if (__comparison > 0) { diff --git a/posix/regex.c b/posix/regex.c index f5f6552670..9655785953 100644 --- a/posix/regex.c +++ b/posix/regex.c @@ -24,8 +24,8 @@ # if __GNUC_PREREQ (4, 6) # pragma GCC diagnostic ignored "-Wsuggest-attribute=pure" -# pragma GCC diagnostic ignored "-Wvla" # endif +# pragma GCC diagnostic ignored "-Wvla" #endif /* Make sure no one compiles this code with a C++ compiler. */ diff --git a/posix/regex.h b/posix/regex.h index f33368562a..cd6596c0f7 100644 --- a/posix/regex.h +++ b/posix/regex.h @@ -531,10 +531,8 @@ typedef struct # endif #endif -#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wvla" -#endif #ifndef _Attr_access_ # ifdef __attr_access @@ -664,9 +662,7 @@ extern size_t regerror (int __errcode, const regex_t *__restrict __preg, extern void regfree (regex_t *__preg); -#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) # pragma GCC diagnostic pop -#endif #ifdef __cplusplus }