Jim Meyering <[EMAIL PROTECTED]> writes: > In compiling coreutils with -std=gnu99, I see this new warning: > > xstrtod.c:33: warning: ignoring #pragma STDC FENV_ACCESS > > Why was this code needed?
The C standard says that all code that runs when the rounding mode is altered must be compiled with that pragma. At the time that code was written, coreutils was altering the rounding mode in order to support df. However, coreutils no longer alters the rounding mode (it solves the problem a different way). However, strictly speaking coreutils should still alter the rounding mode, for "sleep". For example, on my Debian stable x86 host the command "sleep 100000000.000000001" neglects the fraction due to rounding errors. This violates the basic promise of "sleep" that it will sleep for at least as many seconds as asked. The "right" way to fix this probably involves having a compile-time switch by the application saying whether it messes with the rounding modes and the pragma is needed in gnulib modules that use floating-point, and I suppose we could also check whether GCC is running in the mode where it generates that bogus warning. However, for now the simplest thing to do is to remove the pragma so I installed the following patch, in both gnulib and coreutils. 2005-11-15 Paul Eggert <[EMAIL PROTECTED]> * xstrtod.c: Don't bother with #pragma STDC FENV_ACCESS ON, as coreutils no longer futzes with rounding modes. --- xstrtod.c.~1.11.~ 2005-05-14 00:58:07.000000000 -0700 +++ xstrtod.c 2005-11-15 10:11:17.000000000 -0800 @@ -1,6 +1,7 @@ /* error-checking interface to strtod-like functions - Copyright (C) 1996, 1999, 2000, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1996, 1999, 2000, 2003, 2004, 2005 Free Software + Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -28,11 +29,6 @@ #include <limits.h> #include <stdio.h> -/* Tell the compiler that non-default rounding modes are used. */ -#if 199901 <= __STDC_VERSION__ - #pragma STDC FENV_ACCESS ON -#endif - /* An interface to strtod that encapsulates all the error checking one should usually perform. Like strtod, but upon successful conversion put the result in *RESULT and return true. Return _______________________________________________ bug-gnulib mailing list bug-gnulib@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnulib