From patchwork Fri Oct 30 11:22:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 1390954 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CN0KY065cz9sTq for ; Fri, 30 Oct 2020 22:22:54 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EE0513851C31; Fri, 30 Oct 2020 11:22:51 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com [68.232.137.252]) by sourceware.org (Postfix) with ESMTPS id BCC993857020 for ; Fri, 30 Oct 2020 11:22:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org BCC993857020 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Thomas_Schwinge@mentor.com IronPort-SDR: AXs07JD+ojuyZU9MT1D1O8AQOkFJCMjJl9KQkpWCz8bLj2xKSrrYxiZkS50XmvC7JwVwGRhrDf ckORjjMIPQSc7/Ygwu49Ues82vpC0Co6RZbcRVkb6tgffRoHR/9a2EjrAJ3EIRKxQmN098WuHD EOmJrdFk4AH/EJ4iuFHzyo+pme5lGjP4seyq5N7XpBf6Q99mQ6jesafrD0fsPR/oT2SAt7ihDj wBJaWPaw7Lcem3yPTQIhQHKxK1OPfpNkpgsg4JEEhXFUb4yEjziA6DxmL2/d4/2hE7yjOtaPF2 yF0= X-IronPort-AV: E=Sophos;i="5.77,433,1596528000"; d="scan'208,223";a="54643329" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa4.mentor.iphmx.com with ESMTP; 30 Oct 2020 03:22:48 -0800 IronPort-SDR: +1m2lKIWvbi4q5vUKPdbKt3UHVpv2IvzfIiMm1c4+zIXibILOJl8bRW0sXFIVOPBhv2rDVvU8k AB/BIuuS3CuOANJARdEAXkLzksH6YacY0Ctp8aCljgT8wmndY8WwlHgxlhBiYIgrRJiJgNeuXB WTJKCTJR+KWf2Gyf7k8xEZjXnAn/oP2L0YpAkadW2n3oAwCmsn7daPQcnDDfpBvebnVP7lP6+g 8tP/0bGW0BS5SVb53gNtJqUzsR/hoPmnnlHw+fh9CKeHKh8pUX/WgOwVVSCJSCOfzYYw9qkat2 z2I= From: Thomas Schwinge To: , Jakub Jelinek Subject: libgomp testsuite: tell warning from error diagnostics, etc. [PR80219, PR85303] User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/26.3 (x86_64-pc-linux-gnu) Date: Fri, 30 Oct 2020 12:22:31 +0100 Message-ID: <87blgkgdqg.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: SVR-IES-MBX-03.mgc.mentorg.com (139.181.222.3) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_SHORT, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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@gcc.gnu.org Sender: "Gcc-patches" Hi! Turns out that GCC PR85303 "[testsuite, libgomp] dg-message not supported" is the very same problem as (the libgomp aspect of) GCC PR80219 "relative line numbers only working if gcc_{error,warning}_prefix defined" (see rationale in there). OK to push the attached patch for "libgomp testsuite: tell warning from error diagnostics, etc. [PR80219, PR85303]"? This changes makes 'dg-warning', 'dg-error', 'dg-bogus', 'dg-message' behave as expected, and also enables use of relative line numbers as well as 'dg-line'. (No testsuite regressions.) I (later) have a proper use for that, but with that fixed, you can then do standard things as follows: --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/parallel-dims.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/parallel-dims.c @@ -56,17 +56,17 @@ int main () /* GR, WS, VS. */ { -#define GANGS 0 /* { dg-warning "'num_gangs' value must be positive" "" { target c } } */ - int gangs_actual = GANGS; +#define GANGS 0 + int gangs_actual = GANGS; /* { dg-warning "'num_gangs' value must be positive" "" { target c } .-1 } */ int gangs_min, gangs_max, workers_min, workers_max, vectors_min, vectors_max; gangs_min = workers_min = vectors_min = INT_MAX; gangs_max = workers_max = vectors_max = INT_MIN; #pragma acc parallel copy (gangs_actual) \ reduction (min: gangs_min, workers_min, vectors_min) reduction (max: gangs_max, workers_max, vectors_max) \ - num_gangs (GANGS) /* { dg-warning "'num_gangs' value must be positive" "" { target c++ } } */ + num_gangs (GANGS) // { dg-line LiNE } { /* We're actually executing with num_gangs (1). */ - gangs_actual = 1; + gangs_actual = 1; /* { dg-warning "'num_gangs' value must be positive" "" { target c++ } LiNE } */ for (int i = 100 * gangs_actual; i > -100 * gangs_actual; --i) { /* . */ @@ -98,13 +98,13 @@ int main () /* GP, WS, VS. */ { -#define GANGS 0 /* { dg-warning "'num_gangs' value must be positive" "" { target c } } */ +#define GANGS 0 /* { dg-message "warning: 'num_gangs' value must be positive" "" { target c } } */ int gangs_actual = GANGS; int gangs_min, gangs_max, workers_min, workers_max, vectors_min, vectors_max; gangs_min = workers_min = vectors_min = INT_MAX; gangs_max = workers_max = vectors_max = INT_MIN; #pragma acc parallel copy (gangs_actual) \ - num_gangs (GANGS) /* { dg-warning "'num_gangs' value must be positive" "" { target c++ } } */ + num_gangs (GANGS) // { dg-line LaNE } { /* We're actually executing with num_gangs (1). */ gangs_actual = 1; @@ -115,7 +115,7 @@ int main () workers_min = workers_max = acc_worker (); vectors_min = vectors_max = acc_vector (); } - } + } /* { dg-message "'num_gangs' value must be positive" "" { target c++ } LaNE } */ if (gangs_actual != 1) __builtin_abort (); if (gangs_min != 0 || gangs_max != gangs_actual - 1 Grüße Thomas ----------------- Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter From 47e35a661859ade764fe4ed2a4e3e2205c19dd90 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Thu, 29 Oct 2020 10:29:19 +0100 Subject: [PATCH] libgomp testsuite: tell warning from error diagnostics, etc. [PR80219, PR85303] This changes makes 'dg-warning', 'dg-error', 'dg-bogus', 'dg-message' behave as expected, and also enables use of relative line numbers as well as 'dg-line'. libgomp/ PR testsuite/80219 PR testsuite/85303 * testsuite/lib/libgomp.exp (libgomp_init): Set 'gcc_warning_prefix', 'gcc_error_prefix'. --- libgomp/testsuite/lib/libgomp.exp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp index 5d86e2ac095f..72d001186a57 100644 --- a/libgomp/testsuite/lib/libgomp.exp +++ b/libgomp/testsuite/lib/libgomp.exp @@ -241,6 +241,12 @@ proc libgomp_init { args } { if { $offload_additional_options != "" } { lappend ALWAYS_CFLAGS "additional_flags=${offload_additional_options}" } + + # Tell warning from error diagnostics. This fits for C, C++, and Fortran. + global gcc_warning_prefix + set gcc_warning_prefix "\[Ww\]arning:" + global gcc_error_prefix + set gcc_error_prefix "(\[Ff\]atal )?\[Ee\]rror:" } # -- 2.17.1