From patchwork Mon Jul 11 09:27:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 55914 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 3913C3854149 for ; Mon, 11 Jul 2022 09:27:37 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa2.mentor.iphmx.com (esa2.mentor.iphmx.com [68.232.141.98]) by sourceware.org (Postfix) with ESMTPS id D88CB3858412 for ; Mon, 11 Jul 2022 09:27:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D88CB3858412 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.92,262,1650960000"; d="scan'208,223";a="78628132" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa2.mentor.iphmx.com with ESMTP; 11 Jul 2022 01:27:18 -0800 IronPort-SDR: GRbxzJGrCZ1r1z7m2xoAx6YNm98JOMajaHCdBpJEuE/TywP+CHNvIaGtdK/v3sAZ2olYgu4FeR pPTJI5qQJ+wIDcRddBmBJ+5Ln/AL3mV+fwQYLU5Qt34F4cY206UpsVveSnaXbuP14XHrkPrpH+ TVh4lilBxKtmIntCnre5i0hZsaWT5fpJXByrG530WaDcJ2W+aHd+c0G0ixSVUoI8Bgdm0fzyzv aFXtyMilFmLAi2DjyR0uRVQxLHZUakufB5HX7EhVdbenwlLQaFZuo3C4jJbjYwkjI1aR3todTW 35o= From: Thomas Schwinge To: Lewis Hyatt , Subject: Enhance '_Pragma' diagnostics verification in OMP C/C++ test cases (was: [PATCH] c: Fix location for _Pragma tokens [PR97498]) In-Reply-To: References: <20220709205230.GA4991@ldh-imac.local> <377c7016-633c-f354-8c21-599ff2b56449@gmail.com> User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/27.1 (x86_64-pc-linux-gnu) Date: Mon, 11 Jul 2022 11:27:12 +0200 Message-ID: <87edys3spb.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-14.mgc.mentorg.com (139.181.222.14) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 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 Sender: "Gcc-patches" Hi! On 2022-07-10T16:51:11-0400, Lewis Hyatt via Gcc-patches wrote: > On Sat, Jul 9, 2022 at 11:59 PM Jeff Law via Gcc-patches > wrote: >> On 7/9/2022 2:52 PM, Lewis Hyatt via Gcc-patches wrote: >> > PR97498 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97498) is another PR >> > related to the fact that imprecise locations for _Pragma result in >> > counterintuitive behavior for GCC diagnostic pragmas >> > I think the main source of problems for all remaining issues is that we use >> > the global input_location for deciding when/if a diagnostic should apply. I >> > think it should be eventually doable to eliminate this, and rather properly >> > resolve the token locations to the place they need to be >> I've long wanted to see our dependency on input_location be diminished >> with the goal of making it go away completely. > [...] > Then I will plan to work on > eliminating input_location from c-pragma.cc as a longer term goal. Great; I too am looking forward to that. There, and then elsewhere, everywhere. :-) >> > The rest of [patch] is just tweaking a couple tests which were sensitive to the >> > location being output. In all these cases, the new locations seem more >> > informative to me than the old ones. ACK, thanks. On top of that, I've just pushed to master branch commit 06b2a2abe26554c6f9365676683d67368cbba206 "Enhance '_Pragma' diagnostics verification in OMP C/C++ test cases", see attached. Grüße Thomas ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955 From 06b2a2abe26554c6f9365676683d67368cbba206 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Mon, 11 Jul 2022 09:33:19 +0200 Subject: [PATCH] Enhance '_Pragma' diagnostics verification in OMP C/C++ test cases Follow-up to recent commit 0587cef3d7962a8b0f44779589ba2920dd3d71e5 "c: Fix location for _Pragma tokens [PR97498]". gcc/testsuite/ * c-c++-common/gomp/pragma-3.c: Enhance '_Pragma' diagnostics verification. * c-c++-common/gomp/pragma-5.c: Likewise. libgomp/ * testsuite/libgomp.oacc-c-c++-common/reduction-5.c: Enhance '_Pragma' diagnostics verification. --- gcc/testsuite/c-c++-common/gomp/pragma-3.c | 8 +++++--- gcc/testsuite/c-c++-common/gomp/pragma-5.c | 8 +++++--- libgomp/testsuite/libgomp.oacc-c-c++-common/reduction-5.c | 8 +++++--- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/gcc/testsuite/c-c++-common/gomp/pragma-3.c b/gcc/testsuite/c-c++-common/gomp/pragma-3.c index ae18e9b8886..3e1b2111c3d 100644 --- a/gcc/testsuite/c-c++-common/gomp/pragma-3.c +++ b/gcc/testsuite/c-c++-common/gomp/pragma-3.c @@ -2,13 +2,15 @@ /* PR preprocessor/103165 */ #define inner(...) #__VA_ARGS__ ; _Pragma("omp error severity(warning) message (\"Test\") at(compilation)") /* { dg-line inner_location } */ -#define outer(...) inner(__VA_ARGS__) +#define outer(...) inner(__VA_ARGS__) /* { dg-line outer_location } */ void f (void) { - const char *str = outer(inner(1,2)); - /* { dg-warning "'pragma omp error' encountered: Test" "inner expansion" { target *-*-* } inner_location } */ + const char *str = outer(inner(1,2)); /* { dg-line str_location } */ + /* { dg-warning "35:'pragma omp error' encountered: Test" "" { target *-*-* } inner_location } + { dg-note "20:in expansion of macro 'inner'" "" { target *-*-* } outer_location } + { dg-note "21:in expansion of macro 'outer'" "" { target *-*-* } str_location } */ } #if 0 diff --git a/gcc/testsuite/c-c++-common/gomp/pragma-5.c b/gcc/testsuite/c-c++-common/gomp/pragma-5.c index 8124f701502..173c25e803a 100644 --- a/gcc/testsuite/c-c++-common/gomp/pragma-5.c +++ b/gcc/testsuite/c-c++-common/gomp/pragma-5.c @@ -2,13 +2,15 @@ /* PR preprocessor/103165 */ #define inner(...) #__VA_ARGS__ ; _Pragma ( " omp error severity (warning) message (\"Test\") at(compilation)" ) /* { dg-line inner_location } */ -#define outer(...) inner(__VA_ARGS__) +#define outer(...) inner(__VA_ARGS__) /* { dg-line outer_location } */ void f (void) { - const char *str = outer(inner(1,2)); - /* { dg-warning "'pragma omp error' encountered: Test" "inner expansion" { target *-*-* } inner_location } */ + const char *str = outer(inner(1,2)); /* { dg-line str_location } */ + /* { dg-warning "35:'pragma omp error' encountered: Test" "" { target *-*-* } inner_location } + { dg-note "20:in expansion of macro 'inner'" "" { target *-*-* } outer_location } + { dg-note "21:in expansion of macro 'outer'" "" { target *-*-* } str_location } */ } #if 0 diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/reduction-5.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/reduction-5.c index 16aa0dd4ac1..72094609f0f 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/reduction-5.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/reduction-5.c @@ -17,7 +17,7 @@ const int n = 100; #define check_reduction(gwv_par, gwv_loop) \ { \ s1 = 2; s2 = 5; \ -DO_PRAGMA (acc parallel gwv_par copy (s1, s2)) \ +DO_PRAGMA (acc parallel gwv_par copy (s1, s2)) /* { dg-line DO_PRAGMA_loc } */ \ DO_PRAGMA (acc loop gwv_loop reduction (+:s1, s2)) \ for (i = 0; i < n; i++) \ { \ @@ -45,8 +45,10 @@ main (void) /* Nvptx targets require a vector_length or 32 in to allow spinlocks with gangs. */ - check_reduction (num_workers (nw) vector_length (vl), worker); - /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "test1" { target *-*-* } pragma_loc } */ + check_reduction (num_workers (nw) vector_length (vl), worker); /* { dg-line check_reduction_loc } + /* { dg-warning "22:region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } pragma_loc } + { dg-note "1:in expansion of macro 'DO_PRAGMA'" "" { target *-*-* } DO_PRAGMA_loc } + { dg-note "3:in expansion of macro 'check_reduction'" "" { target *-*-* } check_reduction_loc } */ check_reduction (vector_length (vl), vector); check_reduction (num_gangs (ng) num_workers (nw) vector_length (vl), gang worker vector); -- 2.35.1