Commit ca4944e1 by Kaveh R. Ghazi Committed by Kaveh Ghazi

builtin-types.def (BT_WINT, [...]): New.

	* 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.

From-SVN: r80011
parent aaaf25eb
2004-03-27 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.
2004-03-26 Diego Novillo <dnovillo@redhat.com> 2004-03-26 Diego Novillo <dnovillo@redhat.com>
* c-typeck.c (comptypes): Replace calls to TYPE_DOMAIN * c-typeck.c (comptypes): Replace calls to TYPE_DOMAIN
......
...@@ -82,6 +82,7 @@ DEF_PRIMITIVE_TYPE (BT_DOUBLE_PTR, double_ptr_type_node) ...@@ -82,6 +82,7 @@ DEF_PRIMITIVE_TYPE (BT_DOUBLE_PTR, double_ptr_type_node)
DEF_PRIMITIVE_TYPE (BT_LONGDOUBLE_PTR, long_double_ptr_type_node) DEF_PRIMITIVE_TYPE (BT_LONGDOUBLE_PTR, long_double_ptr_type_node)
DEF_PRIMITIVE_TYPE (BT_SIZE, size_type_node) DEF_PRIMITIVE_TYPE (BT_SIZE, size_type_node)
DEF_PRIMITIVE_TYPE (BT_SSIZE, signed_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_STRING, string_type_node)
DEF_PRIMITIVE_TYPE (BT_CONST_STRING, const_string_type_node) DEF_PRIMITIVE_TYPE (BT_CONST_STRING, const_string_type_node)
...@@ -144,6 +145,8 @@ DEF_FUNCTION_TYPE_1 (BT_FN_LONGDOUBLE_CONST_STRING, ...@@ -144,6 +145,8 @@ DEF_FUNCTION_TYPE_1 (BT_FN_LONGDOUBLE_CONST_STRING,
BT_LONGDOUBLE, BT_CONST_STRING) 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_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_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_VOID_PTR_INT, BT_VOID, BT_PTR, BT_INT)
DEF_FUNCTION_TYPE_2 (BT_FN_STRING_STRING_CONST_STRING, DEF_FUNCTION_TYPE_2 (BT_FN_STRING_STRING_CONST_STRING,
......
...@@ -92,6 +92,13 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -92,6 +92,13 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
true, true, true, ATTRS, false) true, true, true, ATTRS, false)
/* Like DEF_LIB_BUILTIN, except that the function is only a part of /* 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. */ the standard in C99 or above. */
#undef DEF_C99_BUILTIN #undef DEF_C99_BUILTIN
#define DEF_C99_BUILTIN(ENUM, NAME, TYPE, ATTRS) \ #define DEF_C99_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
...@@ -509,6 +516,22 @@ DEF_EXT_LIB_BUILTIN (BUILT_IN_TOASCII, "toascii", BT_FN_INT_INT, ATTR_CONST_N ...@@ -509,6 +516,22 @@ DEF_EXT_LIB_BUILTIN (BUILT_IN_TOASCII, "toascii", BT_FN_INT_INT, ATTR_CONST_N
DEF_LIB_BUILTIN (BUILT_IN_TOLOWER, "tolower", BT_FN_INT_INT, ATTR_PURE_NOTHROW_LIST) 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) 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. */ /* Category: miscellaneous builtins. */
DEF_LIB_BUILTIN (BUILT_IN_ABORT, "abort", BT_FN_VOID, ATTR_NORETURN_NOTHROW_LIST) 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) DEF_LIB_BUILTIN (BUILT_IN_ABS, "abs", BT_FN_INT_INT, ATTR_CONST_NOTHROW_LIST)
......
...@@ -4898,6 +4898,18 @@ v4si f (v4si a, v4si b, v4si c) ...@@ -4898,6 +4898,18 @@ v4si f (v4si a, v4si b, v4si c)
@findex ispunct @findex ispunct
@findex isspace @findex isspace
@findex isupper @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 isxdigit
@findex j0 @findex j0
@findex j0f @findex j0f
...@@ -5042,6 +5054,8 @@ v4si f (v4si a, v4si b, v4si c) ...@@ -5042,6 +5054,8 @@ v4si f (v4si a, v4si b, v4si c)
@findex toascii @findex toascii
@findex tolower @findex tolower
@findex toupper @findex toupper
@findex towlower
@findex towupper
@findex trunc @findex trunc
@findex truncf @findex truncf
@findex truncl @findex truncl
...@@ -5127,13 +5141,13 @@ The ISO C99 functions ...@@ -5127,13 +5141,13 @@ The ISO C99 functions
@code{fmaxf}, @code{fmaxl}, @code{fmax}, @code{fma}, @code{fminf}, @code{fmaxf}, @code{fmaxl}, @code{fmax}, @code{fma}, @code{fminf},
@code{fminl}, @code{fmin}, @code{hypotf}, @code{hypotl}, @code{hypot}, @code{fminl}, @code{fmin}, @code{hypotf}, @code{hypotl}, @code{hypot},
@code{ilogbf}, @code{ilogbl}, @code{ilogb}, @code{imaxabs}, @code{ilogbf}, @code{ilogbl}, @code{ilogb}, @code{imaxabs},
@code{isblank}, @code{lgammaf}, @code{lgammal}, @code{lgamma}, @code{isblank}, @code{iswblank}, @code{lgammaf}, @code{lgammal},
@code{llabs}, @code{llrintf}, @code{llrintl}, @code{llrint}, @code{lgamma}, @code{llabs}, @code{llrintf}, @code{llrintl},
@code{llroundf}, @code{llroundl}, @code{llround}, @code{log1pf}, @code{llrint}, @code{llroundf}, @code{llroundl}, @code{llround},
@code{log1pl}, @code{log1p}, @code{log2f}, @code{log2l}, @code{log2}, @code{log1pf}, @code{log1pl}, @code{log1p}, @code{log2f}, @code{log2l},
@code{logbf}, @code{logbl}, @code{logb}, @code{lrintf}, @code{lrintl}, @code{log2}, @code{logbf}, @code{logbl}, @code{logb}, @code{lrintf},
@code{lrint}, @code{lroundf}, @code{lroundl}, @code{lround}, @code{lrintl}, @code{lrint}, @code{lroundf}, @code{lroundl},
@code{nearbyintf}, @code{nearbyintl}, @code{nearbyint}, @code{lround}, @code{nearbyintf}, @code{nearbyintl}, @code{nearbyint},
@code{nextafterf}, @code{nextafterl}, @code{nextafter}, @code{nextafterf}, @code{nextafterl}, @code{nextafter},
@code{nexttowardf}, @code{nexttowardl}, @code{nexttoward}, @code{nexttowardf}, @code{nexttowardl}, @code{nexttoward},
@code{remainderf}, @code{remainderl}, @code{remainder}, @code{remquof}, @code{remainderf}, @code{remainderl}, @code{remainder}, @code{remquof},
...@@ -5160,6 +5174,14 @@ that are recognized in any mode since ISO C90 reserves these names for ...@@ -5160,6 +5174,14 @@ that are recognized in any mode since ISO C90 reserves these names for
the purpose to which ISO C99 puts them. All these functions have the purpose to which ISO C99 puts them. All these functions have
corresponding versions prefixed with @code{__builtin_}. 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 The ISO C90 functions
@code{abort}, @code{abs}, @code{acos}, @code{asin}, @code{atan2}, @code{abort}, @code{abs}, @code{acos}, @code{asin}, @code{atan2},
@code{atan}, @code{calloc}, @code{ceil}, @code{cosh}, @code{cos}, @code{atan}, @code{calloc}, @code{ceil}, @code{cosh}, @code{cos},
......
2004-03-27 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* gcc.dg/torture/builtin-wctype-1.c: New test.
2004-03-26 James A. Morrison <ja2morri@uwaterloo.ca> 2004-03-26 James A. Morrison <ja2morri@uwaterloo.ca>
* gcc.dg/20001013-1.c: Run on 32-bit and 64-bit SPARC. * gcc.dg/20001013-1.c: Run on 32-bit and 64-bit SPARC.
......
/* 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;
}
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