fix FLT_ROUNDS regression in C++ applications
authorRich Felker <dalias@aerifal.cx>
Mon, 23 Mar 2015 15:26:51 +0000 (11:26 -0400)
committerRich Felker <dalias@aerifal.cx>
Mon, 23 Mar 2015 15:26:51 +0000 (11:26 -0400)
commit 559de8f5f06da9022cbba70e22e14a710eb74513 redefined FLT_ROUNDS
to use an external function that can report the actual current
rounding mode, rather than always reporting round-to-nearest. however,
float.h did not include 'extern "C"' wrapping for C++, so C++ programs
using FLT_ROUNDS ended up with an unresolved reference to a
name-mangled C++ function __flt_rounds.

include/float.h

index c6429d33c805364191f8ce5530c2eb7cd8c5992c..713aadb906d9565f9a9d6bb408dd506b8a98e74c 100644 (file)
@@ -1,6 +1,10 @@
 #ifndef _FLOAT_H
 #define _FLOAT_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 int __flt_rounds(void);
 #define FLT_ROUNDS (__flt_rounds())
 
@@ -41,4 +45,8 @@ int __flt_rounds(void);
 
 #include <bits/float.h>
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif