From 449cd5af046c35e021ff0a6261c728479ae6fb91 Mon Sep 17 00:00:00 2001 From: Thomas Preud'homme Date: Fri, 20 Jan 2017 15:29:21 +0000 Subject: [PATCH] Skip optional_mthumb tests if GCC has a default mode 2017-01-20 Thomas Preud'homme gcc/testsuite/ * lib/target-supports.exp (check_configured_with): New procedure. (check_effective_target_default_mode): new effective target. * gcc.target/arm/optional_thumb-1.c: Skip if GCC was configured with a default mode. Fix dg-skip-if target selector syntax. * gcc.target/arm/optional_thumb-2.c: Likewise. * gcc.target/arm/optional_thumb-3.c: Fix dg-skip-if target selector syntax. From-SVN: r244723 --- gcc/testsuite/ChangeLog | 10 ++++++++++ .../gcc.target/arm/optional_thumb-1.c | 4 ++-- .../gcc.target/arm/optional_thumb-2.c | 4 ++-- .../gcc.target/arm/optional_thumb-3.c | 4 ++-- gcc/testsuite/lib/target-supports.exp | 20 +++++++++++++++++++ 5 files changed, 36 insertions(+), 6 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fde93280263..cc98016025e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2017-01-20 Thomas Preud'homme + + * lib/target-supports.exp (check_configured_with): New procedure. + (check_effective_target_default_mode): new effective target. + * gcc.target/arm/optional_thumb-1.c: Skip if GCC was configured with a + default mode. Fix dg-skip-if target selector syntax. + * gcc.target/arm/optional_thumb-2.c: Likewise. + * gcc.target/arm/optional_thumb-3.c: Fix dg-skip-if target selector + syntax. + 2017-01-20 David Malcolm PR c++/77829 diff --git a/gcc/testsuite/gcc.target/arm/optional_thumb-1.c b/gcc/testsuite/gcc.target/arm/optional_thumb-1.c index 23df62887ba..99cb0c3f33b 100644 --- a/gcc/testsuite/gcc.target/arm/optional_thumb-1.c +++ b/gcc/testsuite/gcc.target/arm/optional_thumb-1.c @@ -1,5 +1,5 @@ -/* { dg-do compile } */ -/* { dg-skip-if "-marm/-mthumb/-march/-mcpu given" { *-*-*} { "-marm" "-mthumb" "-march=*" "-mcpu=*" } } */ +/* { dg-do compile { target { ! default_mode } } } */ +/* { dg-skip-if "-marm/-mthumb/-march/-mcpu given" { *-*-* } { "-marm" "-mthumb" "-march=*" "-mcpu=*" } } */ /* { dg-options "-march=armv6-m" } */ /* Check that -mthumb is not needed when compiling for a Thumb-only target. */ diff --git a/gcc/testsuite/gcc.target/arm/optional_thumb-2.c b/gcc/testsuite/gcc.target/arm/optional_thumb-2.c index 4bd53a45eca..280dfb3fec5 100644 --- a/gcc/testsuite/gcc.target/arm/optional_thumb-2.c +++ b/gcc/testsuite/gcc.target/arm/optional_thumb-2.c @@ -1,5 +1,5 @@ -/* { dg-do compile } */ -/* { dg-skip-if "-marm/-mthumb/-march/-mcpu given" { *-*-*} { "-marm" "-mthumb" "-march=*" "-mcpu=*" } } */ +/* { dg-do compile { target { ! default_mode } } } */ +/* { dg-skip-if "-marm/-mthumb/-march/-mcpu given" { *-*-* } { "-marm" "-mthumb" "-march=*" "-mcpu=*" } } */ /* { dg-options "-mcpu=cortex-m4" } */ /* Check that -mthumb is not needed when compiling for a Thumb-only target. */ diff --git a/gcc/testsuite/gcc.target/arm/optional_thumb-3.c b/gcc/testsuite/gcc.target/arm/optional_thumb-3.c index f1fd5c8840b..d9150e09e47 100644 --- a/gcc/testsuite/gcc.target/arm/optional_thumb-3.c +++ b/gcc/testsuite/gcc.target/arm/optional_thumb-3.c @@ -1,8 +1,8 @@ /* { dg-do compile } */ /* { dg-require-effective-target arm_cortex_m } */ -/* { dg-skip-if "-mthumb given" { *-*-*} { "-mthumb" } } */ +/* { dg-skip-if "-mthumb given" { *-*-* } { "-mthumb" } } */ /* { dg-options "-marm" } */ -/* { dg-error "target CPU does not support ARM mode" "missing error with -marm on Thumb-only targets" { target *-*-*} 0 } */ +/* { dg-error "target CPU does not support ARM mode" "missing error with -marm on Thumb-only targets" { target *-*-* } 0 } */ /* Check that -marm gives an error when compiling for a Thumb-only target. */ diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 12dbf475e31..e1d6dcbf088 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -252,6 +252,20 @@ proc check_runtime {prop args} { }] } +# Return 1 if GCC was configured with $pattern. +proc check_configured_with { pattern } { + global tool + + set gcc_output [${tool}_target_compile "-v" "" "none" ""] + if { [ regexp "Configured with: \[^\n\]*$pattern" $gcc_output ] } { + verbose "Matched: $pattern" 2 + return 1 + } + + verbose "Failed to match: $pattern" 2 + return 0 +} + ############################### # proc check_weak_available { } ############################### @@ -3817,6 +3831,12 @@ proc add_options_for_arm_arch_v7ve { flags } { return "$flags -march=armv7ve" } +# Return 1 if GCC was configured with --with-mode= +proc check_effective_target_default_mode { } { + + return [check_configured_with "with-mode="] +} + # Return 1 if this is an ARM target where -marm causes ARM to be # used (not Thumb) -- 2.30.2