testsuite: don't declare printf in coro.h
authorJason Merrill <jason@redhat.com>
Thu, 22 Dec 2022 22:53:21 +0000 (17:53 -0500)
committerJason Merrill <jason@redhat.com>
Thu, 22 Dec 2022 23:38:37 +0000 (18:38 -0500)
mingw stdio.h plays horrible games with extern "C++", but it also seems
sloppy for coro.h to declare printf in testcases that will also include
standard headers.

gcc/testsuite/ChangeLog:

* g++.dg/coroutines/coro.h: #include <stdio.h> instead of
declaring puts/printf.
* g++.dg/coroutines/torture/mid-suspend-destruction-0.C:
#include <stdio.h>.
* g++.dg/coroutines/pr95599.C: Use PRINT instead of puts.
* g++.dg/coroutines/torture/call-00-co-aw-arg.C:
* g++.dg/coroutines/torture/call-01-multiple-co-aw.C:
* g++.dg/coroutines/torture/call-02-temp-co-aw.C:
* g++.dg/coroutines/torture/call-03-temp-ref-co-aw.C:
* g++.dg/coroutines/torture/co-await-00-trivial.C:
* g++.dg/coroutines/torture/co-await-01-with-value.C:
* g++.dg/coroutines/torture/co-await-02-xform.C:
* g++.dg/coroutines/torture/co-await-03-rhs-op.C:
* g++.dg/coroutines/torture/co-await-04-control-flow.C:
* g++.dg/coroutines/torture/co-await-05-loop.C:
* g++.dg/coroutines/torture/co-await-06-ovl.C:
* g++.dg/coroutines/torture/co-await-07-tmpl.C:
* g++.dg/coroutines/torture/co-await-08-cascade.C:
* g++.dg/coroutines/torture/co-await-09-pair.C:
* g++.dg/coroutines/torture/co-await-11-forwarding.C:
* g++.dg/coroutines/torture/co-await-12-operator-2.C:
* g++.dg/coroutines/torture/co-await-13-return-ref.C:
* g++.dg/coroutines/torture/co-await-14-return-ref-to-auto.C:
* g++.dg/coroutines/torture/pr95003.C: Likewise.

22 files changed:
gcc/testsuite/g++.dg/coroutines/coro.h
gcc/testsuite/g++.dg/coroutines/pr95599.C
gcc/testsuite/g++.dg/coroutines/torture/call-00-co-aw-arg.C
gcc/testsuite/g++.dg/coroutines/torture/call-01-multiple-co-aw.C
gcc/testsuite/g++.dg/coroutines/torture/call-02-temp-co-aw.C
gcc/testsuite/g++.dg/coroutines/torture/call-03-temp-ref-co-aw.C
gcc/testsuite/g++.dg/coroutines/torture/co-await-00-trivial.C
gcc/testsuite/g++.dg/coroutines/torture/co-await-01-with-value.C
gcc/testsuite/g++.dg/coroutines/torture/co-await-02-xform.C
gcc/testsuite/g++.dg/coroutines/torture/co-await-03-rhs-op.C
gcc/testsuite/g++.dg/coroutines/torture/co-await-04-control-flow.C
gcc/testsuite/g++.dg/coroutines/torture/co-await-05-loop.C
gcc/testsuite/g++.dg/coroutines/torture/co-await-06-ovl.C
gcc/testsuite/g++.dg/coroutines/torture/co-await-07-tmpl.C
gcc/testsuite/g++.dg/coroutines/torture/co-await-08-cascade.C
gcc/testsuite/g++.dg/coroutines/torture/co-await-09-pair.C
gcc/testsuite/g++.dg/coroutines/torture/co-await-11-forwarding.C
gcc/testsuite/g++.dg/coroutines/torture/co-await-12-operator-2.C
gcc/testsuite/g++.dg/coroutines/torture/co-await-13-return-ref.C
gcc/testsuite/g++.dg/coroutines/torture/co-await-14-return-ref-to-auto.C
gcc/testsuite/g++.dg/coroutines/torture/mid-suspend-destruction-0.C
gcc/testsuite/g++.dg/coroutines/torture/pr95003.C

index 02d2660..491177f 100644 (file)
@@ -129,10 +129,6 @@ namespace coro = std;
 
 #endif // __has_include(<experimental/coroutine>)
 
-/* just to avoid cluttering dump files. */
-extern "C" int puts (const char *);
-extern "C" int printf (const char *, ...);
-
 #include <cstdlib> /* for abort () */
 
 #include <utility> /* for std::forward */
@@ -141,6 +137,7 @@ extern "C" int printf (const char *, ...);
 #  define PRINT(X)
 #  define PRINTF (void)
 #else
+#include <stdio.h>
 #  define PRINT(X) puts(X)
 #  define PRINTF printf
 #endif
index 9376359..ec97a4a 100644 (file)
@@ -64,6 +64,6 @@ int main ()
       PRINTF ("something happened in the wrong order %d, %d, %d, %d, %d, %d, %d\n", a, b, c, d, e, f, g);
       abort ();
     }
-  puts ("main: done");
+  PRINT ("main: done");
   return 0;
 }
index ee10807..19e3ec1 100644 (file)
@@ -68,6 +68,6 @@ int main ()
       abort ();
     }
 
-  puts ("main: done");
+  PRINT ("main: done");
   return 0;
-}
\ No newline at end of file
+}
index 0f57851..573f4f8 100644 (file)
@@ -68,6 +68,6 @@ int main ()
       abort ();
     }
 
-  puts ("main: done");
+  PRINT ("main: done");
   return 0;
 }
\ No newline at end of file
index 4982c49..8ae07aa 100644 (file)
@@ -67,6 +67,6 @@ int main ()
       abort ();
     }
 
-  puts ("main: done");
+  PRINT ("main: done");
   return 0;
 }
\ No newline at end of file
index d0bb466..967cb1b 100644 (file)
@@ -67,6 +67,6 @@ int main ()
       abort ();
     }
 
-  puts ("main: done");
+  PRINT ("main: done");
   return 0;
 }
\ No newline at end of file
index a24c261..6de751a 100644 (file)
@@ -47,6 +47,6 @@ int main ()
       PRINTF ("main: y is wrong : %d, should be 11\n", y);
       abort ();
     }
-  puts ("main: done");
+  PRINT ("main: done");
   return 0;
 }
index db5c902..ddff645 100644 (file)
@@ -52,6 +52,6 @@ int main ()
       PRINTF ("main: y is wrong : %d, should be 15\n", y);
       abort ();
     }
-  puts ("main: done");
+  PRINT ("main: done");
   return 0;
 }
index 79ee6e1..8d32c73 100644 (file)
@@ -53,6 +53,6 @@ int main ()
       PRINTF ("main: y is wrong : %d, should be 42\n", y);
       abort ();
     }
-  puts ("main: done");
+  PRINT ("main: done");
   return 0;
 }
index 6408432..29dcc5f 100644 (file)
@@ -53,6 +53,6 @@ int main ()
       PRINTF ("main: y is wrong : %d, should be 42\n", y);
       abort ();
     }
-  puts ("main: done");
+  PRINT ("main: done");
   return 0;
 }
index e8da2d2..fd201f9 100644 (file)
@@ -47,6 +47,6 @@ int main ()
       PRINTF ("main: y is wrong : %d, should be 42\n", y);
       abort ();
     }
-  puts ("main: done");
+  PRINT ("main: done");
   return 0;
 }
index 34af740..58cdced 100644 (file)
@@ -46,6 +46,6 @@ int main ()
       PRINTF ("main: y is wrong : %d, should be 111\n", y);
       abort ();
     }
-  puts ("main: done");
+  PRINT ("main: done");
   return 0;
 }
index 14945fa..a3f7fa0 100644 (file)
@@ -60,6 +60,6 @@ int main ()
       PRINTF ("main: y is wrong : %d, should be 11\n", y);
       abort ();
     }
-  puts ("main: done");
+  PRINT ("main: done");
   return 0;
 }
index 17dff0d..8915786 100644 (file)
@@ -127,6 +127,6 @@ int main ()
       PRINTF ("main: y is wrong : %d, should be 42\n", y);
       abort ();
     }
-  puts ("main: done");
+  PRINT ("main: done");
   return 0;
 }
index d34619d..51eedc5 100644 (file)
@@ -58,6 +58,6 @@ int main ()
       PRINTF ("main: y is wrong : %d, should be 14672\n", y);
       abort ();
     }
-  puts ("main: done");
+  PRINT ("main: done");
   return 0;
 }
index 525c6fc..e3aba4d 100644 (file)
@@ -52,6 +52,6 @@ int main ()
       PRINTF ("main: y is wrong : %d, should be 57\n", y);
       abort ();
     }
-  puts ("main: done");
+  PRINT ("main: done");
   return 0;
 }
index 78c88ed..6e59c88 100644 (file)
@@ -38,6 +38,6 @@ int main ()
       PRINTF ("main: y is wrong : %d, should be 15\n", y);
       abort ();
     }
-  puts ("main: done");
+  PRINT ("main: done");
   return 0;
 }
index 189332b..91dd192 100644 (file)
@@ -61,6 +61,6 @@ int main ()
       PRINTF ("main: y is wrong : %d, should be 14\n", y);
       abort ();
     }
-  puts ("main: done");
+  PRINT ("main: done");
   return 0;
 }
index 339ebe4..78f2d5b 100644 (file)
@@ -53,6 +53,6 @@ int main ()
       PRINTF ("main: y is wrong : %d, should be 15\n", y);
       abort ();
     }
-  puts ("main: done");
+  PRINT ("main: done");
   return 0;
 }
index 0a7c035..6b1d5bf 100644 (file)
@@ -40,6 +40,6 @@ int main ()
       PRINT ("main: we should be 'done' ");
       abort ();
     }
-  puts ("main: done");
+  PRINT ("main: done");
   return 0;
 }
index eda7858..9022dd2 100644 (file)
@@ -45,6 +45,6 @@ int main ()
       PRINTF ("main: y is wrong : %d, should be 100\n", y);
       abort ();
     }
-  puts ("main: done");
+  PRINT ("main: done");
   return 0;
 }