On 10/12/2016 03:01 PM, Bernd Schmidt wrote: > On 10/10/2016 09:32 PM, Pedro Alves wrote: >> From: Pedro Alves <pal...@redhat.com> >> Date: 2016-10-10 19:25:47 +0100 >> >> 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. > > Seems reasonable. OK unless someone objects by the end of the week.
Thanks. Here's a follow up patch that I was just testing. Need this if building with "g++ -std=gnu++11", with gcc < 4.7. From: Pedro Alves <pal...@redhat.com> Date: 2016-10-12 01:49:53 +0100 FINAL/OVERRIDE: Define to empty on g++ < 4.7 final/override were only implemented in 4.7. include/ChangeLog 2016-10-12 Pedro Alves <pal...@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. --- include/ansidecl.h | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/include/ansidecl.h b/include/ansidecl.h index ee93421..08aeb1e 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