Fix compile time error when using ansidecl.h with an old version of GCC.
authorNick Clifton <nickc@redhat.com>
Mon, 31 Jul 2017 14:08:32 +0000 (15:08 +0100)
committerNick Clifton <nickc@redhat.com>
Mon, 31 Jul 2017 14:08:32 +0000 (15:08 +0100)
PR 21850
* ansidecl.h (OVERRIDE): Protect check of __cplusplus value with
#idef __cplusplus.

include/ChangeLog
include/ansidecl.h

index da1ce10a43a53f5cf36a483c2d78daef6aa68acd..443cab06213cc8c077dae077a0722c7867a8e7e2 100644 (file)
@@ -1,3 +1,9 @@
+2017-07-31  Nick Clifton  <nickc@redhat.com>
+
+       PR 21850
+       * ansidecl.h (OVERRIDE): Protect check of __cplusplus value with
+       #idef __cplusplus.
+
 2017-07-19  Claudiu Zissulescu  <claziss@synopsys.com>
 
        * opcode/arc.h (SJLI): Add.
index 6c0c837bf23cb4f16d1551cd488ed4910abb9df0..0a74098466c80c9160e6abc2d93966dd8cdecd23 100644 (file)
@@ -328,22 +328,28 @@ So instead we use the macro below and test it against specific values.  */
    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.  final/override were only
-   implemented in 4.7, though.  */
-# if GCC_VERSION < 4007
+#if defined __cplusplus
+# if __cplusplus >= 201103
+   /* 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
+#  define FINAL __final
 # else
-#  define OVERRIDE override
-#  define FINAL final
+   /* No C++11 support; leave the macros empty.  */
+#  define OVERRIDE
+#  define 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: */
+  /* No C++11 support; leave the macros empty.  */
 # define OVERRIDE
 # define FINAL
 #endif
This page took 0.036974 seconds and 4 git commands to generate.