[PATCH 2/3] Recognise GNU Fortran as GCC

Gary Benson gbenson@redhat.com
Mon Oct 26 16:28:13 GMT 2020


GNU Fortran's preprocessor defines __GFORTRAN__ where GCC defines
__GNUC__.  This commit causes the testsuite's get_compiler_info
method to identify GNU Fortran as though it were C-language GCC.

gdb/testsuite/ChangeLog:

	* lib/compiler.c: Recognise gfortran as GCC.
---
 gdb/testsuite/ChangeLog      | 4 ++++
 gdb/testsuite/lib/compiler.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/lib/compiler.c b/gdb/testsuite/lib/compiler.c
index b149f57..b947b66 100644
--- a/gdb/testsuite/lib/compiler.c
+++ b/gdb/testsuite/lib/compiler.c
@@ -34,7 +34,7 @@
 
 set compiler_info "unknown"
 
-#if defined (__GNUC__)
+#if defined (__GNUC__) || defined (__GFORTRAN__)
 #if defined (__GNUC_PATCHLEVEL__)
 /* Only GCC versions >= 3.0 define the __GNUC_PATCHLEVEL__ macro.  */
 set compiler_info [join {gcc __GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__} -]
-- 
1.8.3.1



More information about the Gdb-patches mailing list