return 0
}
+# Some tests require GCC.
+set gcc_compiled [is_c_compiler_gcc]
+
standard_testfile .c
# Using `-gctf` generates full-fledged CTF debug information.
return 0
}
-# Create and source the file that provides information about the compiler
-# used to compile the test case.
-if [get_compiler_info] {
- return -1
-}
-
# Test ptype of unnamed enumeration members before any action causes
# the partial symbol table to be expanded to full symbols. This fails
# with stabs compilers which fail to use a nameless stab (such as
standard_testfile
+set gcc_compiled [is_c_compiler_gcc]
+
set compile_flags {debug nowarnings quiet}
if [support_complex_tests] {
lappend compile_flags "additional_flags=-DTEST_COMPLEX"
}
-# Create and source the file that provides information about the compiler
-# used to compile the test case.
-if [get_compiler_info] {
- return -1
-}
-
set skip_float_test [gdb_skip_float_test]
if {[prepare_for_testing "failed to prepare" $testfile $srcfile $compile_flags]} {
remote_exec build "rm -f ${binfile}"
-# get the value of gcc_compiled
-if [get_compiler_info] {
- return -1
-}
-
if { [gdb_compile_shlib $libsrc $libobj {debug}] != ""
|| [gdb_compile $execsrc ${binfile} executable \
[list debug shlib=${libobj}]] != "" } {
set oldtimeout $timeout
set timeout 10
-
-
-# Create and source the file that provides information about the compiler
-# used to compile the test case.
-if [get_compiler_info] {
- return -1
-}
+# Some tests require GCC.
+set gcc_compiled [is_c_compiler_gcc]
gdb_test_multiple "b -qualified langs0" "break on nonexistent function in langs.exp" {
-re "Function \"langs0\" not defined\..*Make breakpoint pending on future shared library load.*y or .n.. $" {
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-if [get_compiler_info] {
- return -1
-}
-
-if {$gcc_compiled == 0} {
- return -1
+if {![is_c_compiler_gcc]} {
+ unsupported "gcc compiler is required"
+ return
}
standard_testfile
# This file was written by Fred Fish. (fnf@cygnus.com)
-
-# Create and source the file that provides information about the compiler
-# used to compile the test case.
-if [get_compiler_info] {
- return -1
-}
-
standard_testfile opaque0.c opaque1.c
+# Some tests require GCC.
+set gcc_compiled [is_c_compiler_gcc]
+
if {[prepare_for_testing "failed to prepare" $testfile \
[list $srcfile $srcfile2] debug]} {
return -1
return
}
-if [get_compiler_info] {
- return -1
-}
-
-if {$gcc_compiled == 0} {
+if {![is_c_compiler_gcc]} {
+ unsupported "gcc compiler is required"
return -1
}
return -1
}
-# Create and source the file that provides information about the compiler
-# used to compile the test case.
-if [get_compiler_info] {
- return -1
-}
+# Some tests require GCC.
+set gcc_compiled [is_c_compiler_gcc]
# Test ptype of unnamed enumeration members before any action causes
# the partial symbol table to be expanded to full symbols. This fails
standard_testfile
-# Create and source the file that provides information about the compiler
-# used to compile the test case.
-if [get_compiler_info] {
- return -1
-}
-
if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
return -1
}
# Test printing of enumeration bitfields.
# GNU C supports them, some other compilers don't.
-if {$gcc_compiled} then {
+if {[is_c_compiler_gcc]} then {
gdb_test "print sef.field=sm1" ".*.\[0-9\]* = sm1"
gdb_test "print sef.field" ".*.\[0-9\]* = sm1" "print sef.field (sm1)"
gdb_test "print sef.field=s1" ".*.\[0-9\]* = s1"
remote_exec build "rm -f ${binfile}"
-# get the value of gcc_compiled
-if [get_compiler_info] {
- return -1
-}
-
if { [gdb_compile_shlib $libsrc $libobj {debug}] != ""
|| [gdb_compile $execsrc ${binfile} executable \
[list debug shlib=${libobj}]] != "" } {
return 0
}
-if [get_compiler_info] {
- return -1
-}
-
# The DWARF assembler requires the gcc compiler.
-if {!$gcc_compiled} {
+if {![is_c_compiler_gcc]} {
unsupported "gcc is required for this test"
return 0
}
set exec_opts [list debug]
}
+# Some tests require GCC.
+set gcc_compiled [is_c_compiler_gcc]
+
standard_testfile .c
# Define a procedure to set up an xfail for all targets that put out a
set exec_opts [list debug]
}
+# Some tests require GCC.
+set gcc_compiled [is_c_compiler_gcc]
+
standard_testfile whatis.c
# Using `-gctf` generates full-fledged CTF debug information.
return 0
}
-# Create and source the file that provides information about the compiler
-# used to compile the test case.
-if [get_compiler_info] {
- return -1
-}
-
# test print command with functions return type
set void "(void|)"
gdb_test "print v_char_func" \
}
# The .c files use __attribute__.
-if [get_compiler_info] {
- return -1
-}
-if !$gcc_compiled {
+if ![is_c_compiler_gcc] {
return 0
}
}
# The .c files use __attribute__.
-if [get_compiler_info] {
- return -1
-}
-if !$gcc_compiled {
+if ![is_c_compiler_gcc] {
return 0
}
}
# The .c files use __attribute__.
-if [get_compiler_info] {
- return -1
-}
-if !$gcc_compiled {
+if ![is_c_compiler_gcc] {
return 0
}
}
# The .c files use __attribute__.
-if [get_compiler_info] {
- return -1
-}
-if !$gcc_compiled {
+if ![is_c_compiler_gcc] {
return 0
}
}
# The .c files use __attribute__.
-if [get_compiler_info] {
- return -1
-}
-if !$gcc_compiled {
+if ![is_c_compiler_gcc] {
return 0
}
}
# The .c files use __attribute__.
-if [get_compiler_info] {
- return -1
-}
-if !$gcc_compiled {
+if ![is_c_compiler_gcc] {
return 0
}
}
# The .c files use __attribute__.
-if [get_compiler_info] {
- return -1
-}
-if !$gcc_compiled {
+if ![is_c_compiler_gcc] {
return 0
}
}
# The .c files use __attribute__.
-if [get_compiler_info] {
- return -1
-}
-if !$gcc_compiled {
+if ![is_c_compiler_gcc] {
return 0
}
}
# The .c files use __attribute__.
-if [get_compiler_info] {
- return -1
-}
-if !$gcc_compiled {
+if ![is_c_compiler_gcc] {
return 0
}
}
# The .c files use __attribute__.
-if [get_compiler_info] {
- return -1
-}
-if !$gcc_compiled {
+if ![is_c_compiler_gcc] {
verbose "Skipping $gdb_test_file_name."
return 0
}
}
# The .c files use __attribute__.
-if [get_compiler_info] {
- return -1
-}
-if !$gcc_compiled {
+if ![is_c_compiler_gcc] {
verbose "Skipping $gdb_test_file_name."
return 0
}
}
# The .c files use __attribute__.
-if [get_compiler_info] {
- return -1
-}
-if !$gcc_compiled {
+if ![is_c_compiler_gcc] {
verbose "Skipping $gdb_test_file_name."
return 0
}
}
# The .c files use __attribute__.
-if [get_compiler_info] {
- return -1
-}
-if !$gcc_compiled {
+if ![is_c_compiler_gcc] {
verbose "Skipping $gdb_test_file_name."
return 0
}
return 0
}
-if [get_compiler_info] {
- return -1
-}
-if !$gcc_compiled {
+if ![is_c_compiler_gcc] {
unsupported "gcc required for this test"
return 0
}
}
# The .c files use __attribute__.
-if [get_compiler_info] {
- return -1
-}
-if !$gcc_compiled {
+if ![is_c_compiler_gcc] {
verbose "Skipping $gdb_test_file_name."
return 0
}
return 0
}
-if [get_compiler_info] {
- return -1
-}
-if !$gcc_compiled {
+if ![is_c_compiler_gcc] {
unsupported "gcc required for this test"
return 0
}
}
# The .c files use __attribute__.
-if [get_compiler_info] {
- return -1
-}
-if !$gcc_compiled {
+if ![is_c_compiler_gcc] {
verbose "Skipping $gdb_test_file_name."
return 0
}
}
# The .c files use __attribute__.
-if [get_compiler_info] {
- return -1
-}
-if !$gcc_compiled {
+if ![is_c_compiler_gcc] {
verbose "Skipping $gdb_test_file_name."
return 0
}
}
# The .c files use __attribute__.
-if [get_compiler_info] {
- return -1
-}
-if !$gcc_compiled {
+if ![is_c_compiler_gcc] {
verbose "Skipping $gdb_test_file_name."
return 0
}
}
# The .c files use __attribute__.
-if [get_compiler_info] {
- return -1
-}
-if !$gcc_compiled {
+if ![is_c_compiler_gcc] {
return 0
}
remote_exec build "rm -f ${binfile}"
-# get the value of gcc_compiled
-if [get_compiler_info] {
- return -1
-}
-
-
if { [gdb_compile_shlib_pthreads ${srcdir}/${subdir}/${srcfile_lib} ${binfile_lib} {debug}] != ""
|| [gdb_compile_pthreads ${srcdir}/${subdir}/${srcfile} ${binfile} executable [list debug shlib=${binfile_lib}]] != ""} {
return -1
set binfile_lib [standard_output_file ${libfile}.so]
-# get the value of gcc_compiled
-if [get_compiler_info] {
- return -1
-}
-
-
if { [gdb_compile_shlib_pthreads ${srcdir}/${subdir}/${srcfile_lib} ${binfile_lib} {debug}] != ""
|| [gdb_compile_pthreads ${srcdir}/${subdir}/${srcfile} ${binfile} executable [list debug shlib=${binfile_lib}]] != ""} {
return -1
TODO: make compiler_info a local variable for get_compiler_info and
test_compiler_info.
- TODO: all clients should use test_compiler_info and should not
- use gcc_compiled.
-
*/
set compiler_info "unknown"
unset compiler_info
}
-set gcc_compiled 0
-
# Figure out what compiler I am using.
# The result is cached so only the first invocation runs the compiler.
#
set compiler_info_cache($language) $compiler_info
- # Set the legacy symbol gcc_compiled.
- if { $language == "c" } {
- # Legacy global data symbols.
- gdb_persistent_global gcc_compiled
-
- set gcc_compiled 0
-
- regexp "^gcc-(\[0-9\]+)-" "$compiler_info" matchall gcc_compiled
- }
-
# Log what happened.
verbose -log "get_compiler_info: $compiler_info"
return [string match $compiler $compiler_info_cache($language)]
}
+# Return true if the C compiler is GCC, otherwise, return false.
+
+proc is_c_compiler_gcc {} {
+ set compiler_info [test_compiler_info]
+ set gcc_compiled false
+ regexp "^gcc-(\[0-9\]+)-" "$compiler_info" matchall gcc_compiled
+ return $gcc_compiled
+}
+
# Return the gcc major version, or -1.
# For gcc 4.8.5, the major version is 4.8.
# For gcc 7.5.0, the major version 7.