testsuite: don't declare printf in coro.h

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.
This commit is contained in:
Jason Merrill 2022-12-22 17:53:21 -05:00
parent ee4af2ed0b
commit 23be9d78f4
22 changed files with 23 additions and 25 deletions

View 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

View 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;
}

View file

@ -68,6 +68,6 @@ int main ()
abort ();
}
puts ("main: done");
PRINT ("main: done");
return 0;
}
}

View file

@ -68,6 +68,6 @@ int main ()
abort ();
}
puts ("main: done");
PRINT ("main: done");
return 0;
}

View file

@ -67,6 +67,6 @@ int main ()
abort ();
}
puts ("main: done");
PRINT ("main: done");
return 0;
}

View file

@ -67,6 +67,6 @@ int main ()
abort ();
}
puts ("main: done");
PRINT ("main: done");
return 0;
}

View 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;
}

View 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;
}

View 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;
}

View 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;
}

View 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;
}

View 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;
}

View 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;
}

View 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;
}

View 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;
}

View 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;
}

View 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;
}

View 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;
}

View 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;
}

View file

@ -40,6 +40,6 @@ int main ()
PRINT ("main: we should be 'done' ");
abort ();
}
puts ("main: done");
PRINT ("main: done");
return 0;
}

View file

@ -8,6 +8,7 @@
// go out of scope.
#include "../coro.h"
#include <stdio.h>
struct coro1 {
struct promise_type;

View 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;
}