Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Patch against OS X 10.6 math.h fixing compilation of C++11 programs with libc++.

View gist:2721440
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
--- /usr/include/architecture/i386/math.h 2009-10-02 02:12:05.000000000 -0400
+++ /usr/local/include/math.h 2012-05-17 15:32:14.000000000 -0400
@@ -384,7 +384,7 @@
extern long int lround ( double );
extern long int lroundf ( float );
-#if ( defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L ) || ! defined( __STRICT_ANSI__ ) || ! defined( __GNUC__ )
+#if !(__DARWIN_NO_LONG_LONG)
/* long long is not part of C90. Make sure you are passing -std=c99 or -std=gnu99 or better if you need this. */
extern long long int llrint ( double );
@@ -393,7 +393,7 @@
extern long long int llround ( double );
extern long long int llroundf ( float );
-#endif /* #if ( defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L ) || ! defined( __STRICT_ANSI__ ) || ! defined( __GNUC__ ) */
+#endif /* !(__DARWIN_NO_LONG_LONG) */
extern double trunc ( double );
extern float truncf ( float );
@@ -479,11 +479,11 @@
extern long double roundl(long double);
extern long int lroundl(long double);
-#if ( defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L ) || ! defined( __STRICT_ANSI__ ) || ! defined( __GNUC__ )
+#if !(__DARWIN_NO_LONG_LONG)
/* long long is not part of C90. Make sure you are passing -std=c99 or -std=gnu99 or better if you need this. */
extern long long int llrintl(long double);
extern long long int llroundl(long double);
-#endif /* #if ( defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L ) || ! defined( __STRICT_ANSI__ ) || ! defined( __GNUC__ ) */
+#endif /* !(__DARWIN_NO_LONG_LONG) */
extern long double truncl(long double);
extern long double fmodl(long double, long double);
Owner

Fixes bug described here as provided by 10.7's libm

Can be patched into /usr/local/include without disturbing the system math.h using something like:

patch -p0 -o math.h < math.h.patch
sudo install math.h /usr/local/include

Note: This patch only applies to the x86/x86_64 math header. The math.h at /usr/include is a wrapper which conditionally includes Arm and PPC versions as well. If you need these, don't add this to /usr/local without adding an analogous wrapper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.