Commit 0fcd8629 by Jakub Jelinek Committed by Jakub Jelinek

nodiscard-reason-only-one.C: In dg-error or dg-warning remove (?n) uses and…

nodiscard-reason-only-one.C: In dg-error or dg-warning remove (?n) uses and replace .* with \[^\n\r]*.

	* g++.dg/cpp2a/nodiscard-reason-only-one.C: In dg-error or dg-warning
	remove (?n) uses and replace .* with \[^\n\r]*.
	* g++.dg/cpp2a/nodiscard-reason.C: Likewise.
	* g++.dg/cpp2a/nodiscard-once.C: Likewise.
	* g++.dg/cpp2a/nodiscard-reason-nonstring.C: Likewise.

From-SVN: r277205
parent b3fbf95e
2019-10-20 Jakub Jelinek <jakub@redhat.com>
* g++.dg/cpp2a/nodiscard-reason-only-one.C: In dg-error or dg-warning
remove (?n) uses and replace .* with \[^\n\r]*.
* g++.dg/cpp2a/nodiscard-reason.C: Likewise.
* g++.dg/cpp2a/nodiscard-once.C: Likewise.
* g++.dg/cpp2a/nodiscard-reason-nonstring.C: Likewise.
2019-10-19 Jakub Jelinek <jakub@redhat.com> 2019-10-19 Jakub Jelinek <jakub@redhat.com>
PR target/92140 PR target/92140
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/* { dg-do compile { target c++2a } } */ /* { dg-do compile { target c++2a } } */
/* { dg-options "-O -ftrack-macro-expansion=0" } */ /* { dg-options "-O -ftrack-macro-expansion=0" } */
[[nodiscard, nodiscard]] int check1 (void); /* { dg-error "(?n)nodiscard.*can appear at most once" } */ [[nodiscard, nodiscard]] int check1 (void); /* { dg-error "nodiscard\[^\n\r]*can appear at most once" } */
void void
test (void) test (void)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/* { dg-do compile { target c++2a } } */ /* { dg-do compile { target c++2a } } */
/* { dg-options "-O -ftrack-macro-expansion=0" } */ /* { dg-options "-O -ftrack-macro-expansion=0" } */
[[nodiscard(123)]] int check1 (void); /* { dg-error "(?n)nodiscard.*must be a string constant" } */ [[nodiscard(123)]] int check1 (void); /* { dg-error "nodiscard\[^\n\r]*must be a string constant" } */
void void
test (void) test (void)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/* { dg-do compile { target c++2a } } */ /* { dg-do compile { target c++2a } } */
/* { dg-options "-O -ftrack-macro-expansion=0" } */ /* { dg-options "-O -ftrack-macro-expansion=0" } */
[[nodiscard("not", "allowed")]] int check1 (void); /* { dg-error "(?n)wrong number of arguments..*nodiscard" } */ [[nodiscard("not", "allowed")]] int check1 (void); /* { dg-error "wrong number of arguments.\[^\n\r]*nodiscard" } */
void void
test (void) test (void)
......
...@@ -13,8 +13,8 @@ typedef struct { char big[1024]; fnt fn; } C; ...@@ -13,8 +13,8 @@ typedef struct { char big[1024]; fnt fn; } C;
struct [[nodiscard("exact_D_message")]] D { int i; D(); ~D(); }; struct [[nodiscard("exact_D_message")]] D { int i; D(); ~D(); };
NODIS E check1 (void); NODIS E check1 (void);
NODIS void check2 (void); /* { dg-warning "(?n)10:.nodiscard.*exact_message" } */ NODIS void check2 (void); /* { dg-warning "10:.nodiscard\[^\n\r]*exact_message" } */
NODIS int foo; /* { dg-warning "(?n)9:.nodiscard.*exact_message" } */ NODIS int foo; /* { dg-warning "9:.nodiscard\[^\n\r]*exact_message" } */
int bar (void); int bar (void);
NODISAI E check3 (void) { return (E)bar (); } NODISAI E check3 (void) { return (E)bar (); }
NODIS A check4 (void); NODIS A check4 (void);
...@@ -52,9 +52,9 @@ test (void) ...@@ -52,9 +52,9 @@ test (void)
return; return;
i += check1 (); i += check1 ();
i += ({ check1 (); }); i += ({ check1 (); });
check1 (); /* { dg-warning "(?n)nodiscard.*exact_message" } */ check1 (); /* { dg-warning "nodiscard\[^\n\r]*exact_message" } */
(void) check1 (); (void) check1 ();
check1 (), bar (); /* { dg-warning "(?n)nodiscard.*exact_message" } */ check1 (), bar (); /* { dg-warning "nodiscard\[^\n\r]*exact_message" } */
check2 (); check2 ();
(void) check2 (); (void) check2 ();
check2 (), bar (); check2 (), bar ();
...@@ -62,9 +62,9 @@ test (void) ...@@ -62,9 +62,9 @@ test (void)
return; return;
i += check3 (); i += check3 ();
i += ({ check3 (); }); i += ({ check3 (); });
check3 (); /* { dg-warning "(?n)nodiscard.*exact_inline_message" } */ check3 (); /* { dg-warning "nodiscard\[^\n\r]*exact_inline_message" } */
(void) check3 (); (void) check3 ();
check3 (), bar (); /* { dg-warning "(?n)nodiscard.*exact_inline_message" } */ check3 (), bar (); /* { dg-warning "nodiscard\[^\n\r]*exact_inline_message" } */
a = check4 (); a = check4 ();
if (a.i) if (a.i)
return; return;
...@@ -72,9 +72,9 @@ test (void) ...@@ -72,9 +72,9 @@ test (void)
return; return;
if (({ check4 (); }).i) if (({ check4 (); }).i)
return; return;
check4 (); /* { dg-warning "(?n)nodiscard.*exact_message" } */ check4 (); /* { dg-warning "nodiscard\[^\n\r]*exact_message" } */
(void) check4 (); (void) check4 ();
check4 (), bar (); /* { dg-warning "(?n)nodiscard.*exact_message" } */ check4 (), bar (); /* { dg-warning "nodiscard\[^\n\r]*exact_message" } */
b = check5 (); b = check5 ();
if (b.i + b.j) if (b.i + b.j)
return; return;
...@@ -82,9 +82,9 @@ test (void) ...@@ -82,9 +82,9 @@ test (void)
return; return;
if (({ check5 (); }).j) if (({ check5 (); }).j)
return; return;
check5 (); /* { dg-warning "(?n)nodiscard.*exact_message" } */ check5 (); /* { dg-warning "nodiscard\[^\n\r]*exact_message" } */
(void) check5 (); (void) check5 ();
check5 (), bar (); /* { dg-warning "(?n)nodiscard.*exact_message" } */ check5 (), bar (); /* { dg-warning "nodiscard\[^\n\r]*exact_message" } */
c = check6 (); c = check6 ();
if (c.big[12] + c.big[29]) if (c.big[12] + c.big[29])
return; return;
...@@ -92,9 +92,9 @@ test (void) ...@@ -92,9 +92,9 @@ test (void)
return; return;
if (({ check6 (); }).big[0]) if (({ check6 (); }).big[0])
return; return;
check6 (); /* { dg-warning "(?n)nodiscard.*exact_message" } */ check6 (); /* { dg-warning "nodiscard\[^\n\r]*exact_message" } */
(void) check6 (); (void) check6 ();
check6 (), bar (); /* { dg-warning "(?n)nodiscard.*exact_message" } */ check6 (), bar (); /* { dg-warning "nodiscard\[^\n\r]*exact_message" } */
a = check7 (); a = check7 ();
if (a.i) if (a.i)
return; return;
...@@ -102,9 +102,9 @@ test (void) ...@@ -102,9 +102,9 @@ test (void)
return; return;
if (({ check7 (); }).i) if (({ check7 (); }).i)
return; return;
check7 (); /* { dg-warning "(?n)nodiscard.*exact_inline_message" } */ check7 (); /* { dg-warning "nodiscard\[^\n\r]*exact_inline_message" } */
(void) check7 (); (void) check7 ();
check7 (), bar (); /* { dg-warning "(?n)nodiscard.*exact_inline_message" } */ check7 (), bar (); /* { dg-warning "nodiscard\[^\n\r]*exact_inline_message" } */
b = check8 (); b = check8 ();
if (b.i + b.j) if (b.i + b.j)
return; return;
...@@ -112,9 +112,9 @@ test (void) ...@@ -112,9 +112,9 @@ test (void)
return; return;
if (({ check8 (); }).j) if (({ check8 (); }).j)
return; return;
check8 (); /* { dg-warning "(?n)nodiscard.*exact_inline_message" } */ check8 (); /* { dg-warning "nodiscard\[^\n\r]*exact_inline_message" } */
(void) check8 (); (void) check8 ();
check8 (), bar (); /* { dg-warning "(?n)nodiscard.*exact_inline_message" } */ check8 (), bar (); /* { dg-warning "nodiscard\[^\n\r]*exact_inline_message" } */
c = check9 (); c = check9 ();
if (c.big[12] + c.big[29]) if (c.big[12] + c.big[29])
return; return;
...@@ -122,74 +122,74 @@ test (void) ...@@ -122,74 +122,74 @@ test (void)
return; return;
if (({ check9 (); }).big[0]) if (({ check9 (); }).big[0])
return; return;
check9 (); /* { dg-warning "(?n)nodiscard.*exact_inline_message" } */ check9 (); /* { dg-warning "nodiscard\[^\n\r]*exact_inline_message" } */
(void) check9 (); (void) check9 ();
check9 (), bar (); /* { dg-warning "(?n)nodiscard.*exact_inline_message" } */ check9 (), bar (); /* { dg-warning "nodiscard\[^\n\r]*exact_inline_message" } */
if (check_int_result (GU (j))) if (check_int_result (GU (j)))
return; return;
i += check_int_result (GU (j)); i += check_int_result (GU (j));
i += ({ check_int_result (GU (j)); }); i += ({ check_int_result (GU (j)); });
check_int_result (GU (j)); /* { dg-warning "(?n)nodiscard.*exact_inline_message" } */ check_int_result (GU (j)); /* { dg-warning "nodiscard\[^\n\r]*exact_inline_message" } */
(void) check_int_result (GU (j)); (void) check_int_result (GU (j));
check_int_result (GU (j)), bar (); /* { dg-warning "(?n)nodiscard.*exact_inline_message" } */ check_int_result (GU (j)), bar (); /* { dg-warning "nodiscard\[^\n\r]*exact_inline_message" } */
if (fnptr ()) if (fnptr ())
return; return;
i += fnptr (); i += fnptr ();
i += ({ fnptr (); }); i += ({ fnptr (); });
fnptr (); /* { dg-warning "(?n)nodiscard.*exact_E_message" } */ fnptr (); /* { dg-warning "nodiscard\[^\n\r]*exact_E_message" } */
(void) fnptr (); (void) fnptr ();
fnptr (), bar (); /* { dg-warning "(?n)nodiscard.*exact_E_message" } */ fnptr (), bar (); /* { dg-warning "nodiscard\[^\n\r]*exact_E_message" } */
fnptr = check1; fnptr = check1;
if (fnptr ()) if (fnptr ())
return; return;
i += fnptr (); i += fnptr ();
i += ({ fnptr (); }); i += ({ fnptr (); });
fnptr (); /* { dg-warning "(?n)nodiscard.*exact_E_message" } */ fnptr (); /* { dg-warning "nodiscard\[^\n\r]*exact_E_message" } */
(void) fnptr (); (void) fnptr ();
fnptr (), bar (); /* { dg-warning "(?n)nodiscard.*exact_E_message" } */ fnptr (), bar (); /* { dg-warning "nodiscard\[^\n\r]*exact_E_message" } */
fnptr = check3; fnptr = check3;
if (fnptr ()) if (fnptr ())
return; return;
i += fnptr (); i += fnptr ();
i += ({ fnptr (); }); i += ({ fnptr (); });
fnptr (); /* { dg-warning "(?n)nodiscard.*exact_E_message" } */ fnptr (); /* { dg-warning "nodiscard\[^\n\r]*exact_E_message" } */
(void) fnptr (); (void) fnptr ();
fnptr (), bar (); /* { dg-warning "(?n)nodiscard.*exact_E_message" } */ fnptr (), bar (); /* { dg-warning "nodiscard\[^\n\r]*exact_E_message" } */
if (bar9 ().fn ()) if (bar9 ().fn ())
return; return;
i += bar9 ().fn (); i += bar9 ().fn ();
i += ({ bar9 ().fn (); }); i += ({ bar9 ().fn (); });
bar9 ().fn (); /* { dg-warning "(?n)nodiscard.*exact_E_message" } */ bar9 ().fn (); /* { dg-warning "nodiscard\[^\n\r]*exact_E_message" } */
(void) bar9 ().fn (); (void) bar9 ().fn ();
bar9 ().fn (), bar (); /* { dg-warning "(?n)nodiscard.*exact_E_message" } */ bar9 ().fn (), bar (); /* { dg-warning "nodiscard\[^\n\r]*exact_E_message" } */
if ((k ? check1 : check10) ()) if ((k ? check1 : check10) ())
return; return;
i += (k ? check1 : check10) (); i += (k ? check1 : check10) ();
i += ({ (k ? check1 : check10) (); }); i += ({ (k ? check1 : check10) (); });
(k ? check1 : check10) (); /* { dg-warning "(?n)nodiscard.*exact_E_message" } */ (k ? check1 : check10) (); /* { dg-warning "nodiscard\[^\n\r]*exact_E_message" } */
(void) (k ? check1 : check10) (); (void) (k ? check1 : check10) ();
(k ? check1 : check10) (), bar (); /* { dg-warning "(?n)nodiscard.*exact_E_message" } */ (k ? check1 : check10) (), bar (); /* { dg-warning "nodiscard\[^\n\r]*exact_E_message" } */
if ((k ? check3 : check11) ()) if ((k ? check3 : check11) ())
return; return;
i += (k ? check3 : check11) (); i += (k ? check3 : check11) ();
i += ({ (k ? check3 : check11) (); }); i += ({ (k ? check3 : check11) (); });
(k ? check3 : check11) (); /* { dg-warning "(?n)nodiscard.*exact_inline_message" } */ (k ? check3 : check11) (); /* { dg-warning "nodiscard\[^\n\r]*exact_inline_message" } */
(void) (k ? check3 : check11) (); (void) (k ? check3 : check11) ();
(k ? check3 : check11) (), bar (); /* { dg-warning "(?n)nodiscard.*exact_inline_message" } */ (k ? check3 : check11) (), bar (); /* { dg-warning "nodiscard\[^\n\r]*exact_inline_message" } */
if (pcheck1 ()) if (pcheck1 ())
return; return;
i += pcheck1 (); i += pcheck1 ();
i += ({ pcheck1 (); }); i += ({ pcheck1 (); });
pcheck1 (); /* { dg-warning "(?n)nodiscard.*exact_E_message" } */ pcheck1 (); /* { dg-warning "nodiscard\[^\n\r]*exact_E_message" } */
(void) pcheck1 (); (void) pcheck1 ();
pcheck1 (), bar (); /* { dg-warning "(?n)nodiscard.*exact_E_message" } */ pcheck1 (), bar (); /* { dg-warning "nodiscard\[^\n\r]*exact_E_message" } */
if (pcheck3 ()) if (pcheck3 ())
return; return;
i += pcheck3 (); i += pcheck3 ();
i += ({ pcheck3 (); }); i += ({ pcheck3 (); });
pcheck3 (); /* { dg-warning "(?n)nodiscard.*exact_E_message" } */ pcheck3 (); /* { dg-warning "nodiscard\[^\n\r]*exact_E_message" } */
(void) pcheck3 (); (void) pcheck3 ();
pcheck3 (), bar (); /* { dg-warning "(?n)nodiscard.*exact_E_message" } */ pcheck3 (), bar (); /* { dg-warning "nodiscard\[^\n\r]*exact_E_message" } */
d = check12 (); d = check12 ();
if (d.i) if (d.i)
return; return;
...@@ -197,7 +197,7 @@ test (void) ...@@ -197,7 +197,7 @@ test (void)
return; return;
if (({ check12 (); }).i) if (({ check12 (); }).i)
return; return;
check12 (); /* { dg-warning "(?n)nodiscard.*exact_D_message" } */ check12 (); /* { dg-warning "nodiscard\[^\n\r]*exact_D_message" } */
(void) check12 (); (void) check12 ();
check12 (), bar (); /* { dg-warning "(?n)nodiscard.*exact_D_message" } */ check12 (), bar (); /* { dg-warning "nodiscard\[^\n\r]*exact_D_message" } */
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment