This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH V2 2/2] fortran: Testsuite, fix different type naming across compilers.


On 15/04/2016 16:41, Yao Qi wrote:
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).

I wanted to avoid copy in the same code in several testcases but when I look again, it's
better to get rid of the globals here.
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]