From patchwork Thu May 4 08:05:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 758411 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wJSJm6zZkz9rxj for ; Thu, 4 May 2017 18:06:00 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="WI3iGutN"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=kfKgr1DOlhTXF0KrUjgM8EaMJyOz0rMS9W+60J7FyIAZHGxHSv IQzKe58po2TAnOCimAJ6n0rz2CjH92F8k8fTIVG9RqiUS3rlU3p/q+ceggh42r83 +GDGL/w5Ox5GneYlbnff4OEGTkSJ52xYvNIQwtAdCwgnI+f9t6wY8w1/4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=BAg2b8us3hqN/nLfGFc0RP6xNT0=; b=WI3iGutNJgbI6VzYlOUO 0bxCSv9pLkj1234BHq7yIwKsJGtMfQzxHLFrzfyNMaNsWiA1Ji1fpw4OEfdA4CTh Q7drTrz6rA9b69SsgjG7GTQxLUADp4PCtV+E6TlrC36nsRuh2TSMV1mA/RBsvYYc 7t8MVeMINLCXX6IxVvglkiE= Received: (qmail 52354 invoked by alias); 4 May 2017 08:05:50 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 52335 invoked by uid 89); 4 May 2017 08:05:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS, URIBL_RED autolearn=ham version=3.3.2 spammy=3011 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 04 May 2017 08:05:47 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-MBX-04.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1d6Blk-0001yp-9Q from Tom_deVries@mentor.com for gcc-patches@gcc.gnu.org; Thu, 04 May 2017 01:05:48 -0700 Received: from [127.0.0.1] (137.202.0.87) by SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Thu, 4 May 2017 09:05:44 +0100 To: GCC Patches From: Tom de Vries Subject: [testsuite, committed] Replace absolute line numbers in g++.dg/warn Message-ID: <63a89130-4233-09e1-9381-dbf72a512f81@mentor.com> Date: Thu, 4 May 2017 10:05:41 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) Hi, this patch replaces absolute line numbers in g++.dg/warn. Thanks, - Tom Replace absolute line numbers in g++.dg/warn 2017-05-03 Tom de Vries PR testsuite/80557 * g++.dg/warn/Wstrict-aliasing-float-ref-int-obj.C: Replace absolute line numbers. * g++.dg/warn/miss-format-1.C: Same. * g++.dg/warn/overflow-warn-1.C: Same. * g++.dg/warn/overflow-warn-3.C: Same. * g++.dg/warn/overflow-warn-4.C: Same. --- .../warn/Wstrict-aliasing-float-ref-int-obj.C | 6 ++--- gcc/testsuite/g++.dg/warn/miss-format-1.C | 4 +-- gcc/testsuite/g++.dg/warn/overflow-warn-1.C | 29 +++++++++++++--------- gcc/testsuite/g++.dg/warn/overflow-warn-3.C | 24 ++++++++++-------- gcc/testsuite/g++.dg/warn/overflow-warn-4.C | 22 +++++++++------- 5 files changed, 49 insertions(+), 36 deletions(-) diff --git a/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-float-ref-int-obj.C b/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-float-ref-int-obj.C index d298555..9bc80c3 100644 --- a/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-float-ref-int-obj.C +++ b/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-float-ref-int-obj.C @@ -4,9 +4,9 @@ int foo() { int x; - float& q = reinterpret_cast (x); /* { dg-message "dereferencing type-punned" "deref" } */ + float& q = reinterpret_cast (x); /* { dg-message "dereferencing type-punned" "deref" } */ + /* { dg-message "initialized" "note" { xfail *-*-* } .-1 } */ + q = 1.0; /* { dg-warning "does break strict-aliasing" "strict-aliasing" { xfail *-*-* } } */ return x; } - -/* { dg-message "initialized" "note" { xfail *-*-* } 7 } */ diff --git a/gcc/testsuite/g++.dg/warn/miss-format-1.C b/gcc/testsuite/g++.dg/warn/miss-format-1.C index 0b3f6e9..65a3428 100644 --- a/gcc/testsuite/g++.dg/warn/miss-format-1.C +++ b/gcc/testsuite/g++.dg/warn/miss-format-1.C @@ -3,8 +3,6 @@ /* { dg-do compile } */ /* { dg-options "-Wmissing-format-attribute" } */ /* { dg-options "-Wmissing-format-attribute -Wno-abi" { target arm_eabi } } */ -/* VxWorks does not provide vscanf, either in kernel or RTP mode. */ -/* { dg-error "not declared" "" { target *-*-vxworks* } 26 } */ #include #include @@ -24,6 +22,8 @@ bar (const char *fmt, ...) va_list ap; va_start (ap, fmt); vscanf (fmt, ap); /* { dg-warning "candidate" "scanf attribute warning" { xfail *-*-vxworks* } } */ + /* VxWorks does not provide vscanf, either in kernel or RTP mode. */ + /* { dg-error "not declared" "" { target *-*-vxworks* } .-2 } */ va_end (ap); } diff --git a/gcc/testsuite/g++.dg/warn/overflow-warn-1.C b/gcc/testsuite/g++.dg/warn/overflow-warn-1.C index c327cc0..314e351 100644 --- a/gcc/testsuite/g++.dg/warn/overflow-warn-1.C +++ b/gcc/testsuite/g++.dg/warn/overflow-warn-1.C @@ -18,6 +18,7 @@ enum e { whole expression violates the constraints. */ E4 = 0 * (1 / 0), /* { dg-warning "division by zero" } */ /* { dg-error "enumerator value for 'E4' is not an integer constant" "enum error" { target c++ } .-1 } */ + /* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } .-2 } */ E5 = INT_MAX + 1, /* { dg-warning "integer overflow in expression" } */ /* { dg-warning "overflow in constant expression" "constant" { target *-*-* } .-1 } */ /* Again, overflow in evaluated subexpression. */ @@ -30,6 +31,9 @@ enum e { struct s { int a; int : 0 * (1 / 0); /* { dg-warning "division by zero" } */ +/* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } .-1 } */ +/* { dg-error "width not an integer constant" "bit.field" { target c++ } .-2 } */ +/* { dg-error "is not a constant expression" "division" { target c++ } .-3 } */ int : 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } */ /* { dg-warning "overflow in constant expression" "constant" { target *-*-* } .-1 } */ }; @@ -53,16 +57,25 @@ void *n = 0; subexpression, so is a null pointer constant. */ void *p = 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } */ /* { dg-warning "invalid conversion from 'int' to 'void" "null" { target *-*-* } .-1 } */ -void *q = 0 * (1 / 0); /* { dg-warning "division by zero" } */ -/* { dg-error "invalid conversion from 'int' to 'void*'" "null" { xfail *-*-* } .-1 } */ -void *r = (1 ? 0 : INT_MAX+1); /* { dg-bogus "integer overflow in expression" "" { xfail *-*-* } } */ + +void *q = 0 * (1 / 0); +/* { dg-warning "division by zero" "" { target *-*-* } .-1 } */ +/* { dg-error "invalid conversion from 'int' to 'void*'" "null" { xfail *-*-* } .-2 } */ +/* { dg-warning "invalid conversion from" "convert" { target *-*-* } .-3 } */ + +void *r = (1 ? 0 : INT_MAX+1); +/* { dg-bogus "integer overflow in expression" "" { xfail *-*-* } .-1 } */ +/* { dg-warning "invalid conversion from" "convert" { target c++11 } .-2 } */ void g (int i) { switch (i) { - case 0 * (1/0): /* { dg-warning "division by zero" } */ + case 0 * (1/0): + /* { dg-warning "division by zero" "" { target *-*-* } .-1 } */ + /* { dg-error "division by zero is not a constant expression" "division" { target c++11 } .-2 } */ + /* { dg-error "is not a constant expression" "const" { target *-*-* } .-3 } */ ; case 1 + 0 * (INT_MAX + 1): /* { dg-warning "integer overflow in expression" } */ /* { dg-warning "overflow in constant expression" "constant" { target *-*-* } .-1 } */ @@ -126,11 +139,3 @@ h2i (int x) ui = INT_MIN; ui = x ? INT_MIN : 1U; } -/* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } 19 } */ -/* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } 32 } */ -/* { dg-warning "invalid conversion from" "convert" { target *-*-* } 56 } */ -/* { dg-warning "invalid conversion from" "convert" { target c++11 } 58 } */ -/* { dg-error "division by zero is not a constant expression" "division" { target c++11 } 65 } */ -/* { dg-error "is not a constant expression" "const" { target *-*-* } 65 } */ -/* { dg-error "width not an integer constant" "bit.field" { target c++ } 32 } */ -/* { dg-error "is not a constant expression" "division" { target c++ } 32 } */ diff --git a/gcc/testsuite/g++.dg/warn/overflow-warn-3.C b/gcc/testsuite/g++.dg/warn/overflow-warn-3.C index ff6864d..b319660 100644 --- a/gcc/testsuite/g++.dg/warn/overflow-warn-3.C +++ b/gcc/testsuite/g++.dg/warn/overflow-warn-3.C @@ -18,6 +18,7 @@ enum e { whole expression violates the constraints. */ E4 = 0 * (1 / 0), /* { dg-warning "division by zero" } */ /* { dg-error "enumerator value for 'E4' is not an integer constant" "enum error" { target c++ } .-1 } */ + /* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } .-2 } */ E5 = INT_MAX + 1, /* { dg-warning "integer overflow in expression" } */ /* { dg-warning "overflow in constant expression" "constant" { target *-*-* } .-1 } */ /* Again, overflow in evaluated subexpression. */ @@ -29,7 +30,11 @@ enum e { struct s { int a; - int : 0 * (1 / 0); /* { dg-warning "division by zero" } */ + int : 0 * (1 / 0); + /* { dg-warning "division by zero" "" { target *-*-* } .-1 } */ + /* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } .-2 } */ + /* { dg-error "width not an integer constant" "bit.field" { target c++ } .-3 } */ + /* { dg-error "is not a constant expression" "division" { target c++ } .-4 } */ int : 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } */ /* { dg-warning "overflow in constant expression" "constant" { target *-*-* } .-1 } */ }; @@ -57,15 +62,20 @@ void *p = 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } void *q = 0 * (1 / 0); /* { dg-warning "division by zero" } */ /* { dg-warning "invalid conversion from 'int' to 'void" "null" { target *-*-* } .-1 } */ -void *r = (1 ? 0 : INT_MAX+1); /* { dg-bogus "integer overflow in expression" "" { xfail *-*-* } } */ +void *r = (1 ? 0 : INT_MAX+1); +/* { dg-bogus "integer overflow in expression" "" { xfail *-*-* } .-1 } */ +/* { dg-warning "invalid conversion from" "convert" { target c++11 } .-2 } */ void g (int i) { switch (i) { - case 0 * (1/0): /* { dg-warning "division by zero" } */ - ; /* { dg-error "division by zero is not a constant expression" "division" { target c++11 } .-1 } */ + case 0 * (1/0): + /* { dg-warning "division by zero" "" { target *-*-* } .-1 } */ + /* { dg-error "division by zero is not a constant expression" "division" { target c++11 } .-2 } */ + /* { dg-error "not a constant expression" "constant" { target *-*-* } .-3 } */ + ; case 1 + 0 * (INT_MAX + 1): /* { dg-warning "integer overflow in expression" } */ /* { dg-warning "overflow in constant expression" "constant" { target *-*-* } .-1 } */ ; @@ -128,9 +138,3 @@ h2i (int x) ui = INT_MIN; ui = x ? INT_MIN : 1U; } -/* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } 19 } */ -/* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } 32 } */ -/* { dg-warning "invalid conversion from" "convert" { target c++11 } 60 } */ -/* { dg-error "not a constant expression" "constant" { target *-*-* } 67 } */ -/* { dg-error "width not an integer constant" "bit.field" { target c++ } 32 } */ -/* { dg-error "is not a constant expression" "division" { target c++ } 32 } */ diff --git a/gcc/testsuite/g++.dg/warn/overflow-warn-4.C b/gcc/testsuite/g++.dg/warn/overflow-warn-4.C index b9d4ebd..dfe8741 100644 --- a/gcc/testsuite/g++.dg/warn/overflow-warn-4.C +++ b/gcc/testsuite/g++.dg/warn/overflow-warn-4.C @@ -18,6 +18,7 @@ enum e { whole expression violates the constraints. */ E4 = 0 * (1 / 0), /* { dg-warning "division by zero" } */ /* { dg-error "enumerator value for 'E4' is not an integer constant" "enum error" { target c++ } .-1 } */ + /* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } .-2 } */ E5 = INT_MAX + 1, /* { dg-warning "integer overflow in expression" } */ /* { dg-error "overflow in constant expression" "constant" { target *-*-* } .-1 } */ /* { dg-error "enumerator value for 'E5' is not an integer constant" "enum error" { target *-*-* } .-2 } */ @@ -32,6 +33,9 @@ enum e { struct s { int a; int : 0 * (1 / 0); /* { dg-warning "division by zero" } */ + /* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } .-1 } */ + /* { dg-error "width not an integer constant" "bit.field" { target c++ } .-2 } */ + /* { dg-error "is not a constant expression" "division" { target c++ } .-3 } */ int : 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } */ /* { dg-error "overflow in constant expression" "constant" { target *-*-* } .-1 } */ /* { dg-error "bit-field .* width not an integer constant" "" { target *-*-* } .-2 } */ @@ -60,15 +64,21 @@ void *p = 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } void *q = 0 * (1 / 0); /* { dg-warning "division by zero" } */ /* { dg-error "invalid conversion from 'int' to 'void" "null" { target *-*-* } .-1 } */ -void *r = (1 ? 0 : INT_MAX+1); /* { dg-bogus "integer overflow in expression" "" { xfail *-*-* } } */ + +void *r = (1 ? 0 : INT_MAX+1); +/* { dg-bogus "integer overflow in expression" "" { xfail *-*-* } .-1 } */ +/* { dg-error "invalid conversion from" "convert" { target c++11 } .-2 } */ void g (int i) { switch (i) { - case 0 * (1/0): /* { dg-warning "division by zero" } */ - ; /* { dg-error "division by zero is not a constant expression" "division" { target c++11 } .-1 } */ + case 0 * (1/0): + /* { dg-warning "division by zero" "" { target *-*-* } .-1 } */ + /* { dg-error "division by zero is not a constant expression" "division" { target c++11 } .-2 } */ + /* { dg-error "is not a constant expression" "const" { target *-*-* } .-3 } */ + ; case 1 + 0 * (INT_MAX + 1): /* { dg-warning "integer overflow in expression" } */ /* { dg-error "overflow in constant expression" "constant" { target *-*-* } .-1 } */ ; @@ -131,9 +141,3 @@ h2i (int x) ui = INT_MIN; ui = x ? INT_MIN : 1U; } -/* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } 19 } */ -/* { dg-error "invalid conversion from" "convert" { target c++11 } 63 } */ -/* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } 34 } */ -/* { dg-error "is not a constant expression" "const" { target *-*-* } 70 } */ -/* { dg-error "width not an integer constant" "bit.field" { target c++ } 34 } */ -/* { dg-error "is not a constant expression" "division" { target c++ } 34 } */