On Wed, Jul 20, 2022 at 05:32:01PM +0800, Kewen.Lin wrote:
> As the failure of test case gcc.target/powerpc/pr92398.p9-.c in
> PR106345 shows, some test sources for some powerpc effective
> targets use empty translation unit wrongly. The test sources
> could go with options like "-ansi -pedantic-errors", then those
> effective target checkings will fail unexpectedly with the
> error messages like:
>
> error: ISO C forbids an empty translation unit [-Wpedantic]
>
> This patch is to fix empty TUs with one dummy variable definition
> accordingly.
You can also use
enum{a};
which is shorter, but more importantly does not generate any code.
You can also do
extern int dummy;
of course -- same idea, no definitions, only declarations.
> I'll push this soon if no objections.
> @@ -6523,6 +6531,7 @@ proc check_effective_target_ppc_float128 { } {
> #ifndef __FLOAT128__
> nope no good
> #endif
> + int dummy;
At least put it in #else then? Or just do things a bit more elegantly
(do a dummy function around this for example).
Segher