summaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorCristian Sandu <cristian.sandu@intel.com>2022-05-31 16:43:44 +0200
committerNils-Christian Kempke <nils-christian.kempke@intel.com>2022-05-31 16:44:54 +0200
commit44d469c5f85a4243462b8966722dafa62b602bf5 (patch)
tree89b8401b36dd3ff9f87f25bc926aa74bbabe09c1 /gdb/testsuite
parent7ce4a6d1846fae44b25c1733164451a316f22567 (diff)
gdb/testsuite: add Fortran compiler identification to GDB
This commit adds a separate Fortran compiler identification mechanism to the testsuite, similar to the existing one for C/C++. Before this change, the options and version for the Fortran compiler specified when running the testsuite with F90_FOR_TARGET set, was detected via its respective C compiler. So running the testsuite as make check TEST=gdb.fortran/*.exp CC_FOR_TARGET=gcc F90_FOR_TARGET=ifx or even make check TEST=gdb.fortran/*.exp F90_FOR_TARGET=ifx would use the gcc compiler inside the procedures get_compiler_info and test_compiler_info to identify compiler flags and the compiler version. This could sometimes lead to unpredictable outputs. It also limited testsuite execution to combinations where C and Fortran compiler would come from the same family of compiers (gcc/gfortran, icc/ifort, icx/ifx, clang/flang ..). This commit enables GDB to detect C and Fortran compilers independently of each other. As most/nearly all Fortran compilers have a mechanism for preprocessing files in a C like fashion we added the exact same meachnism that already existed for C/CXX. We let GDB preprocess a file with the compilers Fortran preprocessor and evaluate the preprocessor defined macros in that file. This enables GDB to properly run heterogeneous combinations of C and Fortran compilers such as CC_FOR_TARGET='gcc' and F90_FOR_TARGET='ifort' or enables one to run the testsuite without specifying a C compiler as in make check TESTS=gdb.fortran/*.exp F90_FOR_TARGET='ifx' make check TESTS=gdb.fortran/*.exp F90_FOR_TARGET='flang' On the other hand this also requires one to always specify a identification mechanism for Fortran compilers in the compiler.F90 file. We added identification for GFORTRAN, FLANG (CLASSIC and LLVM) IFX, IFORT, and ARMFLANG for now. Classic and LLVM flang were each tested with their latest releases on their respective release pages. Both get recognized by the new compiler identification and we introduced the two names flang-classic and flang-llvm to distinguish the two. While LLVM flang is not quite mature enough yet for running the testsuite we still thought it would be a good idea to include it already. For this we added a case for the fortran_main procedure. LLVM flang uses 'MAIN__' as opposed to classic flang which uses 'MAIN_' here. We did not have the possibility to test ARMFLANG - the versioning scheme here was extracted from its latest online documentation. We changed the test_compiler_info procedure to take another optional argument, the language string, which will be passed though to the get_compiler_info procedure. Passing 'f90' or 'c++' here will then trigger the C++/Fortran compiler identification within get_compiler_info. The latter procedure was extended to also handle the 'f90' argument (similarly to the already existing 'c++' one). Co-authored-by: Nils-Christian Kempke <nils-christian.kempke@intel.com>
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/gdb.fortran/assumedrank.exp6
-rw-r--r--gdb/testsuite/gdb.fortran/class-allocatable-array.exp4
-rw-r--r--gdb/testsuite/gdb.fortran/derived-type-striding.exp2
-rw-r--r--gdb/testsuite/gdb.fortran/library-module.exp2
-rw-r--r--gdb/testsuite/gdb.fortran/namelist.exp2
-rw-r--r--gdb/testsuite/gdb.fortran/nested-funcs-2.exp3
-rw-r--r--gdb/testsuite/gdb.fortran/ptype-on-functions.exp6
-rwxr-xr-xgdb/testsuite/gdb.fortran/vla-type.exp2
-rw-r--r--gdb/testsuite/lib/compiler.F9069
-rw-r--r--gdb/testsuite/lib/fortran.exp100
-rw-r--r--gdb/testsuite/lib/gdb.exp24
11 files changed, 150 insertions, 70 deletions
diff --git a/gdb/testsuite/gdb.fortran/assumedrank.exp b/gdb/testsuite/gdb.fortran/assumedrank.exp
index e9429b44a9..37bb825d16 100644
--- a/gdb/testsuite/gdb.fortran/assumedrank.exp
+++ b/gdb/testsuite/gdb.fortran/assumedrank.exp
@@ -21,8 +21,8 @@ standard_testfile ".f90"
load_lib fortran.exp
# Only gcc version >=11 supports assumed rank arrays.
-if { [test_compiler_info gcc*] &&
- ![test_compiler_info {gcc-1[1-9]-*}]} {
+if { [test_compiler_info {gfortran-*} f90] &&
+ ![test_compiler_info {gfortran-1[1-9]-*} f90] } {
untested "compiler does not support assumed rank"
return -1
}
@@ -59,7 +59,7 @@ while { $test_count < 500 } {
}
# Currently, flang does not support rank0.
- if {$test_count == 1 && [test_compiler_info {clang-*}]} {
+ if { $test_count == 1 && [test_compiler_info {flang-*} f90] } {
unsupported "compiler does not support rank 0"
continue
}
diff --git a/gdb/testsuite/gdb.fortran/class-allocatable-array.exp b/gdb/testsuite/gdb.fortran/class-allocatable-array.exp
index 3e92f804b1..30bdcb0165 100644
--- a/gdb/testsuite/gdb.fortran/class-allocatable-array.exp
+++ b/gdb/testsuite/gdb.fortran/class-allocatable-array.exp
@@ -37,8 +37,8 @@ gdb_continue_to_breakpoint "Break Here"
# different names, or maybe a completely different approach, for
# representing class like structures. The following tests are
# cetainly going to fail.
-# Hence the test case is modified for clang.
-if {[test_compiler_info {clang-*}]} {
+# Hence the test case is modified for flang.
+if { [test_compiler_info {flang-*} f90] } {
gdb_test "print this" " = \\( a = 0, b = \\(\\(1, 2, 3\\) \\(4, 5, 6\\)\\) \\)"
gdb_test "print this%a" " = 0"
gdb_test "print this%b" " = \\(\\(1, 2, 3\\) \\(4, 5, 6\\)\\)"
diff --git a/gdb/testsuite/gdb.fortran/derived-type-striding.exp b/gdb/testsuite/gdb.fortran/derived-type-striding.exp
index f8062b5657..1edc489bcf 100644
--- a/gdb/testsuite/gdb.fortran/derived-type-striding.exp
+++ b/gdb/testsuite/gdb.fortran/derived-type-striding.exp
@@ -22,7 +22,7 @@ standard_testfile ".f90"
# Unfortunately recent versions of GCC broke the stride information in
# the DEBUG so tests in this file will fail.
-set gcc_with_broken_stride [test_compiler_info {gcc-[89]-*}]
+set gcc_with_broken_stride [test_compiler_info {gfortran-[89]-*} f90]
if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
{debug f90}]} {
diff --git a/gdb/testsuite/gdb.fortran/library-module.exp b/gdb/testsuite/gdb.fortran/library-module.exp
index 09013b0544..a28dc3634c 100644
--- a/gdb/testsuite/gdb.fortran/library-module.exp
+++ b/gdb/testsuite/gdb.fortran/library-module.exp
@@ -22,7 +22,7 @@ set srclibfile ${testfile}-lib.f90
set libfile [standard_output_file ${testfile}-lib.so]
# Required for -fPIC by gdb_compile_shlib.
-if [get_compiler_info] {
+if { [get_compiler_info f90] } {
warning "Could not get compiler info"
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/namelist.exp b/gdb/testsuite/gdb.fortran/namelist.exp
index c7c92c1349..3917f1b9ad 100644
--- a/gdb/testsuite/gdb.fortran/namelist.exp
+++ b/gdb/testsuite/gdb.fortran/namelist.exp
@@ -37,7 +37,7 @@ set int [fortran_int4]
gdb_breakpoint [gdb_get_line_number "Display namelist"]
gdb_continue_to_breakpoint "Display namelist"
-if {[test_compiler_info {gcc-*}]} {
+if { [test_compiler_info {gfortran-*} f90] } {
gdb_test "ptype nml" \
"type = Type nml\r\n *$int :: a\r\n *$int :: b\r\n *End Type nml"
gdb_test "print nml" \
diff --git a/gdb/testsuite/gdb.fortran/nested-funcs-2.exp b/gdb/testsuite/gdb.fortran/nested-funcs-2.exp
index 3c8a5364ef..bf679447c0 100644
--- a/gdb/testsuite/gdb.fortran/nested-funcs-2.exp
+++ b/gdb/testsuite/gdb.fortran/nested-funcs-2.exp
@@ -68,7 +68,8 @@ proc do_bp_tests {with_src_prefix_p with_nest_prefix_p} {
# mangling.
proc get_linkage_name_pattern {symbol_name} {
- if { [test_compiler_info icc*] || [test_compiler_info intel*]} {
+ if { [test_compiler_info {ifort-*} f90]
+ || [test_compiler_info {ifx-*} f90] } {
return "\(?:.*_\)?${symbol_name}_?"
} else {
return ${symbol_name}
diff --git a/gdb/testsuite/gdb.fortran/ptype-on-functions.exp b/gdb/testsuite/gdb.fortran/ptype-on-functions.exp
index 8c49781053..cc2454858a 100644
--- a/gdb/testsuite/gdb.fortran/ptype-on-functions.exp
+++ b/gdb/testsuite/gdb.fortran/ptype-on-functions.exp
@@ -40,7 +40,7 @@ set integer8 [fortran_int8]
# https://gcc.gnu.org/onlinedocs/gfortran/Argument-passing-conventions.html ).
set stringlen ($integer8|$integer4)
-if {[test_compiler_info {clang-*}]} {
+if { [test_compiler_info {flang-*} f90] } {
set some_module_class_type "Type number"
set some_module_aux_info ", $integer8 \\(10\\)"
} else {
@@ -61,7 +61,7 @@ gdb_test "ptype say_numbers" \
"type = void \\($integer4, $integer4, $integer4\\)"
set fun_ptr_arg "$integer4"
-if {[test_compiler_info {gcc-*}]} {
+if { [test_compiler_info {gfortran-*} f90] } {
set fun_ptr_arg "REF TO -> \\( ${fun_ptr_arg} \\)"
}
@@ -72,7 +72,7 @@ gdb_test "ptype say_string" \
"type = void \\(character\[^,\]+, $stringlen\\)"
set say_array_artificial_first_arg ""
-if {[test_compiler_info {clang-*}]} {
+if { [test_compiler_info {flang-*} f90] } {
set say_array_artificial_first_arg "$integer8, "
}
diff --git a/gdb/testsuite/gdb.fortran/vla-type.exp b/gdb/testsuite/gdb.fortran/vla-type.exp
index 4ec68c4760..fc8494fe36 100755
--- a/gdb/testsuite/gdb.fortran/vla-type.exp
+++ b/gdb/testsuite/gdb.fortran/vla-type.exp
@@ -33,7 +33,7 @@ set int [fortran_int4]
# Check if not allocated VLA in type does not break
# the debugger when accessing it.
# break main for Flang compiler already breaks here
-if ![test_compiler_info "clang-*"] {
+if { ![test_compiler_info {flang-*} f90] } {
gdb_breakpoint [gdb_get_line_number "before-allocated"]
gdb_continue_to_breakpoint "before-allocated"
}
diff --git a/gdb/testsuite/lib/compiler.F90 b/gdb/testsuite/lib/compiler.F90
new file mode 100644
index 0000000000..71cf3d2c2b
--- /dev/null
+++ b/gdb/testsuite/lib/compiler.F90
@@ -0,0 +1,69 @@
+/* Copyright 2022 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+set compiler_info "unknown"
+
+#if defined (__GFORTRAN__)
+set compiler_info [join {gfortran __GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__} -]
+#endif
+
+/* ARM seems to not define a patch version. */
+#if defined (__ARM_LINUX_COMPILER__)
+set compiler_info [join {armflang __armclang_major__ __armclang_minor__ 0} -]
+#endif
+
+/* Classic flang and LLVM flang emit their respective macros differently. */
+
+/* LLVM flang complains about non Fortran tokens so we do not use "{" here. */
+#if defined (__flang__)
+set major __flang_major__
+set minor __flang_minor__
+set patch __flang_patchlevel__
+set compiler_info [join "flang-llvm $major $minor $patch" -]
+#endif
+
+/* Classic Flang. */
+#if defined (__FLANG)
+set compiler_info [join {flang-classic __FLANG_MAJOR__ __FLANG_MINOR__ __FLANG_PATCHLEVEL__} -]
+#endif
+
+/* Intel LLVM emits a string like 20220100 with version 2021.2.0 and higher. */
+#if defined (__INTEL_LLVM_COMPILER)
+set major [string range __INTEL_LLVM_COMPILER 0 3]
+set minor [string range __INTEL_LLVM_COMPILER 4 5]
+set patch [string range __INTEL_LLVM_COMPILER 6 7]
+set compiler_info [join "ifx $major $minor $patch" -]
+#elif defined (__INTEL_COMPILER)
+/* Starting with 2021 the ifort versioning scheme changed. Before, Intel ifort
+ would define its version as e.g. 19.0.0 or rather __INTEL_COMPILER would be
+ emitted as 1900. With 2021 the versioning became e.g. 2021.1 defined in
+ __INTEL_COMPILER.__INTEL_COMPILER_UPDATE. No patch is emitted since the
+ change. This compiler identification might not work with ifort versions
+ smaller than 10. */
+#if (__INTEL_COMPILER < 2021)
+set major [string range __INTEL_COMPILER 0 1]
+set minor [string range __INTEL_COMPILER 2 2]
+#if defined (__INTEL_COMPILER_UPDATE)
+set patch __INTEL_COMPILER_UPDATE
+#else
+set patch [string range __INTEL_COMPILER 3 3]
+#endif
+#else
+set major __INTEL_COMPILER
+set minor __INTEL_COMPILER_UPDATE
+set patch 0
+#endif
+set compiler_info [join "ifort $major $minor $patch" -]
+#endif
diff --git a/gdb/testsuite/lib/fortran.exp b/gdb/testsuite/lib/fortran.exp
index 9531d393a1..9ee4208fb8 100644
--- a/gdb/testsuite/lib/fortran.exp
+++ b/gdb/testsuite/lib/fortran.exp
@@ -30,15 +30,15 @@ proc set_lang_fortran {} {
}
proc fortran_int4 {} {
- if {[test_compiler_info {gcc-4-[012]-*}]} {
+ if {[test_compiler_info {gfortran-4-[012]-*} f90]} {
return "int4"
- } elseif {[test_compiler_info {gcc-*}]} {
+ } elseif {[test_compiler_info {gfortran-*} f90]} {
return "integer\\(kind=4\\)"
- } elseif {[test_compiler_info {clang-*}]} {
+ } elseif {[test_compiler_info {flang-*} f90]} {
return "integer"
- } elseif {[test_compiler_info {icc-*}]} {
+ } elseif {[test_compiler_info {ifort-*} f90]} {
return "INTEGER\\(4\\)"
- } elseif {[test_compiler_info {intel-*}]} {
+ } elseif {[test_compiler_info {ifx-*} f90]} {
return "INTEGER\\*4"
} else {
return "unknown"
@@ -46,15 +46,15 @@ proc fortran_int4 {} {
}
proc fortran_int8 {} {
- if {[test_compiler_info {gcc-4-[012]-*}]} {
+ if {[test_compiler_info {gfortran-4-[012]-*} f90]} {
return "int8"
- } elseif {[test_compiler_info {gcc-*}]} {
+ } elseif {[test_compiler_info {gfortran-*} f90]} {
return "integer\\(kind=8\\)"
- } elseif {[test_compiler_info {clang-*}]} {
+ } elseif {[test_compiler_info {flang-*} f90]} {
return "integer\\*8"
- } elseif {[test_compiler_info {icc-*}]} {
+ } elseif {[test_compiler_info {ifort-*} f90]} {
return "INTEGER\\(8\\)"
- } elseif {[test_compiler_info {intel-*}]} {
+ } elseif {[test_compiler_info {ifx-*} f90]} {
return "INTEGER\\*8"
} else {
return "unknown"
@@ -62,15 +62,15 @@ proc fortran_int8 {} {
}
proc fortran_real4 {} {
- if {[test_compiler_info {gcc-4-[012]-*}]} {
+ if {[test_compiler_info {gfortran-4-[012]-*} f90]} {
return "real4"
- } elseif {[test_compiler_info {gcc-*}]} {
+ } elseif {[test_compiler_info {gfortran-*} f90]} {
return "real\\(kind=4\\)"
- } elseif {[test_compiler_info {clang-*}]} {
+ } elseif {[test_compiler_info {flang-*} f90]} {
return "real"
- } elseif {[test_compiler_info {icc-*}]} {
+ } elseif {[test_compiler_info {ifort-*} f90]} {
return "REAL\\(4\\)"
- } elseif {[test_compiler_info {intel-*}]} {
+ } elseif {[test_compiler_info {ifx-*} f90]} {
return "REAL\\*4"
} else {
return "unknown"
@@ -78,15 +78,15 @@ proc fortran_real4 {} {
}
proc fortran_real8 {} {
- if {[test_compiler_info {gcc-4-[012]-*}]} {
+ if {[test_compiler_info {gfortran-4-[012]-*} f90]} {
return "real8"
- } elseif {[test_compiler_info {gcc-*}]} {
+ } elseif {[test_compiler_info {gfortran-*} f90]} {
return "real\\(kind=8\\)"
- } elseif {[test_compiler_info {clang-*}]} {
+ } elseif {[test_compiler_info {flang-*} f90]} {
return "double precision"
- } elseif {[test_compiler_info {icc-*}]} {
+ } elseif {[test_compiler_info {ifort-*} f90]} {
return "REAL\\(8\\)"
- } elseif {[test_compiler_info {intel-*}]} {
+ } elseif {[test_compiler_info {ifx-*} f90]} {
return "REAL\\*8"
} else {
return "unknown"
@@ -94,15 +94,15 @@ proc fortran_real8 {} {
}
proc fortran_complex4 {} {
- if {[test_compiler_info {gcc-4-[012]-*}]} {
+ if {[test_compiler_info {gfortran-4-[012]-*} f90]} {
return "complex4"
- } elseif {[test_compiler_info {gcc-*}]} {
+ } elseif {[test_compiler_info {gfortran-*} f90]} {
return "complex\\(kind=4\\)"
- } elseif {[test_compiler_info {clang-*}]} {
+ } elseif {[test_compiler_info {flang-*} f90]} {
return "complex"
- } elseif {[test_compiler_info {icc-*}]} {
+ } elseif {[test_compiler_info {ifort-*} f90]} {
return "COMPLEX\\(4\\)"
- } elseif {[test_compiler_info {intel-*}]} {
+ } elseif {[test_compiler_info {ifx-*} f90]} {
return "COMPLEX\\*8"
} else {
return "unknown"
@@ -110,15 +110,15 @@ proc fortran_complex4 {} {
}
proc fortran_complex8 {} {
- if {[test_compiler_info {gcc-4-[012]-*}]} {
+ if {[test_compiler_info {gfortran-4-[012]-*} f90]} {
return "complex8"
- } elseif {[test_compiler_info {gcc-*}]} {
+ } elseif {[test_compiler_info {gfortran-*} f90]} {
return "complex\\(kind=8\\)"
- } elseif {[test_compiler_info {clang-*}]} {
+ } elseif {[test_compiler_info {flang-*} f90]} {
return "double complex"
- } elseif {[test_compiler_info {icc-*}]} {
+ } elseif {[test_compiler_info {ifort-*} f90]} {
return "COMPLEX\\(8\\)"
- } elseif {[test_compiler_info {intel-*}]} {
+ } elseif {[test_compiler_info {ifx-*} f90]} {
return "COMPLEX\\*16"
} else {
return "unknown"
@@ -126,15 +126,15 @@ proc fortran_complex8 {} {
}
proc fortran_complex16 {} {
- if {[test_compiler_info {gcc-4-[012]-*}]} {
+ if {[test_compiler_info {gfortran-4-[012]-*} f90]} {
return "complex16"
- } elseif {[test_compiler_info {gcc-*}]} {
+ } elseif {[test_compiler_info {gfortran-*} f90]} {
return "complex\\(kind=16\\)"
- } elseif {[test_compiler_info {clang-*}]} {
+ } elseif {[test_compiler_info {flang-*} f90]} {
return "quad complex"
- } elseif {[test_compiler_info {icc-*}]} {
+ } elseif {[test_compiler_info {ifort-*} f90]} {
return "COMPLEX\\(16\\)"
- } elseif {[test_compiler_info {intel-*}]} {
+ } elseif {[test_compiler_info {ifx-*} f90]} {
return "COMPLEX\\*32"
} else {
return "unknown"
@@ -142,15 +142,15 @@ proc fortran_complex16 {} {
}
proc fortran_logical4 {} {
- if {[test_compiler_info {gcc-4-[012]-*}]} {
+ if {[test_compiler_info {gfortran-4-[012]-*} f90]} {
return "logical4"
- } elseif {[test_compiler_info {gcc-*}]} {
+ } elseif {[test_compiler_info {gfortran-*} f90]} {
return "logical\\(kind=4\\)"
- } elseif {[test_compiler_info {clang-*}]} {
+ } elseif {[test_compiler_info {flang-*} f90]} {
return "logical"
- } elseif {[test_compiler_info {icc-*}]} {
+ } elseif {[test_compiler_info {ifort-*} f90]} {
return "LOGICAL\\(4\\)"
- } elseif {[test_compiler_info {intel-*}]} {
+ } elseif {[test_compiler_info {ifx-*} f90]} {
return "LOGICAL\\*4"
} else {
return "unknown"
@@ -158,15 +158,15 @@ proc fortran_logical4 {} {
}
proc fortran_character1 {} {
- if {[test_compiler_info {gcc-4-[012]-*}]} {
+ if {[test_compiler_info {gfortran-4-[012]-*} f90]} {
return "character1"
- } elseif {[test_compiler_info {gcc-*}]} {
+ } elseif {[test_compiler_info {gfortran-*} f90]} {
return "character\\(kind=1\\)"
- } elseif {[test_compiler_info {clang-*}]} {
+ } elseif {[test_compiler_info {flang-*} f90]} {
return "character"
- } elseif {[test_compiler_info {icc-*}]} {
+ } elseif {[test_compiler_info {ifort-*} f90]} {
return "CHARACTER\\(1\\)"
- } elseif {[test_compiler_info {intel-*}]} {
+ } elseif {[test_compiler_info {ifx-*} f90]} {
return "CHARACTER\\*1"
} else {
return "unknown"
@@ -176,12 +176,12 @@ proc fortran_character1 {} {
# Return name of the main procedure based on the compiler version.
proc fortran_main {} {
- if {[test_compiler_info {gcc-4-[012]-*}]
- || [test_compiler_info {gcc-*}]
- || [test_compiler_info {icc-*}]
- || [test_compiler_info {intel-*}]} {
+ if {[test_compiler_info {gfortran-*} f90]
+ || [test_compiler_info {ifort-*} f90]
+ || [test_compiler_info {ifx-*} f90]
+ || [test_compiler_info {flang-llvm-*} f90]} {
return "MAIN__"
- } elseif {[test_compiler_info {clang-*}]} {
+ } elseif {[test_compiler_info {flang-classic-*} f90]} {
return "MAIN_"
} else {
return "unknown"
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 381367ee6c..87f0a36fe7 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -4106,14 +4106,14 @@ set gcc_compiled 0
# -- chastain 2004-01-06
proc get_compiler_info {{arg ""}} {
- # For compiler.c and compiler.cc
+ # For compiler.c, compiler.cc and compiler.F90.
global srcdir
# I am going to play with the log to keep noise out.
global outdir
global tool
- # These come from compiler.c or compiler.cc
+ # These come from compiler.c, compiler.cc or compiler.F90.
global compiler_info
# Legacy global data symbols.
@@ -4128,6 +4128,8 @@ proc get_compiler_info {{arg ""}} {
set ifile "${srcdir}/lib/compiler.c"
if { $arg == "c++" } {
set ifile "${srcdir}/lib/compiler.cc"
+ } elseif { $arg == "f90" } {
+ set ifile "${srcdir}/lib/compiler.F90"
}
# Run $ifile through the right preprocessor.
@@ -4158,6 +4160,10 @@ proc get_compiler_info {{arg ""}} {
# eval this line
verbose "get_compiler_info: $cppline" 2
eval "$cppline"
+ } elseif { [ regexp "flang.*warning.*'-fdiagnostics-color=never'" "$cppline"] } {
+ # Both flang preprocessors (llvm flang and classic flang) print a
+ # warning for the unused -fdiagnostics-color=never, so we skip this
+ # output line here.
} else {
# unknown line
verbose -log "get_compiler_info: $cppline"
@@ -4195,9 +4201,9 @@ proc get_compiler_info {{arg ""}} {
# Otherwise the argument is a glob-style expression to match against
# compiler_info.
-proc test_compiler_info { {compiler ""} } {
+proc test_compiler_info { {compiler ""} {language ""} } {
global compiler_info
- get_compiler_info
+ get_compiler_info $language
# If no arg, return the compiler_info string.
if [string match "" $compiler] {
@@ -4470,10 +4476,10 @@ proc gdb_compile {source dest type options} {
if { !$getting_compiler_info && [lsearch -exact $options f90] != -1 } {
# Fortran compile.
set mod_path [standard_output_file ""]
- if [test_compiler_info "gcc-*"] {
+ if { [test_compiler_info {gfortran-*} f90] } {
lappend new_options "additional_flags=-J${mod_path}"
- } elseif { [test_compiler_info {icc-*}]
- || [test_compiler_info {intel-*}] } {
+ } elseif { [test_compiler_info {ifort-*} f90]
+ || [test_compiler_info {ifx-*} f90] } {
lappend new_options "additional_flags=-module ${mod_path}"
}
}
@@ -4770,6 +4776,8 @@ proc gdb_compile_shlib_1 {sources dest options} {
set info_options ""
if { [lsearch -exact $options "c++"] >= 0 } {
set info_options "c++"
+ } elseif { [lsearch -exact $options "f90"] >= 0 } {
+ set info_options "f90"
}
if [get_compiler_info ${info_options}] {
return -1
@@ -6957,6 +6965,8 @@ proc build_executable_from_specs {testname executable options args} {
set info_options ""
if { [lsearch -exact $options "c++"] >= 0 } {
set info_options "c++"
+ } elseif { [lsearch -exact $options "f90"] >= 0 } {
+ set info_options "f90"
}
if [get_compiler_info ${info_options}] {
return -1