]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
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 02d26602727324072dc607bcb178b1e16d85983b..491177f0cfd5fa31b01fb85b539fbfdf188c88fd 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 9376359d378f0e7b4b8b205d520b27ac40420a77..ec97a4aa16510e559a2338a6a3435f2bffb354ff 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 ee108072f690e17546112313355b435d574d58f3..19e3ec1fe68770cd1faf1eb517ede47e7b5f571e 100644 (file)
@@ -68,6 +68,6 @@ int main ()
       abort ();
     }
 
-  puts ("main: done");
+  PRINT ("main: done");
   return 0;
-}
\ No newline at end of file
+}
index 0f5785163fce2ddc7b36281dca759d4fe7367e5d..573f4f86a522e4b67aaef495a3d67c6a58b172e3 100644 (file)
@@ -68,6 +68,6 @@ int main ()
       abort ();
     }
 
-  puts ("main: done");
+  PRINT ("main: done");
   return 0;
 }
\ No newline at end of file
index 4982c49d796b8f1ea736a58691967c843a72df48..8ae07aa7a456723ba42c9cfcab6f894622f509ed 100644 (file)
@@ -67,6 +67,6 @@ int main ()
       abort ();
     }
 
-  puts ("main: done");
+  PRINT ("main: done");
   return 0;
 }
\ No newline at end of file
index d0bb4667ac95384cbd1b64cecf0550aeab6aa8f4..967cb1b9baa14a88a29d48533741e0c971a98b1b 100644 (file)
@@ -67,6 +67,6 @@ int main ()
       abort ();
     }
 
-  puts ("main: done");
+  PRINT ("main: done");
   return 0;
 }
\ No newline at end of file
index a24c26159971afc3206b509c50bf74e644581025..6de751af53c1b4fd7f8da4b2e580b8b6d208353f 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 db5c90224d2370e7a883b822898a985d7e2e132b..ddff64530b3d9ce71fbd0eb002cda2a6e2bffe61 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 79ee6e17146b01464ec1bbcdef245047e0b4e12b..8d32c73503f9af78ffbf925b66e88604f25e848f 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 64084325736e8df0fe0f7a6fb8f72d4653dc5934..29dcc5f7a2cd27c67914e14af03c56da3cfe54ad 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 e8da2d2e2ad7b815c07aaf2fce81ac60739b81f7..fd201f904816db5b4d1081198d081596d662dfb8 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 34af740c99dcd61dd80d6a348401f29776a6f1c3..58cdced7313f092222500c88ad8876f62211a1d8 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 14945faffd0d9ba6fc7a570486a3c24fce72e082..a3f7fa0083b61a4d25a5cdbe47ecffe9cd3e5f29 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 17dff0dbbeca58cbac13e9a4e3a9f6fc17ff9e2c..8915786dd1efc3d2a898d9a2b28fda33ca5e9a6f 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 d34619d6b661b5c46cc0c35a6cc3115547769fec..51eedc57421e112f934d2538fbe355cf686e6b58 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 525c6fc46779aa436d1e2a7b74d98329a64a0805..e3aba4d56ef889b1fe938959e3d8a3208ddb25cf 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 78c88ed14e9df8ae4e6b9662ee91567a1ada24b7..6e59c88447b14adcea52ca0193045190fe8f3da4 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 189332b78e509077c9c1414ef7f9a283f47963cb..91dd1927bfd04df1729a9b40227f861783a8905a 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 339ebe4ff279c8f9c7d9ae5bf7d34e0792bb68d7..78f2d5b9d1b981660c06a01e3acf7838b76d7898 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 0a7c035ef2ab114b0d37bf10673cff33daa5d585..6b1d5bf5a436310ddb30d2b144d283d9f2e6daf1 100644 (file)
@@ -40,6 +40,6 @@ int main ()
       PRINT ("main: we should be 'done' ");
       abort ();
     }
-  puts ("main: done");
+  PRINT ("main: done");
   return 0;
 }
index 63561ea2ae7fee50bcf741a43a11dc17212202c4..0cbf93ad8afff554513d99e8587b835cfa0df45c 100644 (file)
@@ -8,6 +8,7 @@
 // go out of scope.
 
 #include "../coro.h"
+#include <stdio.h>
 
 struct coro1 {
   struct promise_type;
index eda785827ec2b8c1e75de57cb401869b85c16430..9022dd2b1edd315d4e3343c801c95692e8d4b080 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;
 }