Bernhard Heckel <bernhard.heckel@intel.com> writes:
-# Depending on the compiler version being used, the name of the 4-byte integer
-# and real types can be printed differently. For instance, gfortran-4.1 uses
-# "int4" whereas gfortran-4.3 uses "int(kind=4)".
-set int4 "(int4|integer\\(kind=4\\))"
-set real4 "(real4|real\\(kind=4\\))"
-
-gdb_test "ptype p" "type = Type bar\r\n *${int4} :: c\r\n *${real4} :: d\r\n *End Type bar"
+gdb_test "ptype p" "type = Type bar\r\n *$int :: c\r\n *$real :: d\r\n *End Type bar"
+
+proc fortran_int4 {} {
+ if {[test_compiler_info {gcc-4-[012]-*}]} {
+ return "int4"
+ } elseif {[test_compiler_info {gcc-*}]} {
+ return "integer\\(kind=4\\)"
+ } elseif {[test_compiler_info {icc-*}]} {
+ return "INTEGER\\(4\\)"
+ } else {
+ return "unknown"
+ }
+}
+
+
+if ![info exists int4] then {
+ set int4 [fortran_int4]
+}
Why do you prefer to define these info? In each test, we can do
set int4 [fortran_int4],
IMO, that is much cleaner than your current approach (define int4
globally in lib/fortran.exp and use it everywhere).