]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
math.h: Wrap C++ bits in extern "C++"
authorFlorian Weimer <fweimer@redhat.com>
Sat, 22 Oct 2016 15:33:26 +0000 (17:33 +0200)
committerFlorian Weimer <fweimer@redhat.com>
Sat, 22 Oct 2016 15:33:26 +0000 (17:33 +0200)
It is still common to include system header files in an extern "C"
block.  This means that exiting <math.h>'s own extern "C" block
is not sufficient to get back to C++ mode.  Use an extern "C++"
wrapper instead.

ChangeLog
math/math.h

index e41c3e733074d6a7d62e532b72c273868b47e969..2520c4437137f098a561e0d6eca06ecf504e7333 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2016-10-22  Florian Weimer  <fweimer@redhat.com>
+
+       * math/math.h [__cplusplus] (iszero): Wrap C++ bits in extern
+       "C++", to override a potential extern "C" directive around the
+       header file inclusion.
+
 2016-10-21  Joseph Myers  <joseph@codesourcery.com>
 
        * benchtests/Makefile (CFLAGS-bench-sqrt.c): New variable.
index 0220d08d8a7243cfa2331b14d9d6ec96eb1ccb01..7c0c7095239f728577852d68a48f44844531d368 100644 (file)
@@ -342,7 +342,7 @@ enum
 #   define iszero(x) (((__typeof (x)) (x)) == 0)
 #  endif
 # else /* __cplusplus */
-__END_DECLS
+extern "C++" {
 template <class __T> inline bool
 iszero (__T __val)
 {
@@ -352,7 +352,7 @@ iszero (__T __val)
   return __val == 0;
 #  endif
 }
-__BEGIN_DECLS
+} /* extern C++ */
 # endif        /* __cplusplus */
 #endif /* Use IEC_60559_BFP_EXT.  */