From: Jason Merrill Date: Fri, 1 Nov 2019 20:12:30 +0000 (-0400) Subject: Fix nodiscard test failures. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2df0c2315a21a05838c8015d27678d236f4d0cd4;p=gcc.git Fix nodiscard test failures. * g++.dg/cpp2a/nodiscard-once.C: Expect nodiscard warning. * g++.dg/cpp2a/nodiscard-reason.C: Adjust expected warnings. From-SVN: r277719 --- diff --git a/gcc/testsuite/g++.dg/cpp2a/nodiscard-once.C b/gcc/testsuite/g++.dg/cpp2a/nodiscard-once.C index b9dde5cfb57..78349715aae 100644 --- a/gcc/testsuite/g++.dg/cpp2a/nodiscard-once.C +++ b/gcc/testsuite/g++.dg/cpp2a/nodiscard-once.C @@ -7,6 +7,6 @@ void test (void) { - check1 (); + check1 (); // { dg-warning "nodiscard" } (void) check1 (); } diff --git a/gcc/testsuite/g++.dg/cpp2a/nodiscard-reason.C b/gcc/testsuite/g++.dg/cpp2a/nodiscard-reason.C index e0230b1d519..5fda058c9ee 100644 --- a/gcc/testsuite/g++.dg/cpp2a/nodiscard-reason.C +++ b/gcc/testsuite/g++.dg/cpp2a/nodiscard-reason.C @@ -13,8 +13,8 @@ typedef struct { char big[1024]; fnt fn; } C; struct [[nodiscard("exact_D_message")]] D { int i; D(); ~D(); }; NODIS E check1 (void); -NODIS void check2 (void); /* { dg-warning "10:.nodiscard\[^\n\r]*exact_message" } */ -NODIS int foo; /* { dg-warning "9:.nodiscard\[^\n\r]*exact_message" } */ +NODIS void check2 (void); /* { dg-warning "12:.nodiscard\[^\n\r]*void" } */ +NODIS int foo; /* { dg-warning "11:.nodiscard\[^\n\r]*class" } */ int bar (void); NODISAI E check3 (void) { return (E)bar (); } NODIS A check4 (void); @@ -173,23 +173,23 @@ test (void) return; i += (k ? check3 : check11) (); i += ({ (k ? check3 : check11) (); }); - (k ? check3 : check11) (); /* { dg-warning "nodiscard\[^\n\r]*exact_inline_message" } */ + (k ? check3 : check11) (); /* { dg-warning "nodiscard\[^\n\r]*exact_E_message" } */ (void) (k ? check3 : check11) (); - (k ? check3 : check11) (), bar (); /* { dg-warning "nodiscard\[^\n\r]*exact_inline_message" } */ + (k ? check3 : check11) (), bar (); /* { dg-warning "nodiscard\[^\n\r]*exact_E_message" } */ if (pcheck1 ()) return; i += pcheck1 (); i += ({ pcheck1 (); }); - pcheck1 (); /* { dg-warning "nodiscard\[^\n\r]*exact_E_message" } */ + pcheck1 (); /* { dg-warning "nodiscard\[^\n\r]*exact_" } */ (void) pcheck1 (); - pcheck1 (), bar (); /* { dg-warning "nodiscard\[^\n\r]*exact_E_message" } */ + pcheck1 (), bar (); /* { dg-warning "nodiscard\[^\n\r]*exact_" } */ if (pcheck3 ()) return; i += pcheck3 (); i += ({ pcheck3 (); }); - pcheck3 (); /* { dg-warning "nodiscard\[^\n\r]*exact_E_message" } */ + pcheck3 (); /* { dg-warning "nodiscard\[^\n\r]*exact_" } */ (void) pcheck3 (); - pcheck3 (), bar (); /* { dg-warning "nodiscard\[^\n\r]*exact_E_message" } */ + pcheck3 (), bar (); /* { dg-warning "nodiscard\[^\n\r]*exact_" } */ d = check12 (); if (d.i) return;