re PR c/14635 (nan functions should not be C90 built-ins)

PR c/14635
	* builtins.def (nan, nanf, nanl, nans, nansf, nansl): Change to
	DEF_GCC_BUILTIN.

testsuite:
	* builtins-1.c (nan, nans): Don't test.
	* builtins-30.c: Don't use nan, nanf, nanl.
	* builtins-35.c: New test.

From-SVN: r79736
This commit is contained in:
Joseph Myers 2004-03-20 10:19:11 +00:00 committed by Joseph Myers
parent 2787b59a7f
commit b1c2d04a28
6 changed files with 29 additions and 12 deletions

View File

@ -1,3 +1,9 @@
2004-03-20 Joseph S. Myers <jsm@polyomino.org.uk>
PR c/14635
* builtins.def (nan, nanf, nanl, nans, nansf, nansl): Change to
DEF_GCC_BUILTIN.
2004-03-20 Richard Sandiford <rsandifo@redhat.com>
* Makefile.in (dojump.o): Depend on $(GGC_H) and dojump.h.

View File

@ -279,12 +279,12 @@ DEF_C99_BUILTIN (BUILT_IN_LROUNDL, "lroundl", BT_FN_LONG_LONGDOUBLE, ATTR
DEF_LIB_BUILTIN (BUILT_IN_MODF, "modf", BT_FN_DOUBLE_DOUBLE_DOUBLEPTR, ATTR_MATHFN_FPROUNDING_STORE)
DEF_C99_C90RES_BUILTIN (BUILT_IN_MODFF, "modff", BT_FN_FLOAT_FLOAT_FLOATPTR, ATTR_MATHFN_FPROUNDING_STORE)
DEF_C99_C90RES_BUILTIN (BUILT_IN_MODFL, "modfl", BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLEPTR, ATTR_MATHFN_FPROUNDING_STORE)
DEF_LIB_BUILTIN (BUILT_IN_NAN, "nan", BT_FN_DOUBLE_CONST_STRING, ATTR_CONST_NOTHROW_NONNULL_1)
DEF_LIB_BUILTIN (BUILT_IN_NANF, "nanf", BT_FN_FLOAT_CONST_STRING, ATTR_CONST_NOTHROW_NONNULL_1)
DEF_LIB_BUILTIN (BUILT_IN_NANL, "nanl", BT_FN_LONGDOUBLE_CONST_STRING, ATTR_CONST_NOTHROW_NONNULL_1)
DEF_LIB_BUILTIN (BUILT_IN_NANS, "nans", BT_FN_DOUBLE_CONST_STRING, ATTR_CONST_NOTHROW_NONNULL_1)
DEF_LIB_BUILTIN (BUILT_IN_NANSF, "nansf", BT_FN_FLOAT_CONST_STRING, ATTR_CONST_NOTHROW_NONNULL_1)
DEF_LIB_BUILTIN (BUILT_IN_NANSL, "nansl", BT_FN_LONGDOUBLE_CONST_STRING, ATTR_CONST_NOTHROW_NONNULL_1)
DEF_GCC_BUILTIN (BUILT_IN_NAN, "nan", BT_FN_DOUBLE_CONST_STRING, ATTR_CONST_NOTHROW_NONNULL_1)
DEF_GCC_BUILTIN (BUILT_IN_NANF, "nanf", BT_FN_FLOAT_CONST_STRING, ATTR_CONST_NOTHROW_NONNULL_1)
DEF_GCC_BUILTIN (BUILT_IN_NANL, "nanl", BT_FN_LONGDOUBLE_CONST_STRING, ATTR_CONST_NOTHROW_NONNULL_1)
DEF_GCC_BUILTIN (BUILT_IN_NANS, "nans", BT_FN_DOUBLE_CONST_STRING, ATTR_CONST_NOTHROW_NONNULL_1)
DEF_GCC_BUILTIN (BUILT_IN_NANSF, "nansf", BT_FN_FLOAT_CONST_STRING, ATTR_CONST_NOTHROW_NONNULL_1)
DEF_GCC_BUILTIN (BUILT_IN_NANSL, "nansl", BT_FN_LONGDOUBLE_CONST_STRING, ATTR_CONST_NOTHROW_NONNULL_1)
DEF_C99_BUILTIN (BUILT_IN_NEARBYINT, "nearbyint", BT_FN_DOUBLE_DOUBLE, ATTR_CONST_NOTHROW_LIST)
DEF_C99_BUILTIN (BUILT_IN_NEARBYINTF, "nearbyintf", BT_FN_FLOAT_FLOAT, ATTR_CONST_NOTHROW_LIST)
DEF_C99_BUILTIN (BUILT_IN_NEARBYINTL, "nearbyintl", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_CONST_NOTHROW_LIST)

View File

@ -1,3 +1,10 @@
2004-03-20 Joseph S. Myers <jsm@polyomino.org.uk>
PR c/14635
* builtins-1.c (nan, nans): Don't test.
* builtins-30.c: Don't use nan, nanf, nanl.
* builtins-35.c: New test.
2004-03-19 Ziemowit Laski <zlaski@apple.com>
* g++.dg/ext/altivec-6.C: New test.

View File

@ -151,8 +151,6 @@ FPTEST1 (logb)
FPTEST1RET (lrint, long)
FPTEST1RET (lround, long)
FPTEST2FPP2 (modf)
FPTEST1ARG (nan, char *)
FPTEST1ARG (nans, char *)
FPTEST1 (nearbyint)
FPTEST2 (nextafter)
FPTEST2 (nexttoward)

View File

@ -6,21 +6,21 @@ extern double strtod (const char *, char **);
/* A built-in function may be overridden by an old-style definition
specifying too few arguments... */
double nan ()
double cos ()
{ /* { dg-warning "shadowing built-in" } */
return strtod ("nan", 0);
}
/* the right number, but the wrong type, arguments... */
float nanf (foo)
double sin (foo)
int foo UNUSED; /* { dg-warning "shadowing built-in" } */
{
return strtod ("nan", 0);
}
/* or too many arguments. */
long double nanl (foo, bar)
const char *foo UNUSED; /* { dg-warning "shadowing built-in" } */
long double cosl (foo, bar)
long double foo UNUSED; /* { dg-warning "shadowing built-in" } */
int bar UNUSED;
{
return strtod ("nan", 0);

View File

@ -0,0 +1,6 @@
/* Test that nan functions are not built-in in C90 mode. Bug 14635. */
/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
/* { dg-do compile } */
/* { dg-options "-std=c89" } */
int nan, nanf, nanl, nans, nansf, nansl;