[PATCH 05/18] gdb/testsuite: add Fortran compiler identification to GDB
Nils-Christian Kempke
nils-christian.kempke@intel.com
Tue May 10 14:24:24 GMT 2022
From: Cristian Sandu <cristian.sandu@intel.com>
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>
---
gdb/testsuite/gdb.fortran/assumedrank.exp | 6 +-
.../gdb.fortran/class-allocatable-array.exp | 4 +-
.../gdb.fortran/derived-type-striding.exp | 2 +-
gdb/testsuite/gdb.fortran/library-module.exp | 2 +-
gdb/testsuite/gdb.fortran/namelist.exp | 2 +-
gdb/testsuite/gdb.fortran/nested-funcs-2.exp | 3 +-
.../gdb.fortran/ptype-on-functions.exp | 6 +-
gdb/testsuite/gdb.fortran/vla-type.exp | 2 +-
gdb/testsuite/lib/compiler.F90 | 69 ++++++++++++
gdb/testsuite/lib/fortran.exp | 100 +++++++++---------
gdb/testsuite/lib/gdb.exp | 24 +++--
11 files changed, 150 insertions(+), 70 deletions(-)
create mode 100644 gdb/testsuite/lib/compiler.F90
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 5975e04541..5cc0137973 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 284bcf1e8d..c9774d081b 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 d6263e12fe..c875ee1567 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 6009cb65c5..f21dd01c5f 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 8e0bb710f6..021ad83ff1 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 639a0cd1be..b8e61d846d 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -4072,14 +4072,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.
@@ -4094,6 +4094,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.
@@ -4124,6 +4126,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"
@@ -4161,9 +4167,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] {
@@ -4436,10 +4442,10 @@ proc gdb_compile {source dest type options} {
if { $getting_compiler_info == 0 && [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}"
}
}
@@ -4735,6 +4741,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
@@ -6922,6 +6930,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
--
2.25.1
Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
More information about the Gdb-patches
mailing list