Message ID | 014f88ec-909b-db46-1213-e9dbb8f14ee4@redhat.com |
---|---|
State | New |
Headers | show |
On 10/12/2016 04:09 PM, Pedro Alves wrote: > > 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. Lovely. That's ok too if the other one goes in. Bernd
On 10/12/2016 03:13 PM, Bernd Schmidt wrote: > On 10/12/2016 04:09 PM, Pedro Alves wrote: >> >> 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. > > Lovely. That's ok too if the other one goes in. FYI, I pushed these in now. I also bootstrapped with the jit included in the selected languages, and hacked the jit code a bit to trigger the problems OVERRIDE intends to catch, just to make sure it still works. Thanks, Pedro Alves
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