This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils 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]

[binutils-gdb] FINAL/OVERRIDE: Define to empty on g++ < 4.7


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b4f6af8ee2ea97b8c6f2bca1c2fd728683e68ef5

commit b4f6af8ee2ea97b8c6f2bca1c2fd728683e68ef5
Author: Pedro Alves <palves@redhat.com>
Date:   Fri Oct 14 17:03:16 2016 +0100

    FINAL/OVERRIDE: Define to empty on g++ < 4.7
    
    final/override were only implemented in g++ 4.7.
    
    include/ChangeLog
    2016-10-14  Pedro Alves  <palves@redhat.com>
    
    	* ansidecl.h [__cplusplus >= 201103 && GCC_VERSION < 4007] (FINAL,
    	OVERRIDE): Define as empty.
    	[__cplusplus < 201103 && GCC_VERSION < 4007] (FINAL): Define as
    	__final.
    	[__cplusplus < 201103 && GCC_VERSION >= 4007] (OVERRIDE): Define as
    	empty.

Diff:
---
 include/ChangeLog  |  9 +++++++++
 include/ansidecl.h | 20 +++++++++++++++-----
 2 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/include/ChangeLog b/include/ChangeLog
index bdff2dd..98b2c65 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,5 +1,14 @@
 2016-10-14  Pedro Alves  <palves@redhat.com>
 
+	* ansidecl.h [__cplusplus >= 201103 && GCC_VERSION < 4007] (FINAL,
+	OVERRIDE): Define as empty.
+	[__cplusplus < 201103 && GCC_VERSION < 4007] (FINAL): Define as
+	__final.
+	[__cplusplus < 201103 && GCC_VERSION >= 4007] (OVERRIDE): Define as
+	empty.
+
+2016-10-14  Pedro Alves  <palves@redhat.com>
+
 	* ansidecl.h (GCC_FINAL): Delete.
 	(OVERRIDE, FINAL): New, moved from gcc/coretypes.h.
 
diff --git a/include/ansidecl.h b/include/ansidecl.h
index 7dd7baa..0c71685 100644
--- a/include/ansidecl.h
+++ b/include/ansidecl.h
@@ -329,13 +329,23 @@ So instead we use the macro below and test it against specific values.  */
    this by default (actually GNU++14).  */
 
 #if __cplusplus >= 201103
-/* C++11 claims to be available: use it: */
-#define OVERRIDE override
-#define FINAL final
+/* C++11 claims to be available: use it.  final/override were only
+   implemented in 4.7, though.  */
+# if GCC_VERSION < 4007
+#  define OVERRIDE
+#  define FINAL
+# else
+#  define OVERRIDE override
+#  define FINAL final
+# endif
+#elif GCC_VERSION >= 4007
+/* G++ 4.7 supports __final in C++98.  */
+# define OVERRIDE
+# define FINAL __final
 #else
 /* No C++11 support; leave the macros empty: */
-#define OVERRIDE
-#define FINAL
+# define OVERRIDE
+# define FINAL
 #endif
 
 #ifdef __cplusplus


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