[RFC,1/1] gdb/testsuite: enable __INTEL_LLVM_COMPILER preprocessor in get_compiler_info

Message ID 20220111171240.1986834-2-nils-christian.kempke@intel.com
State New
Headers show
Series
  • Fortran compiler detection
Related show

Commit Message

Simon Marchi via Gdb-patches Jan. 11, 2022, 5:12 p.m.
Intel Next Gen compiler defines preprocessor __INTEL_LLVM_COMPILER and provides
version info in __clang_version__ e.g. value: 12.0.0 (icx 2020.10.0.1113).

gdb/testsuite/ChangeLog:
2020-12-07  Abdul Basit Ijaz  <abdul.b.ijaz@intel.com>

	* lib/compiler.c: Add Intel next gen compiler pre-processor check.
	* lib/compiler.cc: Ditto.
	* lib/fortran.exp (fortran_main): Check Intel next gen compiler in
	test_compiler_info.
---
 gdb/testsuite/lib/compiler.c  | 9 +++++++++
 gdb/testsuite/lib/compiler.cc | 9 +++++++++
 gdb/testsuite/lib/fortran.exp | 3 ++-
 3 files changed, 20 insertions(+), 1 deletion(-)

-- 
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

Comments

Simon Marchi via Gdb-patches Jan. 12, 2022, 3:02 p.m. | #1
* Nils-Christian Kempke via Gdb-patches <gdb-patches@sourceware.org> [2022-01-11 18:12:40 +0100]:

> Intel Next Gen compiler defines preprocessor __INTEL_LLVM_COMPILER and provides

> version info in __clang_version__ e.g. value: 12.0.0 (icx 2020.10.0.1113).


This looks good to me...

> 

> gdb/testsuite/ChangeLog:

> 2020-12-07  Abdul Basit Ijaz  <abdul.b.ijaz@intel.com>

> 

> 	* lib/compiler.c: Add Intel next gen compiler pre-processor check.

> 	* lib/compiler.cc: Ditto.

> 	* lib/fortran.exp (fortran_main): Check Intel next gen compiler in

> 	test_compiler_info.


FYI, ChangeLog entries should not be committed in tree.  It's fine to
have these entries in the commit message though.

Thanks,
Andrew

> ---

>  gdb/testsuite/lib/compiler.c  | 9 +++++++++

>  gdb/testsuite/lib/compiler.cc | 9 +++++++++

>  gdb/testsuite/lib/fortran.exp | 3 ++-

>  3 files changed, 20 insertions(+), 1 deletion(-)

> 

> diff --git a/gdb/testsuite/lib/compiler.c b/gdb/testsuite/lib/compiler.c

> index 191bced041..4cab1c5052 100644

> --- a/gdb/testsuite/lib/compiler.c

> +++ b/gdb/testsuite/lib/compiler.c

> @@ -67,4 +67,13 @@ 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" -]

> +#elif defined(__INTEL_LLVM_COMPILER) && defined(__clang_version__)

> +/* Intel Next Gen compiler defines preprocessor __INTEL_LLVM_COMPILER and

> +   provides version info in __clang_version__ e.g. value:

> +   "12.0.0 (icx 2020.10.0.1113)". */

> +set total_length [string length __clang_version__]

> +set version_start_index [string last "(" __clang_version__]

> +set version_string [string range __clang_version__ $version_start_index+5 $total_length-2]

> +set version_updated_string [string map {. -} $version_string]

> +set compiler_info "intel-$version_updated_string"

>  #endif

> diff --git a/gdb/testsuite/lib/compiler.cc b/gdb/testsuite/lib/compiler.cc

> index ab36bea43a..fa9059c68d 100755

> --- a/gdb/testsuite/lib/compiler.cc

> +++ b/gdb/testsuite/lib/compiler.cc

> @@ -55,4 +55,13 @@ 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" -]

> +#elif defined(__INTEL_LLVM_COMPILER) && defined(__clang_version__)

> +/* Intel Next Gen compiler defines preprocessor __INTEL_LLVM_COMPILER and

> +   provides version info in __clang_version__ e.g. value:

> +   "12.0.0 (icx 2020.10.0.1113)". */

> +set total_length [string length __clang_version__]

> +set version_start_index [string last "(" __clang_version__]

> +set version_string [string range __clang_version__ $version_start_index+5 $total_length-2]

> +set version_updated_string [string map {. -} $version_string]

> +set compiler_info "intel-$version_updated_string"

>  #endif

> diff --git a/gdb/testsuite/lib/fortran.exp b/gdb/testsuite/lib/fortran.exp

> index ee7fe12ad9..a97c6eeb4e 100644

> --- a/gdb/testsuite/lib/fortran.exp

> +++ b/gdb/testsuite/lib/fortran.exp

> @@ -160,7 +160,8 @@ proc fortran_character1 {} {

>  proc fortran_main {} {

>      if {[test_compiler_info {gcc-4-[012]-*}]

>           || [test_compiler_info {gcc-*}]

> -         || [test_compiler_info {icc-*}]} {

> +         || [test_compiler_info {icc-*}]

> +         || [test_compiler_info {intel-*}]} {

>  	return "MAIN__"

>      } elseif {[test_compiler_info {clang-*}]} {

>  	return "MAIN_"

> -- 

> 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

>
Simon Marchi via Gdb-patches Jan. 13, 2022, 2:13 p.m. | #2
> -----Original Message-----

> From: Andrew Burgess <aburgess@redhat.com>

> Sent: Wednesday, January 12, 2022 4:02 PM

> To: Kempke, Nils-Christian <nils-christian.kempke@intel.com>

> Cc: gdb-patches@sourceware.org

> Subject: Re: [RFC][PATCH 1/1] gdb/testsuite: enable

> __INTEL_LLVM_COMPILER preprocessor in get_compiler_info

> 

> * Nils-Christian Kempke via Gdb-patches <gdb-patches@sourceware.org>

> [2022-01-11 18:12:40 +0100]:

> 

> > Intel Next Gen compiler defines preprocessor __INTEL_LLVM_COMPILER

> and provides

> > version info in __clang_version__ e.g. value: 12.0.0 (icx 2020.10.0.1113).

> 

> This looks good to me...

> 

> >

> > gdb/testsuite/ChangeLog:

> > 2020-12-07  Abdul Basit Ijaz  <abdul.b.ijaz@intel.com>

> >

> > 	* lib/compiler.c: Add Intel next gen compiler pre-processor check.

> > 	* lib/compiler.cc: Ditto.

> > 	* lib/fortran.exp (fortran_main): Check Intel next gen compiler in

> > 	test_compiler_info.

> 

> FYI, ChangeLog entries should not be committed in tree.  It's fine to

> have these entries in the commit message though.


Ok, thanks, got it! Our (Intel) currently published master is based on some older
gdb and thus all commits from there still have a ChangeLog in them.

Cheers,

Nils

> 

> Thanks,

> Andrew

> 

> > ---

> >  gdb/testsuite/lib/compiler.c  | 9 +++++++++

> >  gdb/testsuite/lib/compiler.cc | 9 +++++++++

> >  gdb/testsuite/lib/fortran.exp | 3 ++-

> >  3 files changed, 20 insertions(+), 1 deletion(-)

> >

> > diff --git a/gdb/testsuite/lib/compiler.c b/gdb/testsuite/lib/compiler.c

> > index 191bced041..4cab1c5052 100644

> > --- a/gdb/testsuite/lib/compiler.c

> > +++ b/gdb/testsuite/lib/compiler.c

> > @@ -67,4 +67,13 @@ 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" -]

> > +#elif defined(__INTEL_LLVM_COMPILER) &&

> defined(__clang_version__)

> > +/* Intel Next Gen compiler defines preprocessor

> __INTEL_LLVM_COMPILER and

> > +   provides version info in __clang_version__ e.g. value:

> > +   "12.0.0 (icx 2020.10.0.1113)". */

> > +set total_length [string length __clang_version__]

> > +set version_start_index [string last "(" __clang_version__]

> > +set version_string [string range __clang_version__

> $version_start_index+5 $total_length-2]

> > +set version_updated_string [string map {. -} $version_string]

> > +set compiler_info "intel-$version_updated_string"

> >  #endif

> > diff --git a/gdb/testsuite/lib/compiler.cc b/gdb/testsuite/lib/compiler.cc

> > index ab36bea43a..fa9059c68d 100755

> > --- a/gdb/testsuite/lib/compiler.cc

> > +++ b/gdb/testsuite/lib/compiler.cc

> > @@ -55,4 +55,13 @@ 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" -]

> > +#elif defined(__INTEL_LLVM_COMPILER) &&

> defined(__clang_version__)

> > +/* Intel Next Gen compiler defines preprocessor

> __INTEL_LLVM_COMPILER and

> > +   provides version info in __clang_version__ e.g. value:

> > +   "12.0.0 (icx 2020.10.0.1113)". */

> > +set total_length [string length __clang_version__]

> > +set version_start_index [string last "(" __clang_version__]

> > +set version_string [string range __clang_version__

> $version_start_index+5 $total_length-2]

> > +set version_updated_string [string map {. -} $version_string]

> > +set compiler_info "intel-$version_updated_string"

> >  #endif

> > diff --git a/gdb/testsuite/lib/fortran.exp b/gdb/testsuite/lib/fortran.exp

> > index ee7fe12ad9..a97c6eeb4e 100644

> > --- a/gdb/testsuite/lib/fortran.exp

> > +++ b/gdb/testsuite/lib/fortran.exp

> > @@ -160,7 +160,8 @@ proc fortran_character1 {} {

> >  proc fortran_main {} {

> >      if {[test_compiler_info {gcc-4-[012]-*}]

> >           || [test_compiler_info {gcc-*}]

> > -         || [test_compiler_info {icc-*}]} {

> > +         || [test_compiler_info {icc-*}]

> > +         || [test_compiler_info {intel-*}]} {

> >  	return "MAIN__"

> >      } elseif {[test_compiler_info {clang-*}]} {

> >  	return "MAIN_"

> > --

> > 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

> >


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
Simon Marchi via Gdb-patches Jan. 14, 2022, 2:31 p.m. | #3
I've pushed this patch.

Thanks,
Andrew


* Nils-Christian Kempke via Gdb-patches <gdb-patches@sourceware.org> [2022-01-11 18:12:40 +0100]:

> Intel Next Gen compiler defines preprocessor __INTEL_LLVM_COMPILER and provides

> version info in __clang_version__ e.g. value: 12.0.0 (icx 2020.10.0.1113).

> 

> gdb/testsuite/ChangeLog:

> 2020-12-07  Abdul Basit Ijaz  <abdul.b.ijaz@intel.com>

> 

> 	* lib/compiler.c: Add Intel next gen compiler pre-processor check.

> 	* lib/compiler.cc: Ditto.

> 	* lib/fortran.exp (fortran_main): Check Intel next gen compiler in

> 	test_compiler_info.

> ---

>  gdb/testsuite/lib/compiler.c  | 9 +++++++++

>  gdb/testsuite/lib/compiler.cc | 9 +++++++++

>  gdb/testsuite/lib/fortran.exp | 3 ++-

>  3 files changed, 20 insertions(+), 1 deletion(-)

> 

> diff --git a/gdb/testsuite/lib/compiler.c b/gdb/testsuite/lib/compiler.c

> index 191bced041..4cab1c5052 100644

> --- a/gdb/testsuite/lib/compiler.c

> +++ b/gdb/testsuite/lib/compiler.c

> @@ -67,4 +67,13 @@ 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" -]

> +#elif defined(__INTEL_LLVM_COMPILER) && defined(__clang_version__)

> +/* Intel Next Gen compiler defines preprocessor __INTEL_LLVM_COMPILER and

> +   provides version info in __clang_version__ e.g. value:

> +   "12.0.0 (icx 2020.10.0.1113)". */

> +set total_length [string length __clang_version__]

> +set version_start_index [string last "(" __clang_version__]

> +set version_string [string range __clang_version__ $version_start_index+5 $total_length-2]

> +set version_updated_string [string map {. -} $version_string]

> +set compiler_info "intel-$version_updated_string"

>  #endif

> diff --git a/gdb/testsuite/lib/compiler.cc b/gdb/testsuite/lib/compiler.cc

> index ab36bea43a..fa9059c68d 100755

> --- a/gdb/testsuite/lib/compiler.cc

> +++ b/gdb/testsuite/lib/compiler.cc

> @@ -55,4 +55,13 @@ 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" -]

> +#elif defined(__INTEL_LLVM_COMPILER) && defined(__clang_version__)

> +/* Intel Next Gen compiler defines preprocessor __INTEL_LLVM_COMPILER and

> +   provides version info in __clang_version__ e.g. value:

> +   "12.0.0 (icx 2020.10.0.1113)". */

> +set total_length [string length __clang_version__]

> +set version_start_index [string last "(" __clang_version__]

> +set version_string [string range __clang_version__ $version_start_index+5 $total_length-2]

> +set version_updated_string [string map {. -} $version_string]

> +set compiler_info "intel-$version_updated_string"

>  #endif

> diff --git a/gdb/testsuite/lib/fortran.exp b/gdb/testsuite/lib/fortran.exp

> index ee7fe12ad9..a97c6eeb4e 100644

> --- a/gdb/testsuite/lib/fortran.exp

> +++ b/gdb/testsuite/lib/fortran.exp

> @@ -160,7 +160,8 @@ proc fortran_character1 {} {

>  proc fortran_main {} {

>      if {[test_compiler_info {gcc-4-[012]-*}]

>           || [test_compiler_info {gcc-*}]

> -         || [test_compiler_info {icc-*}]} {

> +         || [test_compiler_info {icc-*}]

> +         || [test_compiler_info {intel-*}]} {

>  	return "MAIN__"

>      } elseif {[test_compiler_info {clang-*}]} {

>  	return "MAIN_"

> -- 

> 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

>

Patch

diff --git a/gdb/testsuite/lib/compiler.c b/gdb/testsuite/lib/compiler.c
index 191bced041..4cab1c5052 100644
--- a/gdb/testsuite/lib/compiler.c
+++ b/gdb/testsuite/lib/compiler.c
@@ -67,4 +67,13 @@  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" -]
+#elif defined(__INTEL_LLVM_COMPILER) && defined(__clang_version__)
+/* Intel Next Gen compiler defines preprocessor __INTEL_LLVM_COMPILER and
+   provides version info in __clang_version__ e.g. value:
+   "12.0.0 (icx 2020.10.0.1113)". */
+set total_length [string length __clang_version__]
+set version_start_index [string last "(" __clang_version__]
+set version_string [string range __clang_version__ $version_start_index+5 $total_length-2]
+set version_updated_string [string map {. -} $version_string]
+set compiler_info "intel-$version_updated_string"
 #endif
diff --git a/gdb/testsuite/lib/compiler.cc b/gdb/testsuite/lib/compiler.cc
index ab36bea43a..fa9059c68d 100755
--- a/gdb/testsuite/lib/compiler.cc
+++ b/gdb/testsuite/lib/compiler.cc
@@ -55,4 +55,13 @@  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" -]
+#elif defined(__INTEL_LLVM_COMPILER) && defined(__clang_version__)
+/* Intel Next Gen compiler defines preprocessor __INTEL_LLVM_COMPILER and
+   provides version info in __clang_version__ e.g. value:
+   "12.0.0 (icx 2020.10.0.1113)". */
+set total_length [string length __clang_version__]
+set version_start_index [string last "(" __clang_version__]
+set version_string [string range __clang_version__ $version_start_index+5 $total_length-2]
+set version_updated_string [string map {. -} $version_string]
+set compiler_info "intel-$version_updated_string"
 #endif
diff --git a/gdb/testsuite/lib/fortran.exp b/gdb/testsuite/lib/fortran.exp
index ee7fe12ad9..a97c6eeb4e 100644
--- a/gdb/testsuite/lib/fortran.exp
+++ b/gdb/testsuite/lib/fortran.exp
@@ -160,7 +160,8 @@  proc fortran_character1 {} {
 proc fortran_main {} {
     if {[test_compiler_info {gcc-4-[012]-*}]
          || [test_compiler_info {gcc-*}]
-         || [test_compiler_info {icc-*}]} {
+         || [test_compiler_info {icc-*}]
+         || [test_compiler_info {intel-*}]} {
 	return "MAIN__"
     } elseif {[test_compiler_info {clang-*}]} {
 	return "MAIN_"