public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH]: Add wctype builtin functions
@ 2004-03-26  0:56 Kaveh R. Ghazi
  2004-03-26  1:26 ` Joseph S. Myers
  0 siblings, 1 reply; 4+ messages in thread
From: Kaveh R. Ghazi @ 2004-03-26  0:56 UTC (permalink / raw)
  To: gcc-patches

This patch adds some wctype builtin functions so we can mark their
attributes.  I made them all C99 and "pure".

Bootstrapped on sparc-sun-solaris2.7, no regressions and the new
testcase passes.

Ok for mainline?

		Thanks,
		--Kaveh


2004-03-25  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* builtin-types.def (BT_WINT, BT_FN_INT_WINT, BT_FN_WINT_WINT): New.
	* builtins.def: Add wctype builtins.
	* doc/extend.texi: Likewise.
testsuite:
	* gcc.dg/torture/builtin-wctype-1.c: New test.
	
diff -rup orig/egcc-CVS20040324/gcc/builtin-types.def egcc-CVS20040324/gcc/builtin-types.def
--- orig/egcc-CVS20040324/gcc/builtin-types.def	Mon Feb  9 20:01:46 2004
+++ egcc-CVS20040324/gcc/builtin-types.def	Thu Mar 25 10:10:43 2004
@@ -82,6 +82,7 @@ DEF_PRIMITIVE_TYPE (BT_DOUBLE_PTR, doubl
 DEF_PRIMITIVE_TYPE (BT_LONGDOUBLE_PTR, long_double_ptr_type_node)
 DEF_PRIMITIVE_TYPE (BT_SIZE, size_type_node)
 DEF_PRIMITIVE_TYPE (BT_SSIZE, signed_size_type_node)
+DEF_PRIMITIVE_TYPE (BT_WINT, wint_type_node)
 DEF_PRIMITIVE_TYPE (BT_STRING, string_type_node)
 DEF_PRIMITIVE_TYPE (BT_CONST_STRING, const_string_type_node)
 
@@ -144,6 +145,8 @@ DEF_FUNCTION_TYPE_1 (BT_FN_LONGDOUBLE_CO
 		     BT_LONGDOUBLE, BT_CONST_STRING)
 DEF_FUNCTION_TYPE_1 (BT_FN_STRING_CONST_STRING, BT_STRING, BT_CONST_STRING)
 DEF_FUNCTION_TYPE_1 (BT_FN_WORD_PTR, BT_WORD, BT_PTR)
+DEF_FUNCTION_TYPE_1 (BT_FN_INT_WINT, BT_INT, BT_WINT)
+DEF_FUNCTION_TYPE_1 (BT_FN_WINT_WINT, BT_WINT, BT_WINT)
 
 DEF_FUNCTION_TYPE_2 (BT_FN_VOID_PTR_INT, BT_VOID, BT_PTR, BT_INT)
 DEF_FUNCTION_TYPE_2 (BT_FN_STRING_STRING_CONST_STRING, 
diff -rup orig/egcc-CVS20040324/gcc/builtins.def egcc-CVS20040324/gcc/builtins.def
--- orig/egcc-CVS20040324/gcc/builtins.def	Thu Mar 25 10:04:32 2004
+++ egcc-CVS20040324/gcc/builtins.def	Thu Mar 25 10:14:40 2004
@@ -509,6 +509,22 @@ DEF_EXT_LIB_BUILTIN    (BUILT_IN_TOASCII
 DEF_LIB_BUILTIN        (BUILT_IN_TOLOWER, "tolower", BT_FN_INT_INT, ATTR_PURE_NOTHROW_LIST)
 DEF_LIB_BUILTIN        (BUILT_IN_TOUPPER, "toupper", BT_FN_INT_INT, ATTR_PURE_NOTHROW_LIST)
 
+/* Category: wctype builtins.  */
+DEF_C99_BUILTIN        (BUILT_IN_ISWALNUM, "iswalnum", BT_FN_INT_WINT, ATTR_PURE_NOTHROW_LIST)
+DEF_C99_BUILTIN        (BUILT_IN_ISWALPHA, "iswalpha", BT_FN_INT_WINT, ATTR_PURE_NOTHROW_LIST)
+DEF_C99_BUILTIN        (BUILT_IN_ISWBLANK, "iswblank", BT_FN_INT_WINT, ATTR_PURE_NOTHROW_LIST)
+DEF_C99_BUILTIN        (BUILT_IN_ISWCNTRL, "iswcntrl", BT_FN_INT_WINT, ATTR_PURE_NOTHROW_LIST)
+DEF_C99_BUILTIN        (BUILT_IN_ISWDIGIT, "iswdigit", BT_FN_INT_WINT, ATTR_PURE_NOTHROW_LIST)
+DEF_C99_BUILTIN        (BUILT_IN_ISWGRAPH, "iswgraph", BT_FN_INT_WINT, ATTR_PURE_NOTHROW_LIST)
+DEF_C99_BUILTIN        (BUILT_IN_ISWLOWER, "iswlower", BT_FN_INT_WINT, ATTR_PURE_NOTHROW_LIST)
+DEF_C99_BUILTIN        (BUILT_IN_ISWPRINT, "iswprint", BT_FN_INT_WINT, ATTR_PURE_NOTHROW_LIST)
+DEF_C99_BUILTIN        (BUILT_IN_ISWPUNCT, "iswpunct", BT_FN_INT_WINT, ATTR_PURE_NOTHROW_LIST)
+DEF_C99_BUILTIN        (BUILT_IN_ISWSPACE, "iswspace", BT_FN_INT_WINT, ATTR_PURE_NOTHROW_LIST)
+DEF_C99_BUILTIN        (BUILT_IN_ISWUPPER, "iswupper", BT_FN_INT_WINT, ATTR_PURE_NOTHROW_LIST)
+DEF_C99_BUILTIN        (BUILT_IN_ISWXDIGIT, "iswxdigit", BT_FN_INT_WINT, ATTR_PURE_NOTHROW_LIST)
+DEF_C99_BUILTIN        (BUILT_IN_TOWLOWER, "towlower", BT_FN_WINT_WINT, ATTR_PURE_NOTHROW_LIST)
+DEF_C99_BUILTIN        (BUILT_IN_TOWUPPER, "towupper", BT_FN_WINT_WINT, ATTR_PURE_NOTHROW_LIST)
+
 /* Category: miscellaneous builtins.  */
 DEF_LIB_BUILTIN        (BUILT_IN_ABORT, "abort", BT_FN_VOID, ATTR_NORETURN_NOTHROW_LIST)
 DEF_LIB_BUILTIN        (BUILT_IN_ABS, "abs", BT_FN_INT_INT, ATTR_CONST_NOTHROW_LIST)
diff -rup orig/egcc-CVS20040324/gcc/doc/extend.texi egcc-CVS20040324/gcc/doc/extend.texi
--- orig/egcc-CVS20040324/gcc/doc/extend.texi	Thu Mar 25 10:04:32 2004
+++ egcc-CVS20040324/gcc/doc/extend.texi	Thu Mar 25 10:27:19 2004
@@ -4898,6 +4898,18 @@ v4si f (v4si a, v4si b, v4si c)
 @findex ispunct
 @findex isspace
 @findex isupper
+@findex iswalnum
+@findex iswalpha
+@findex iswblank
+@findex iswcntrl
+@findex iswdigit
+@findex iswgraph
+@findex iswlower
+@findex iswprint
+@findex iswpunct
+@findex iswspace
+@findex iswupper
+@findex iswxdigit
 @findex isxdigit
 @findex j0
 @findex j0f
@@ -5042,6 +5054,8 @@ v4si f (v4si a, v4si b, v4si c)
 @findex toascii
 @findex tolower
 @findex toupper
+@findex towlower
+@findex towupper
 @findex trunc
 @findex truncf
 @findex truncl
@@ -5127,7 +5141,10 @@ The ISO C99 functions
 @code{fmaxf}, @code{fmaxl}, @code{fmax}, @code{fma}, @code{fminf},
 @code{fminl}, @code{fmin}, @code{hypotf}, @code{hypotl}, @code{hypot},
 @code{ilogbf}, @code{ilogbl}, @code{ilogb}, @code{imaxabs},
-@code{isblank}, @code{lgammaf}, @code{lgammal}, @code{lgamma},
+@code{isblank}, @code{iswalnum}, @code{iswalpha}, @code{iswblank},
+@code{iswcntrl}, @code{iswdigit}, @code{iswgraph}, @code{iswlower},
+@code{iswprint}, @code{iswpunct}, @code{iswspace}, @code{iswupper},
+@code{iswxdigit}, @code{lgammaf}, @code{lgammal}, @code{lgamma},
 @code{llabs}, @code{llrintf}, @code{llrintl}, @code{llrint},
 @code{llroundf}, @code{llroundl}, @code{llround}, @code{log1pf},
 @code{log1pl}, @code{log1p}, @code{log2f}, @code{log2l}, @code{log2},
@@ -5141,8 +5158,9 @@ The ISO C99 functions
 @code{roundf}, @code{roundl}, @code{round}, @code{scalblnf},
 @code{scalblnl}, @code{scalbln}, @code{scalbnf}, @code{scalbnl},
 @code{scalbn}, @code{snprintf}, @code{tgammaf}, @code{tgammal},
-@code{tgamma}, @code{truncf}, @code{truncl}, @code{trunc},
-@code{vfscanf}, @code{vscanf}, @code{vsnprintf} and @code{vsscanf}
+@code{tgamma}, @code{towlower}, @code{towupper}, @code{truncf},
+@code{truncl}, @code{trunc}, @code{vfscanf}, @code{vscanf},
+@code{vsnprintf} and @code{vsscanf}
 are handled as built-in functions
 except in strict ISO C90 mode (@option{-ansi} or @option{-std=c89}).
 
diff -rup orig/egcc-CVS20040324/gcc/testsuite/gcc.dg/torture/builtin-wctype-1.c egcc-CVS20040324/gcc/testsuite/gcc.dg/torture/builtin-wctype-1.c
--- orig/egcc-CVS20040324/gcc/testsuite/gcc.dg/torture/builtin-wctype-1.c	Thu Mar 25 10:28:25 2004
+++ egcc-CVS20040324/gcc/testsuite/gcc.dg/torture/builtin-wctype-1.c	Thu Mar 25 10:21:14 2004
@@ -0,0 +1,42 @@
+/* Copyright (C) 2004  Free Software Foundation.
+
+   Verify that built-in wctype function attributes are correctly set
+   by the compiler.
+
+   Written by Kaveh Ghazi, 2004-03-25.  */
+
+/* { dg-do link } */
+
+
+void test(int i)
+{
+  /* All of these ctype functions should be const/pure and thus
+     eliminated.  */
+#define TEST_CTYPE(FN) \
+  extern int FN(int); \
+  extern void link_failure_##FN(void); \
+  if (FN(i) != FN(i)) \
+    link_failure_##FN()
+  
+#ifdef __OPTIMIZE__
+  TEST_CTYPE(iswalnum);
+  TEST_CTYPE(iswalpha);
+  TEST_CTYPE(iswblank);
+  TEST_CTYPE(iswcntrl);
+  TEST_CTYPE(iswdigit);
+  TEST_CTYPE(iswgraph);
+  TEST_CTYPE(iswlower);
+  TEST_CTYPE(iswprint);
+  TEST_CTYPE(iswpunct);
+  TEST_CTYPE(iswspace);
+  TEST_CTYPE(iswupper);
+  TEST_CTYPE(iswxdigit);
+  TEST_CTYPE(towlower);
+  TEST_CTYPE(towupper);
+#endif /* __OPTIMIZE__ */
+}
+
+int main (void)
+{
+  return 0;
+}

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH]: Add wctype builtin functions
  2004-03-26  0:56 [PATCH]: Add wctype builtin functions Kaveh R. Ghazi
@ 2004-03-26  1:26 ` Joseph S. Myers
  2004-03-26 19:17   ` [PATCH]: Add wctype builtin functions [take 2] Kaveh R. Ghazi
  0 siblings, 1 reply; 4+ messages in thread
From: Joseph S. Myers @ 2004-03-26  1:26 UTC (permalink / raw)
  To: Kaveh R. Ghazi; +Cc: gcc-patches

On Thu, 25 Mar 2004, Kaveh R. Ghazi wrote:

> This patch adds some wctype builtin functions so we can mark their
> attributes.  I made them all C99 and "pure".

Except for iswblank, they should be C94 built-ins (a category we don't
currently have but which can easily be added).

(C94 has the peculiarity that functions with names *not* already reserved
in C90 were only reserved as identifiers with external linkage if some
translation unit includes <wchar.h> or <wctype.h>, so functions such as
wprintf which were added in C94 can only be C99 built-ins.  But C90
reserves is[a-z]* and to[a-z]* so this isn't a problem for the wctype
functions in this patch.)

-- 
Joseph S. Myers
jsm@polyomino.org.uk

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH]: Add wctype builtin functions [take 2]
  2004-03-26  1:26 ` Joseph S. Myers
@ 2004-03-26 19:17   ` Kaveh R. Ghazi
  2004-03-26 21:55     ` Roger Sayle
  0 siblings, 1 reply; 4+ messages in thread
From: Kaveh R. Ghazi @ 2004-03-26 19:17 UTC (permalink / raw)
  To: gcc-patches

This version of my patch incorporates suggestions by Joseph regarding
the wctype functions and C94.

Bootstrapped on sparc-sun-solaris2.7, the new testcase passes.
Full regtest underway.

Assuming no regressions, ok for mainline?

		Thanks,
		--Kaveh


2004-03-25  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* builtin-types.def (BT_WINT, BT_FN_INT_WINT, BT_FN_WINT_WINT): New.
	* builtins.def (DEF_C94_BUILTIN): New.  Add wctype builtins.
	* doc/extend.texi: Likewise.
testsuite:
	* gcc.dg/torture/builtin-wctype-1.c: New test.
	
diff -rup orig/egcc-CVS20040325/gcc/builtin-types.def egcc-CVS20040325/gcc/builtin-types.def
--- orig/egcc-CVS20040325/gcc/builtin-types.def	2004-02-09 20:01:46.000000000 -0500
+++ egcc-CVS20040325/gcc/builtin-types.def	2004-03-26 08:15:13.157236036 -0500
@@ -82,6 +82,7 @@ DEF_PRIMITIVE_TYPE (BT_DOUBLE_PTR, doubl
 DEF_PRIMITIVE_TYPE (BT_LONGDOUBLE_PTR, long_double_ptr_type_node)
 DEF_PRIMITIVE_TYPE (BT_SIZE, size_type_node)
 DEF_PRIMITIVE_TYPE (BT_SSIZE, signed_size_type_node)
+DEF_PRIMITIVE_TYPE (BT_WINT, wint_type_node)
 DEF_PRIMITIVE_TYPE (BT_STRING, string_type_node)
 DEF_PRIMITIVE_TYPE (BT_CONST_STRING, const_string_type_node)
 
@@ -144,6 +145,8 @@ DEF_FUNCTION_TYPE_1 (BT_FN_LONGDOUBLE_CO
 		     BT_LONGDOUBLE, BT_CONST_STRING)
 DEF_FUNCTION_TYPE_1 (BT_FN_STRING_CONST_STRING, BT_STRING, BT_CONST_STRING)
 DEF_FUNCTION_TYPE_1 (BT_FN_WORD_PTR, BT_WORD, BT_PTR)
+DEF_FUNCTION_TYPE_1 (BT_FN_INT_WINT, BT_INT, BT_WINT)
+DEF_FUNCTION_TYPE_1 (BT_FN_WINT_WINT, BT_WINT, BT_WINT)
 
 DEF_FUNCTION_TYPE_2 (BT_FN_VOID_PTR_INT, BT_VOID, BT_PTR, BT_INT)
 DEF_FUNCTION_TYPE_2 (BT_FN_STRING_STRING_CONST_STRING, 
diff -rup orig/egcc-CVS20040325/gcc/builtins.def egcc-CVS20040325/gcc/builtins.def
--- orig/egcc-CVS20040325/gcc/builtins.def	2004-03-25 12:52:04.000000000 -0500
+++ egcc-CVS20040325/gcc/builtins.def	2004-03-26 08:20:30.750618658 -0500
@@ -92,6 +92,13 @@ Software Foundation, 59 Temple Place - S
    	       true, true, true, ATTRS, false)
 
 /* Like DEF_LIB_BUILTIN, except that the function is only a part of
+   the standard in C94 or above.  */
+#undef DEF_C94_BUILTIN					
+#define DEF_C94_BUILTIN(ENUM, NAME, TYPE, ATTRS)	\
+  DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE,	\
+   	       true, true, !flag_isoc94, ATTRS, TARGET_C99_FUNCTIONS)
+
+/* Like DEF_LIB_BUILTIN, except that the function is only a part of
    the standard in C99 or above.  */
 #undef DEF_C99_BUILTIN					
 #define DEF_C99_BUILTIN(ENUM, NAME, TYPE, ATTRS)	\
@@ -509,6 +516,22 @@ DEF_EXT_LIB_BUILTIN    (BUILT_IN_TOASCII
 DEF_LIB_BUILTIN        (BUILT_IN_TOLOWER, "tolower", BT_FN_INT_INT, ATTR_PURE_NOTHROW_LIST)
 DEF_LIB_BUILTIN        (BUILT_IN_TOUPPER, "toupper", BT_FN_INT_INT, ATTR_PURE_NOTHROW_LIST)
 
+/* Category: wctype builtins.  */
+DEF_C94_BUILTIN        (BUILT_IN_ISWALNUM, "iswalnum", BT_FN_INT_WINT, ATTR_PURE_NOTHROW_LIST)
+DEF_C94_BUILTIN        (BUILT_IN_ISWALPHA, "iswalpha", BT_FN_INT_WINT, ATTR_PURE_NOTHROW_LIST)
+DEF_C99_BUILTIN        (BUILT_IN_ISWBLANK, "iswblank", BT_FN_INT_WINT, ATTR_PURE_NOTHROW_LIST)
+DEF_C94_BUILTIN        (BUILT_IN_ISWCNTRL, "iswcntrl", BT_FN_INT_WINT, ATTR_PURE_NOTHROW_LIST)
+DEF_C94_BUILTIN        (BUILT_IN_ISWDIGIT, "iswdigit", BT_FN_INT_WINT, ATTR_PURE_NOTHROW_LIST)
+DEF_C94_BUILTIN        (BUILT_IN_ISWGRAPH, "iswgraph", BT_FN_INT_WINT, ATTR_PURE_NOTHROW_LIST)
+DEF_C94_BUILTIN        (BUILT_IN_ISWLOWER, "iswlower", BT_FN_INT_WINT, ATTR_PURE_NOTHROW_LIST)
+DEF_C94_BUILTIN        (BUILT_IN_ISWPRINT, "iswprint", BT_FN_INT_WINT, ATTR_PURE_NOTHROW_LIST)
+DEF_C94_BUILTIN        (BUILT_IN_ISWPUNCT, "iswpunct", BT_FN_INT_WINT, ATTR_PURE_NOTHROW_LIST)
+DEF_C94_BUILTIN        (BUILT_IN_ISWSPACE, "iswspace", BT_FN_INT_WINT, ATTR_PURE_NOTHROW_LIST)
+DEF_C94_BUILTIN        (BUILT_IN_ISWUPPER, "iswupper", BT_FN_INT_WINT, ATTR_PURE_NOTHROW_LIST)
+DEF_C94_BUILTIN        (BUILT_IN_ISWXDIGIT, "iswxdigit", BT_FN_INT_WINT, ATTR_PURE_NOTHROW_LIST)
+DEF_C94_BUILTIN        (BUILT_IN_TOWLOWER, "towlower", BT_FN_WINT_WINT, ATTR_PURE_NOTHROW_LIST)
+DEF_C94_BUILTIN        (BUILT_IN_TOWUPPER, "towupper", BT_FN_WINT_WINT, ATTR_PURE_NOTHROW_LIST)
+
 /* Category: miscellaneous builtins.  */
 DEF_LIB_BUILTIN        (BUILT_IN_ABORT, "abort", BT_FN_VOID, ATTR_NORETURN_NOTHROW_LIST)
 DEF_LIB_BUILTIN        (BUILT_IN_ABS, "abs", BT_FN_INT_INT, ATTR_CONST_NOTHROW_LIST)
diff -rup orig/egcc-CVS20040325/gcc/doc/extend.texi egcc-CVS20040325/gcc/doc/extend.texi
--- orig/egcc-CVS20040325/gcc/doc/extend.texi	2004-03-25 12:52:04.000000000 -0500
+++ egcc-CVS20040325/gcc/doc/extend.texi	2004-03-26 08:37:43.943386207 -0500
@@ -4898,6 +4898,18 @@ v4si f (v4si a, v4si b, v4si c)
 @findex ispunct
 @findex isspace
 @findex isupper
+@findex iswalnum
+@findex iswalpha
+@findex iswblank
+@findex iswcntrl
+@findex iswdigit
+@findex iswgraph
+@findex iswlower
+@findex iswprint
+@findex iswpunct
+@findex iswspace
+@findex iswupper
+@findex iswxdigit
 @findex isxdigit
 @findex j0
 @findex j0f
@@ -5042,6 +5054,8 @@ v4si f (v4si a, v4si b, v4si c)
 @findex toascii
 @findex tolower
 @findex toupper
+@findex towlower
+@findex towupper
 @findex trunc
 @findex truncf
 @findex truncl
@@ -5127,13 +5141,13 @@ The ISO C99 functions
 @code{fmaxf}, @code{fmaxl}, @code{fmax}, @code{fma}, @code{fminf},
 @code{fminl}, @code{fmin}, @code{hypotf}, @code{hypotl}, @code{hypot},
 @code{ilogbf}, @code{ilogbl}, @code{ilogb}, @code{imaxabs},
-@code{isblank}, @code{lgammaf}, @code{lgammal}, @code{lgamma},
-@code{llabs}, @code{llrintf}, @code{llrintl}, @code{llrint},
-@code{llroundf}, @code{llroundl}, @code{llround}, @code{log1pf},
-@code{log1pl}, @code{log1p}, @code{log2f}, @code{log2l}, @code{log2},
-@code{logbf}, @code{logbl}, @code{logb}, @code{lrintf}, @code{lrintl},
-@code{lrint}, @code{lroundf}, @code{lroundl}, @code{lround},
-@code{nearbyintf}, @code{nearbyintl}, @code{nearbyint},
+@code{isblank}, @code{iswblank}, @code{lgammaf}, @code{lgammal},
+@code{lgamma}, @code{llabs}, @code{llrintf}, @code{llrintl},
+@code{llrint}, @code{llroundf}, @code{llroundl}, @code{llround},
+@code{log1pf}, @code{log1pl}, @code{log1p}, @code{log2f}, @code{log2l},
+@code{log2}, @code{logbf}, @code{logbl}, @code{logb}, @code{lrintf},
+@code{lrintl}, @code{lrint}, @code{lroundf}, @code{lroundl},
+@code{lround}, @code{nearbyintf}, @code{nearbyintl}, @code{nearbyint},
 @code{nextafterf}, @code{nextafterl}, @code{nextafter},
 @code{nexttowardf}, @code{nexttowardl}, @code{nexttoward},
 @code{remainderf}, @code{remainderl}, @code{remainder}, @code{remquof},
@@ -5160,6 +5174,14 @@ that are recognized in any mode since IS
 the purpose to which ISO C99 puts them.  All these functions have
 corresponding versions prefixed with @code{__builtin_}.
 
+The ISO C94 functions
+@code{iswalnum}, @code{iswalpha}, @code{iswcntrl}, @code{iswdigit},
+@code{iswgraph}, @code{iswlower}, @code{iswprint}, @code{iswpunct},
+@code{iswspace}, @code{iswupper}, @code{iswxdigit}, @code{towlower} and
+@code{towupper}
+are handled as built-in functions
+except in strict ISO C90 mode (@option{-ansi} or @option{-std=c89}).
+
 The ISO C90 functions
 @code{abort}, @code{abs}, @code{acos}, @code{asin}, @code{atan2},
 @code{atan}, @code{calloc}, @code{ceil}, @code{cosh}, @code{cos},
diff -rup orig/egcc-CVS20040325/gcc/testsuite/gcc.dg/torture/builtin-wctype-1.c egcc-CVS20040325/gcc/testsuite/gcc.dg/torture/builtin-wctype-1.c
--- orig/egcc-CVS20040325/gcc/testsuite/gcc.dg/torture/builtin-wctype-1.c	2004-03-26 08:25:35.734936736 -0500
+++ egcc-CVS20040325/gcc/testsuite/gcc.dg/torture/builtin-wctype-1.c	2004-03-26 08:15:13.197236410 -0500
@@ -0,0 +1,42 @@
+/* Copyright (C) 2004  Free Software Foundation.
+
+   Verify that built-in wctype function attributes are correctly set
+   by the compiler.
+
+   Written by Kaveh Ghazi, 2004-03-25.  */
+
+/* { dg-do link } */
+
+
+void test(int i)
+{
+  /* All of these ctype functions should be const/pure and thus
+     eliminated.  */
+#define TEST_CTYPE(FN) \
+  extern int FN(int); \
+  extern void link_failure_##FN(void); \
+  if (FN(i) != FN(i)) \
+    link_failure_##FN()
+  
+#ifdef __OPTIMIZE__
+  TEST_CTYPE(iswalnum);
+  TEST_CTYPE(iswalpha);
+  TEST_CTYPE(iswblank);
+  TEST_CTYPE(iswcntrl);
+  TEST_CTYPE(iswdigit);
+  TEST_CTYPE(iswgraph);
+  TEST_CTYPE(iswlower);
+  TEST_CTYPE(iswprint);
+  TEST_CTYPE(iswpunct);
+  TEST_CTYPE(iswspace);
+  TEST_CTYPE(iswupper);
+  TEST_CTYPE(iswxdigit);
+  TEST_CTYPE(towlower);
+  TEST_CTYPE(towupper);
+#endif /* __OPTIMIZE__ */
+}
+
+int main (void)
+{
+  return 0;
+}


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH]: Add wctype builtin functions [take 2]
  2004-03-26 19:17   ` [PATCH]: Add wctype builtin functions [take 2] Kaveh R. Ghazi
@ 2004-03-26 21:55     ` Roger Sayle
  0 siblings, 0 replies; 4+ messages in thread
From: Roger Sayle @ 2004-03-26 21:55 UTC (permalink / raw)
  To: Kaveh R. Ghazi; +Cc: gcc-patches


On Fri, 26 Mar 2004, Kaveh R. Ghazi wrote:
> 2004-03-25  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
>
> 	* builtin-types.def (BT_WINT, BT_FN_INT_WINT, BT_FN_WINT_WINT): New.
> 	* builtins.def (DEF_C94_BUILTIN): New.  Add wctype builtins.
> 	* doc/extend.texi: Likewise.
> testsuite:
> 	* gcc.dg/torture/builtin-wctype-1.c: New test.

Ok for mainline.

Roger
--

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-03-26 21:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-26  0:56 [PATCH]: Add wctype builtin functions Kaveh R. Ghazi
2004-03-26  1:26 ` Joseph S. Myers
2004-03-26 19:17   ` [PATCH]: Add wctype builtin functions [take 2] Kaveh R. Ghazi
2004-03-26 21:55     ` Roger Sayle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).