aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2016-10-14 17:03:16 +0100
committerPedro Alves <palves@redhat.com>2016-10-14 17:03:16 +0100
commitd118ee3761bcf0c861a75e454d0c2b741fccb956 (patch)
tree5b1d3a531b9f14e61516dc39509643bab22af592 /include
parentbe06ba8ceb2197b6771f8e47dc7b8df316e1da75 (diff)
downloadgdb-d118ee3761bcf0c861a75e454d0c2b741fccb956.zip
gdb-d118ee3761bcf0c861a75e454d0c2b741fccb956.tar.gz
gdb-d118ee3761bcf0c861a75e454d0c2b741fccb956.tar.bz2
Move OVERRIDE/FINAL from gcc/coretypes.h to include/ansidecl.h
So that GDB and other projects that share the top level can use them. Bootstrapped with all default languages + jit on x86-64 Fedora 23. gcc/ChangeLog: 2016-10-14 Pedro Alves <palves@redhat.com> * coretypes.h (OVERRIDE, FINAL): Delete, moved to include/ansidecl.h. include/ChangeLog: 2016-10-14 Pedro Alves <palves@redhat.com> * ansidecl.h (GCC_FINAL): Delete. (OVERRIDE, FINAL): New, moved from gcc/coretypes.h.
Diffstat (limited to 'include')
-rw-r--r--include/ChangeLog5
-rw-r--r--include/ansidecl.h28
2 files changed, 27 insertions, 6 deletions
diff --git a/include/ChangeLog b/include/ChangeLog
index 6f68130..bdff2dd 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,8 @@
+2016-10-14 Pedro Alves <palves@redhat.com>
+
+ * ansidecl.h (GCC_FINAL): Delete.
+ (OVERRIDE, FINAL): New, moved from gcc/coretypes.h.
+
2016-10-14 Claudiu Zissulescu <claziss@synopsys.com>
* opcode/arc.h (ARC_OPCODE_ARCV2): New define.
diff --git a/include/ansidecl.h b/include/ansidecl.h
index 18b7821..7dd7baa 100644
--- a/include/ansidecl.h
+++ b/include/ansidecl.h
@@ -313,13 +313,29 @@ So instead we use the macro below and test it against specific values. */
#define ENUM_BITFIELD(TYPE) unsigned int
#endif
- /* This is used to mark a class or virtual function as final. */
-#if __cplusplus >= 201103L
-#define GCC_FINAL final
-#elif GCC_VERSION >= 4007
-#define GCC_FINAL __final
+/* C++11 adds the ability to add "override" after an implementation of a
+ virtual function in a subclass, to:
+ (A) document that this is an override of a virtual function
+ (B) allow the compiler to issue a warning if it isn't (e.g. a mismatch
+ of the type signature).
+
+ Similarly, it allows us to add a "final" to indicate that no subclass
+ may subsequently override the vfunc.
+
+ Provide OVERRIDE and FINAL as macros, allowing us to get these benefits
+ when compiling with C++11 support, but without requiring C++11.
+
+ For gcc, use "-std=c++11" to enable C++11 support; gcc 6 onwards enables
+ this by default (actually GNU++14). */
+
+#if __cplusplus >= 201103
+/* C++11 claims to be available: use it: */
+#define OVERRIDE override
+#define FINAL final
#else
-#define GCC_FINAL
+/* No C++11 support; leave the macros empty: */
+#define OVERRIDE
+#define FINAL
#endif
#ifdef __cplusplus