From 3bd281de635470875cc6e5887a08bf37f0841890 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Thu, 5 Nov 2009 20:48:01 -0700 Subject: [PATCH] strtod: detect darwin bug * m4/strtod.m4 (gl_FUNC_STRTOD): Filter out darwin bug on "nan(". Reported by Leo Davis. Signed-off-by: Eric Blake --- ChangeLog | 4 ++++ m4/strtod.m4 | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1635de2da9..23f8426668 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2009-11-05 Eric Blake + strtod: detect darwin bug + * m4/strtod.m4 (gl_FUNC_STRTOD): Filter out darwin bug on "nan(". + Reported by Leo Davis. + freopen-safer: new module * modules/freopen-safer: New module. * m4/stdio-safer.m4 (gl_FREOPEN_SAFER): New macro. diff --git a/m4/strtod.m4 b/m4/strtod.m4 index 9769436cb2..3bc8770258 100644 --- a/m4/strtod.m4 +++ b/m4/strtod.m4 @@ -1,4 +1,4 @@ -# strtod.m4 serial 12 +# strtod.m4 serial 13 dnl Copyright (C) 2002-2003, 2006-2009 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -64,6 +64,14 @@ numeric_equal (double x, double y) if (numeric_equal (value, value) || term != (string + 5)) return 1; } + { + /* darwin 10.6.1 misparses "nan(". */ + const char *string = "nan("; + char *term; + double value = strtod (string, &term); + if (numeric_equal (value, value) || term != (string + 3)) + return 1; + } ]])], [gl_cv_func_strtod_works=yes], [gl_cv_func_strtod_works=no], -- 2.30.2