Commit bb0a9581 by Nathan Froyd Committed by Nathan Froyd

re PR preprocessor/45038 (__DBL_MIN__ result in old-style-cast)

gcc/c-family/
	PR preprocessor/45038
	* c-cppbuiltin.c (c_cpp_builtins): Use different format for C++
	dialects.

gcc/testsuite/
	PR preprocessor/45038
	* g++.dg/pr45038.C: New test.

From-SVN: r166756
parent c636a4fb
2010-11-15 Nathan Froyd <froydnj@codesourcery.com>
PR preprocessor/45038
* c-cppbuiltin.c (c_cpp_builtins): Use different format for C++
dialects.
2010-11-12 Joseph Myers <joseph@codesourcery.com>
* c-common.h (c_family_lang_mask): Declare.
......
......@@ -657,9 +657,13 @@ c_cpp_builtins (cpp_reader *pfile)
/* Cast the double precision constants. This is needed when single
precision constants are specified or when pragma FLOAT_CONST_DECIMAL64
is used. The correct result is computed by the compiler when using
macros that include a cast. */
builtin_define_float_constants ("DBL", "L", "((double)%s)", "",
double_type_node);
macros that include a cast. We use a different cast for C++ to avoid
problems with -Wold-style-cast. */
builtin_define_float_constants ("DBL", "L",
(c_dialect_cxx ()
? "double(%s)"
: "((double)%s)"),
"", double_type_node);
builtin_define_float_constants ("LDBL", "L", "%s", "L",
long_double_type_node);
......
2010-11-15 Nathan Froyd <froydnj@codesourcery.com>
PR preprocessor/45038
* g++.dg/pr45038.C: New test.
2010-11-15 Richard Guenther <rguenther@suse.de>
PR tree-optimization/46467
......
// PR preprocessor/45038
// { dg-do compile }
// { dg-options "-Werror -Wold-style-cast" }
double f(void)
{
// We used to produce old-style casts for this.
return __DBL_MIN__;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment