This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch 6/11] Migrate excess precision logic to use TARGET_EXCESS_PRECISION
On Fri, 30 Sep 2016, James Greenhalgh wrote:
> /* float.h needs to know this. */
> + /* We already have the option -fno-fp-int-builtin-inexact to ensure
> + certain built-in functions follow TS 18661-1 semantics. It might be
> + reasonable to have a new option to enable FLT_EVAL_METHOD using new
> + values. However, I'd be inclined to think that such an option should
> + be on by default for -std=gnu*, only off for strict conformance modes.
> + (There would be both __FLT_EVAL_METHOD__ and __FLT_EVAL_METHOD_C99__,
> + say, predefined macros, so that <float.h> could also always use the
> + new value if __STDC_WANT_IEC_60559_TYPES_EXT__ is defined.) */
This comment makes no sense in the context. The comment should not be
talking about some other option for a different issue, or about
half-thought-out ideas for how something might be implemented; comments
need to relate to the actual code (which in this case is obvious and not
in need of comments beyond saying what the macro semantics are). In any
case, this patch does not achieve the proposed semantics, since there is
no change to ginclude/float.h.
The goal is: if the user's options imply new FLT_EVAL_METHOD values are
OK, *or* they defined __STDC_WANT_IEC_60559_TYPES_EXT__ before including
<float.h>, it should use the appropriate TS 18661-3 value. Otherwise
(strict standards modes for existing standards, no
__STDC_WANT_IEC_60559_TYPES_EXT__) it should use a C11 value.
So in a strict standards mode you need to predefine macros with both
choices of values and let <float.h> choose between them. One possibility
is: __FLT_EVAL_METHOD_C99__ is the value to use when
__STDC_WANT_IEC_60559_TYPES_EXT__ is not defined, __FLT_EVAL_METHOD__ is
the value to use when it is defined. Or some other arrangement, with or
without a macro saying what setting you have for the new option. But you
can't avoid changing <float.h>.
Tests then should be testing the value of FLT_EVAL_METHOD from <float.h>,
*not* the internal macros predefined by the compiler.
--
Joseph S. Myers
joseph@codesourcery.com