re PR c/14635 (nan functions should not be C90 built-ins)
authorJoseph Myers <jsm@polyomino.org.uk>
Sat, 20 Mar 2004 10:19:11 +0000 (10:19 +0000)
committerJoseph Myers <jsm28@gcc.gnu.org>
Sat, 20 Mar 2004 10:19:11 +0000 (10:19 +0000)
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

gcc/ChangeLog
gcc/builtins.def
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/builtins-1.c
gcc/testsuite/gcc.dg/builtins-30.c
gcc/testsuite/gcc.dg/builtins-35.c [new file with mode: 0644]

index 551e551..56e9102 100644 (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.
index d8c772f..6148c41 100644 (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)
index 155127d..dc7239b 100644 (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.
index 18c45d1..74144f7 100644 (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)
index c910fe4..9ed0be5 100644 (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);
diff --git a/gcc/testsuite/gcc.dg/builtins-35.c b/gcc/testsuite/gcc.dg/builtins-35.c
new file mode 100644 (file)
index 0000000..f898707
--- /dev/null
@@ -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;