diff mbox series

[ARM,testsuite] Make arm_arch_FUNC_ok more robust

Message ID CAKdteOa-G126JHziuQ8ZxF=jBOwKypvFgrLmat1aya4ZVkhJEg@mail.gmail.com
State New
Headers show
Series [ARM,testsuite] Make arm_arch_FUNC_ok more robust | expand

Commit Message

Christophe Lyon Jan. 18, 2018, 2:08 p.m. UTC
Hi,

I'm resurrecting a patch I posted in 2012-09 :)

effective_target_arm_arch_FUNC_ok currently contains only
                #if !defined (DEF)
                #error FOO
                #endif
which is not sufficient for GCC to complain in case of an
unsupported flags combination.
For instance, -mfloat-abi=hard -mthumb -march=armv5te leads to:
sorry, unimplemented: Thumb-1 hard-float VFP ABI
but only if the compiler had actual code to compile.

Adding a dummy main() body in the arm_arch_FUNC_ok
effective target does the trick: with this patch, this effective
target test would fail, making the test unsupported rather
than failing later.

OK?

Christophe
2018-01-18  Christophe Lyon <christophe.lyon@linaro.org>

	gcc/testsuite:
	* lib/target-supports.exp (check_effective_target_arm_arch_FUNC_ok):
	Add function body to force error messages in some configurations.

Comments

Kyrill Tkachov Jan. 18, 2018, 2:17 p.m. UTC | #1
Hi Christophe,

On 18/01/18 14:08, Christophe Lyon wrote:
> Hi,

>

> I'm resurrecting a patch I posted in 2012-09 :)

>


That's the month I first started working on GCC :)

> effective_target_arm_arch_FUNC_ok currently contains only

>                 #if !defined (DEF)

>                 #error FOO

>                 #endif

> which is not sufficient for GCC to complain in case of an

> unsupported flags combination.

> For instance, -mfloat-abi=hard -mthumb -march=armv5te leads to:

> sorry, unimplemented: Thumb-1 hard-float VFP ABI

> but only if the compiler had actual code to compile.

>

> Adding a dummy main() body in the arm_arch_FUNC_ok

> effective target does the trick: with this patch, this effective

> target test would fail, making the test unsupported rather

> than failing later.

>

> OK?


Ok. The arm_<target>_ok checks should really be able to tell us
that we can at least get to an assembly result if we add the option
in question. The quirk with the Thumb1 hard-float error is that it only
appears when compiling a function, because it's part of the ABI-conformance
code that picks where to put the result and arguments of a function.
If we have a source-file that only checks preprocessor macros it will not trigger.

Anyway, thanks for sending this, it will clean up some ugly FAILs in arm.exp.
Kyrill

>

> Christophe
diff mbox series

Patch

diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index f597316..bc7d451 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -2211,6 +2211,11 @@  foreach { armfunc armflag armdef } { v4 "-march=armv4 -marm" __ARM_ARCH_4__
 		#if !defined (DEF)
 		#error FOO
 		#endif
+		int
+		main (void)
+		{
+		    return 0;
+		}
 	    } "FLAG" ]
 	}