]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix compile time error when using ansidecl.h with an old version of GCC.
authorpalves <palves@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 15 Sep 2017 14:53:48 +0000 (14:53 +0000)
committerpalves <palves@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 15 Sep 2017 14:53:48 +0000 (14:53 +0000)
include/
2017-07-31  Nick Clifton  <nickc@redhat.com>

Binutils PR 21850
* ansidecl.h (OVERRIDE): Protect check of __cplusplus value with
#idef __cplusplus.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@252822 138bc75d-0d04-0410-961f-82ee72b054a4

include/ChangeLog
include/ansidecl.h

index c7ce2592979733a7316562553fe7ab0e2d121a5b..47035883d3b9dbec23bc66f74ff1d054ed65ea7f 100644 (file)
@@ -8,6 +8,12 @@
        * simple-object.h (simple_object_copy_lto_debug_sections): New
        function.
 
+2017-07-31  Nick Clifton  <nickc@redhat.com>
+
+       Binutils PR 21850
+       * ansidecl.h (OVERRIDE): Protect check of __cplusplus value with
+       #idef __cplusplus.
+
 2017-07-02  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        * dwarf2.def (DW_IDX_compile_unit, DW_IDX_type_unit, DW_IDX_die_offset)
index f6e1761af2d0a2d788ff5f2d8007136f23b21dea..ab3b895a475a8403f78726d271f6eb5362effd32 100644 (file)
@@ -334,22 +334,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