From 16ca49cb40c3d34b3547b2e0834bb51ae26e2eb5 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Tue, 8 Aug 2023 13:53:39 -0400 Subject: [PATCH] Fixup Eric's WIP for dg-require-python-h --- .../gcc.dg/plugin/cpython-plugin-test-2.c | 4 +-- gcc/testsuite/lib/target-supports.exp | 28 +++++++++---------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/gcc/testsuite/gcc.dg/plugin/cpython-plugin-test-2.c b/gcc/testsuite/gcc.dg/plugin/cpython-plugin-test-2.c index 9eb411316bd..19b5c17428a 100644 --- a/gcc/testsuite/gcc.dg/plugin/cpython-plugin-test-2.c +++ b/gcc/testsuite/gcc.dg/plugin/cpython-plugin-test-2.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ -/* { dg-options "-fanalyzer" } */ -/* { dg-require-python-h } */ /* { dg-require-effective-target analyzer } */ +/* { dg-options "-fanalyzer" } */ +/* { dg-require-python-h "" } */ #define PY_SSIZE_T_CLEAN diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index a1d4f684f8e..99d62ab98ad 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -12560,27 +12560,25 @@ proc check_effective_target_const_volatile_readonly_section { } { return 1 } -proc dg-require-python-h { } { - puts "ENTER dg-require-python-h" ; +proc dg-require-python-h { args } { + upvar dg-extra-tool-flags extra-tool-flags + + verbose "ENTER dg-require-python-h" 2 + set result [remote_exec host "python3-config --cflags"] set status [lindex $result 0] if { $status == 0 } { set python_flags [lindex $result 1] } else { - set python_flags "UNSUPPORTED" + verbose "Python.h not supported" 2 + upvar dg-do-what dg-do-what + set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] + return } - - puts "Python flags are: $python_flags" ; - # Check if Python flags are unsupported - if { $python_flags eq "UNSUPPORTED" } { - puts "Python flags are unsupported" ; - error "Python flags are unsupported" - return - } + verbose "Python flags are: $python_flags" 2 - upvar dg-extra-tool-flags extra-tool-flags - puts "Before appending, extra-tool-flags: $extra-tool-flags" ; + verbose "Before appending, extra-tool-flags: ${extra-tool-flags}" 3 eval lappend extra-tool-flags $python_flags - puts "After appending, extra-tool-flags: $extra-tool-flags" ; -} \ No newline at end of file + verbose "After appending, extra-tool-flags: ${extra-tool-flags}" 3 +} -- 2.26.3