[PATCH V2 1/2] testsuite: Support detection of Intel compilers via test_compiler_version.

Bernhard Heckel bernhard.heckel@intel.com
Fri Apr 15 12:47:00 GMT 2016


Add Intel specific preprocessor macros to query the version of the compiler.

2016-04-15  Bernhard Heckel  <bernhard.heckel@intel.com>

gdb/Testsuite/Changelog:
	* lib/compiler.c: Add Intel specific preprocessor macros.
	* lib/compiler.cc: Likewise.
	* lib/gdb.exp (gdb_compile_shlib): Add flags for ICC compiler.

---
 gdb/testsuite/lib/compiler.c  | 12 ++++++++++++
 gdb/testsuite/lib/compiler.cc | 12 ++++++++++++
 gdb/testsuite/lib/gdb.exp     |  3 +++
 3 files changed, 27 insertions(+)
 mode change 100644 => 100755 gdb/testsuite/lib/compiler.c
 mode change 100644 => 100755 gdb/testsuite/lib/compiler.cc

diff --git a/gdb/testsuite/lib/compiler.c b/gdb/testsuite/lib/compiler.c
old mode 100644
new mode 100755
index f2e3062..408435d
--- a/gdb/testsuite/lib/compiler.c
+++ b/gdb/testsuite/lib/compiler.c
@@ -56,3 +56,15 @@ set compiler_info [join {armcc __ARMCC_VERSION} -]
 #if defined (__clang__)
 set compiler_info [join {clang __clang_major__ __clang_minor__ __clang_patchlevel__} -]
 #endif
+
+#if defined (__ICC)
+set icc_major [string range __ICC 0 1]
+set icc_minor [format "%d" [string range __ICC 2 [expr {[string length __ICC] -1}]]]
+set icc_update __INTEL_COMPILER_UPDATE
+set compiler_info [join "icc $icc_major $icc_minor $icc_update" -]
+#elif defined (__ICL)
+set icc_major [string range __ICL 0 1]
+set icc_minor [format "%d" [string range __ICL 2 [expr {[string length __ICL] -1}]]]
+set icc_update __INTEL_COMPILER_UPDATE
+set compiler_info [join "icc $icc_major $icc_minor $icc_update" -]
+#endif
diff --git a/gdb/testsuite/lib/compiler.cc b/gdb/testsuite/lib/compiler.cc
old mode 100644
new mode 100755
index 39761ff..dbe2c6f
--- a/gdb/testsuite/lib/compiler.cc
+++ b/gdb/testsuite/lib/compiler.cc
@@ -44,3 +44,15 @@ set compiler_info [join {armcc __ARMCC_VERSION} -]
 #if defined (__clang__)
 set compiler_info [join {clang __clang_major__ __clang_minor__ __clang_patchlevel__} -]
 #endif
+
+#if defined (__ICC)
+set icc_major [string range __ICC 0 1]
+set icc_minor [format "%d" [string range __ICC 2 [expr {[string length __ICC] -1}]]]
+set icc_update __INTEL_COMPILER_UPDATE
+set compiler_info [join "icc $icc_major $icc_minor $icc_update" -]
+#elif defined (__ICL)
+set icc_major [string range __ICL 0 1]
+set icc_minor [format "%d" [string range __ICL 2 [expr {[string length __ICL] -1}]]]
+set icc_update __INTEL_COMPILER_UPDATE
+set compiler_info [join "icc $icc_major $icc_minor $icc_update" -]
+#endif
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 1ef6a96..75c5e68 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -3553,6 +3553,9 @@ proc gdb_compile_shlib {sources dest options} {
                 lappend obj_options "additional_flags=-fpic"
             }
         }
+        "icc-*" {
+                lappend obj_options "additional_flags=-fpic"
+        }
         default {
 	    # don't know what the compiler is...
         }
-- 
2.7.1.339.g0233b80



More information about the Gdb-patches mailing list