From patchwork Tue Sep 16 15:34:55 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Palka X-Patchwork-Id: 120366 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 55A603857400 for ; Tue, 16 Sep 2025 15:37:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 55A603857400 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=RR22X3qi X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id C30E2385743A for ; Tue, 16 Sep 2025 15:35:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C30E2385743A Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C30E2385743A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1758036905; cv=none; b=Ziw7m0ZCfviXlfpYnILRG6qzTOpP8WI8rlT1pNea9irCTL6ycWtbShKI5IDnix8oRZAuUIgzGWCyGv2fzVmN8tKVhbgdsdF/IepnhsjLX119cCgObUnm2yTpg9GKX3ppGLDUG1rz0eBA749YAfSPXMZKTREeo/PDO3lb3h9sgME= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1758036905; c=relaxed/simple; bh=Nf8FjbB60YbRdkMhmWoiVfcLms3j9q3GahiV+O/OQdE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=l8HYdDjQATGbFwQCSVSbS5V3qaJgmHqWPpfripjJ9Q1zIRaEQMjjLZ5zqYrQgEoWeIpPmd0A08LkzsSMHkIbxjiqfV78fIqKgbOD0kr/u4y5B1owBGKWx2DJYjoq/S0NrQjmZV9IzAeVVQ/0D+8YucvtEd+qIw0qNuGDb91tCBc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C30E2385743A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1758036905; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tQw+GRsm5jRvveyXyTvil2MKkFnphysXJnJfd76GBuw=; b=RR22X3qiyPpzObeOBcKx3Q0uBhaasUMMlsPG6tC1XQXWBRjMIpWLml6tSS67HTFYUObf8P y1T38qEgNZ6q3GScIBA5nKk/ZR0RQlE7CTdfhjXTggNzVQ+Ci/bhCaA0m7obmHaH3xZwSD uhw7cUZjnL5ltVfd7oScfjdeFfLPGJk= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-176-uoDPJAlYMm2C7MooDgJKPA-1; Tue, 16 Sep 2025 11:35:03 -0400 X-MC-Unique: uoDPJAlYMm2C7MooDgJKPA-1 X-Mimecast-MFC-AGG-ID: uoDPJAlYMm2C7MooDgJKPA_1758036903 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-82b15c1dca8so44829485a.1 for ; Tue, 16 Sep 2025 08:35:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758036903; x=1758641703; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=tQw+GRsm5jRvveyXyTvil2MKkFnphysXJnJfd76GBuw=; b=GvODUiTOk6BWvK+echdPDrOQ/VLepMHZH4nWOpA5dlnOeozlQaaBs6ouJ3RKTIX/9y ZIYEexCUJRwW4ScMQO/joGdiP8SLYoz0bR4EthqK6UwpWIoLrwcmo/CvljYT1UX19dzO 0Y+XRrG6T5TFUJYQbZdWieRckk/AW+dxx3nBOy4JM6nVfa+twgvrvkYOfZX62/hgyIzP X6ZLRQYpUrrtdAdT8YtX0i014r0zQ6RXF2fhdkpjEmYRvkNCYdogW+t6iyhYryt8+kyn PKbRE/yH8Hn0uNamFBaakZjzhHt/H5Fgf9yI9gzmq3t4NECCVvtYCO2295j0ZVDIbb3u ntcQ== X-Gm-Message-State: AOJu0YxMeWx8gML9kLhtB76WJo4SDIuw82KIOXsWqrMpWuc1LjkSi+HO /DHexDHUrv4+KksUiCguFz1qOnmqWkw6t89N1FOMpKK5/Q0X3QyfKqb2kIY+qCs3Jo0NkvcVjbz J8xkG03A2R/r93lx5B42TSw6WEP9ZHq2TOPUSJdIHbd1I4PIV1CUvexwJrTaaI3dBEGHOWXiIho irqgXcVtAL9R+PBvKlGZhLEALd0+S/a55e3Jb5QWDh X-Gm-Gg: ASbGncuDPBDAk1duGcFZMCg6AM9nluFdH/RWJKDb9k8cvxfuoieVIIfiM99QEK7Yg/7 Z95ywd8uLwEM/UOPPVhuaAlu+7j3wf51HsLYeoivNnAbwr/D9LCxhFwHXbY19zQAisulrXNlLUq Gv/sZ0cseaK8jkP1y7zArtE4UHI9hAWy6P660JzTKGYoZeS7qqiH49koEMn6hMy/Tc/AiUu8LDB gOlco//06cSdu8FrWG/gK2R5/txZU3dkh3FYv3uh/zxyM5BBJbIsFnuz/p6o0wTbU+Bp7/OSXwo uJw4vtSqfUJiYPJ7leQERjVSuBuBlw== X-Received: by 2002:a05:620a:1919:b0:810:a76e:ffa0 with SMTP id af79cd13be357-823f6df50f9mr1353974685a.0.1758036902515; Tue, 16 Sep 2025 08:35:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFtx5fowuVWgvkbSxgKSlklf2tAmFVjZrM/CgbloavcCuj1alTz4m8FudIope3PeJnOsSVqwA== X-Received: by 2002:a05:620a:1919:b0:810:a76e:ffa0 with SMTP id af79cd13be357-823f6df50f9mr1353970385a.0.1758036901713; Tue, 16 Sep 2025 08:35:01 -0700 (PDT) Received: from idea ([2600:4040:aa68:6000:9e8e:99ff:fed1:71f]) by smtp.gmail.com with ESMTPSA id af79cd13be357-82815672b30sm582361685a.9.2025.09.16.08.35.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Sep 2025 08:35:01 -0700 (PDT) From: Patrick Palka To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, Patrick Palka Subject: [PATCH] libstdc++: Explicitly pass -Wsystem-headers to tests that need it Date: Tue, 16 Sep 2025 11:34:55 -0400 Message-ID: <20250916153455.239844-1-ppalka@redhat.com> X-Mailer: git-send-email 2.51.0.268.ga483264b01 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 8Ib5GhAwKqzaF8cy2ObzjZ9K5o4J4KrXaKG8IcXZ_Sg_1758036903 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-13.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_PASS, SPF_NONE, TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org Tested on x86_64-pc-linux-gnu, does thsi look OK for trunk and perhaps 15/14? -- >8 -- When running libstdc++ tests using an installed gcc (as opposed to an in-tree gcc), warnings from within system headers are suppressed, so tests that check for such warnings need to pass -Wsystem-headers explicitly in order for them not to spuriously FAIL. libstdc++-v3/ChangeLog: * testsuite/20_util/bind/dangling_ref.cc: Compile with -Wsystem-headers. * testsuite/20_util/ratio/operations/ops_overflow_neg.cc: Likewise. * testsuite/20_util/unique_ptr/lwg4148.cc: Likewise. * testsuite/29_atomics/atomic/operators/pointer_partial_void.cc: Likewise. * testsuite/30_threads/packaged_task/cons/dangling_ref.cc: Likewise. --- libstdc++-v3/testsuite/20_util/bind/dangling_ref.cc | 1 + .../testsuite/20_util/ratio/operations/ops_overflow_neg.cc | 1 + libstdc++-v3/testsuite/20_util/unique_ptr/lwg4148.cc | 1 + .../29_atomics/atomic/operators/pointer_partial_void.cc | 1 + .../testsuite/30_threads/packaged_task/cons/dangling_ref.cc | 1 + 5 files changed, 5 insertions(+) diff --git a/libstdc++-v3/testsuite/20_util/bind/dangling_ref.cc b/libstdc++-v3/testsuite/20_util/bind/dangling_ref.cc index 17e7b21c45cb..32af0a27b8fe 100644 --- a/libstdc++-v3/testsuite/20_util/bind/dangling_ref.cc +++ b/libstdc++-v3/testsuite/20_util/bind/dangling_ref.cc @@ -1,4 +1,5 @@ // { dg-do compile { target c++11 } } +// { dg-additional-options "-Wsystem-headers" } #include int f(); diff --git a/libstdc++-v3/testsuite/20_util/ratio/operations/ops_overflow_neg.cc b/libstdc++-v3/testsuite/20_util/ratio/operations/ops_overflow_neg.cc index 5eff8e31f82a..cdc46f4a7ea2 100644 --- a/libstdc++-v3/testsuite/20_util/ratio/operations/ops_overflow_neg.cc +++ b/libstdc++-v3/testsuite/20_util/ratio/operations/ops_overflow_neg.cc @@ -1,5 +1,6 @@ // { dg-do compile { target c++11 } } // { dg-require-cstdint "" } +// { dg-additional-options "-Wsystem-headers" } // 2008-07-03 Chris Fairles diff --git a/libstdc++-v3/testsuite/20_util/unique_ptr/lwg4148.cc b/libstdc++-v3/testsuite/20_util/unique_ptr/lwg4148.cc index c70d7a60631b..f5697e4e4021 100644 --- a/libstdc++-v3/testsuite/20_util/unique_ptr/lwg4148.cc +++ b/libstdc++-v3/testsuite/20_util/unique_ptr/lwg4148.cc @@ -1,4 +1,5 @@ // { dg-do compile { target c++11 } } +// { dg-additional-options "-Wsystem-headers" } // LWG 4148. unique_ptr::operator* should not allow dangling references diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/operators/pointer_partial_void.cc b/libstdc++-v3/testsuite/29_atomics/atomic/operators/pointer_partial_void.cc index e959418a1c3c..1e2f71e9c628 100644 --- a/libstdc++-v3/testsuite/29_atomics/atomic/operators/pointer_partial_void.cc +++ b/libstdc++-v3/testsuite/29_atomics/atomic/operators/pointer_partial_void.cc @@ -1,6 +1,7 @@ // { dg-do run { target { c++11_only || c++14_only } } } // { dg-require-atomic-builtins "" } // { dg-require-effective-target hosted } +// { dg-additional-options "-Wsystem-headers" } // Copyright (C) 2012-2025 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/30_threads/packaged_task/cons/dangling_ref.cc b/libstdc++-v3/testsuite/30_threads/packaged_task/cons/dangling_ref.cc index 8cc3f78da9f0..30e05b0391a1 100644 --- a/libstdc++-v3/testsuite/30_threads/packaged_task/cons/dangling_ref.cc +++ b/libstdc++-v3/testsuite/30_threads/packaged_task/cons/dangling_ref.cc @@ -1,4 +1,5 @@ // { dg-do compile { target c++11 } } +// { dg-additional-options "-Wsystem-headers" } #include // C++20 [futures.task.members]