rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
-# Defend against gcc -ffast-math
-if test "$GCC" = yes; then
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-int
-main ()
-{
-#ifdef __FAST_MATH__
-choke me
-#endif
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
-else
- as_fn_error $? "do not put -ffast-math in CFLAGS" "$LINENO" 5
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
# Defend against clang being used on x86-32 without SSE2 enabled. As current
# versions of clang do not understand -fexcess-precision=standard, the use of
# x87 floating point operations leads to problems like isinf possibly returning
[AC_MSG_RESULT(no)
AC_MSG_ERROR([cannot proceed])])
-# Defend against gcc -ffast-math
-if test "$GCC" = yes; then
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [@%:@ifdef __FAST_MATH__
-choke me
-@%:@endif])], [], [AC_MSG_ERROR([do not put -ffast-math in CFLAGS])])
-fi
-
# Defend against clang being used on x86-32 without SSE2 enabled. As current
# versions of clang do not understand -fexcess-precision=standard, the use of
# x87 floating point operations leads to problems like isinf possibly returning
#include "utils/skipsupport.h"
#include "utils/sortsupport.h"
-/*
- * gcc's -ffast-math switch breaks routines that expect exact results from
- * expressions like timeval / SECS_PER_HOUR, where timeval is double.
- */
-#ifdef __FAST_MATH__
-#error -ffast-math is known to break this code
-#endif
-
/* common code for timetypmodin and timetztypmodin */
static int32
#include "utils/sortsupport.h"
+/*
+ * Reject building with gcc's -ffast-math switch. It breaks our handling of
+ * float Infinity and NaN values (via -ffinite-math-only), causes results to
+ * be less accurate than expected (via -funsafe-math-optimizations and
+ * -fexcess-precision=fast), and causes some math error reports to be missed
+ * (via -fno-math-errno). Unfortunately we can't easily detect cases where
+ * those options were given individually, but this at least catches the most
+ * obvious case.
+ *
+ * We test this only here, not in any header file, to allow extensions to use
+ * -ffast-math if they need to. But the inline functions in float.h will
+ * misbehave in such an extension, so its authors had better be careful.
+ */
+#ifdef __FAST_MATH__
+#error -ffast-math is known to break this code
+#endif
+
/*
* Configurable GUC parameter
*
#include "utils/skipsupport.h"
#include "utils/sortsupport.h"
-/*
- * gcc's -ffast-math switch breaks routines that expect exact results from
- * expressions like timeval / SECS_PER_HOUR, where timeval is double.
- */
-#ifdef __FAST_MATH__
-#error -ffast-math is known to break this code
-#endif
/* Set at postmaster start */
TimestampTz PgStartTime;
#include <math.h>
#include <limits.h>
-#ifdef __FAST_MATH__
-#error -ffast-math is known to break this code
-#endif
-
#include "common/string.h"
#include "dt.h"
#include "pgtypes_error.h"
#include <limits.h>
#include <math.h>
-#ifdef __FAST_MATH__
-#error -ffast-math is known to break this code
-#endif
-
#include "common/int.h"
#include "dt.h"
#include "pgtypes_date.h"