builtins.def (BUILT_IN_STPNCPY, [...]): New.

* builtins.def (BUILT_IN_STPNCPY, BUILT_IN_STRCASECMP,
	BUILT_IN_STRNCASECMP): New.
	* doc/extend.texi: Document stpncpy, strcasecmp, strncasecmp
	and strndup.

testsuite:
	* gcc.dg/nonnull-3.c: Also test __builtin_stpncpy,
	__builtin_strcasecmp and __builtin_strncasecmp.

From-SVN: r97498
This commit is contained in:
Kaveh R. Ghazi 2005-04-03 22:08:12 +00:00 committed by Kaveh Ghazi
parent a5d58aeb44
commit e905ac64c0
5 changed files with 29 additions and 3 deletions

View File

@ -1,3 +1,10 @@
2005-04-03 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* builtins.def (BUILT_IN_STPNCPY, BUILT_IN_STRCASECMP,
BUILT_IN_STRNCASECMP): New.
* doc/extend.texi: Document stpncpy, strcasecmp, strncasecmp
and strndup.
2005-04-03 Richard Earnshaw <richard.earnshaw@arm.com>
PR target/14812

View File

@ -462,6 +462,8 @@ DEF_EXT_LIB_BUILTIN (BUILT_IN_MEMPCPY, "mempcpy", BT_FN_PTR_PTR_CONST_PTR_SIZ
DEF_LIB_BUILTIN (BUILT_IN_MEMSET, "memset", BT_FN_PTR_PTR_INT_SIZE, ATTR_NOTHROW_NONNULL)
DEF_EXT_LIB_BUILTIN (BUILT_IN_RINDEX, "rindex", BT_FN_STRING_CONST_STRING_INT, ATTR_PURE_NOTHROW_NONNULL)
DEF_EXT_LIB_BUILTIN (BUILT_IN_STPCPY, "stpcpy", BT_FN_STRING_STRING_CONST_STRING, ATTR_NOTHROW_NONNULL)
DEF_EXT_LIB_BUILTIN (BUILT_IN_STPNCPY, "stpncpy", BT_FN_STRING_STRING_CONST_STRING_SIZE, ATTR_NOTHROW_NONNULL)
DEF_EXT_LIB_BUILTIN (BUILT_IN_STRCASECMP, "strcasecmp", BT_FN_INT_CONST_STRING_CONST_STRING, ATTR_PURE_NOTHROW_NONNULL)
DEF_LIB_BUILTIN (BUILT_IN_STRCAT, "strcat", BT_FN_STRING_STRING_CONST_STRING, ATTR_NOTHROW_NONNULL)
DEF_LIB_BUILTIN (BUILT_IN_STRCHR, "strchr", BT_FN_STRING_CONST_STRING_INT, ATTR_PURE_NOTHROW_NONNULL)
DEF_LIB_BUILTIN (BUILT_IN_STRCMP, "strcmp", BT_FN_INT_CONST_STRING_CONST_STRING, ATTR_PURE_NOTHROW_NONNULL)
@ -470,6 +472,7 @@ DEF_LIB_BUILTIN (BUILT_IN_STRCSPN, "strcspn", BT_FN_SIZE_CONST_STRING_CON
DEF_EXT_LIB_BUILTIN (BUILT_IN_STRDUP, "strdup", BT_FN_STRING_CONST_STRING, ATTR_MALLOC_NOTHROW_NONNULL)
DEF_EXT_LIB_BUILTIN (BUILT_IN_STRNDUP, "strndup", BT_FN_STRING_CONST_STRING_SIZE, ATTR_MALLOC_NOTHROW_NONNULL)
DEF_LIB_BUILTIN (BUILT_IN_STRLEN, "strlen", BT_FN_SIZE_CONST_STRING, ATTR_PURE_NOTHROW_NONNULL)
DEF_EXT_LIB_BUILTIN (BUILT_IN_STRNCASECMP, "strncasecmp", BT_FN_INT_CONST_STRING_CONST_STRING_SIZE, ATTR_PURE_NOTHROW_NONNULL)
DEF_LIB_BUILTIN (BUILT_IN_STRNCAT, "strncat", BT_FN_STRING_STRING_CONST_STRING_SIZE, ATTR_NOTHROW_NONNULL)
DEF_LIB_BUILTIN (BUILT_IN_STRNCMP, "strncmp", BT_FN_INT_CONST_STRING_CONST_STRING_SIZE, ATTR_PURE_NOTHROW_NONNULL)
DEF_LIB_BUILTIN (BUILT_IN_STRNCPY, "strncpy", BT_FN_STRING_STRING_CONST_STRING_SIZE, ATTR_NOTHROW_NONNULL)

View File

@ -4880,6 +4880,8 @@ identifier, or a sequence of member accesses and array references.
@findex sqrtl
@findex sscanf
@findex stpcpy
@findex stpncpy
@findex strcasecmp
@findex strcat
@findex strchr
@findex strcmp
@ -4889,9 +4891,11 @@ identifier, or a sequence of member accesses and array references.
@findex strfmon
@findex strftime
@findex strlen
@findex strncasecmp
@findex strncat
@findex strncmp
@findex strncpy
@findex strndup
@findex strpbrk
@findex strrchr
@findex strspn
@ -4963,9 +4967,10 @@ Outside strict ISO C mode (@option{-ansi}, @option{-std=c89} or
@code{scalb}, @code{signbit}, @code{signbitf}, @code{signbitl},
@code{significandf}, @code{significandl}, @code{significand},
@code{sincosf}, @code{sincosl}, @code{sincos}, @code{stpcpy},
@code{strdup}, @code{strfmon}, @code{toascii}, @code{y0f}, @code{y0l},
@code{y0}, @code{y1f}, @code{y1l}, @code{y1}, @code{ynf}, @code{ynl} and
@code{yn}
@code{stpncpy}, @code{strcasecmp}, @code{strdup}, @code{strfmon},
@code{strncasecmp}, @code{strndup}, @code{toascii}, @code{y0f},
@code{y0l}, @code{y0}, @code{y1f}, @code{y1l}, @code{y1}, @code{ynf},
@code{ynl} and @code{yn}
may be handled as built-in functions.
All these functions have corresponding versions
prefixed with @code{__builtin_}, which may be used even in strict C89

View File

@ -1,3 +1,8 @@
2005-04-03 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* gcc.dg/nonnull-3.c: Also test __builtin_stpncpy,
__builtin_strcasecmp and __builtin_strncasecmp.
2005-04-03 Nathan Sidwell <nathan@codesourcery.com>
PR c++/20723

View File

@ -33,10 +33,16 @@ foo (void *p, char *s)
__builtin_strncat (s, NULL, 16); /* { dg-warning "null" "null pointer check" } */
__builtin_stpcpy (NULL, s); /* { dg-warning "null" "null pointer check" } */
__builtin_stpcpy (s, NULL); /* { dg-warning "null" "null pointer check" } */
__builtin_stpncpy (NULL, s, 16); /* { dg-warning "null" "null pointer check" } */
__builtin_stpncpy (s, NULL, 16); /* { dg-warning "null" "null pointer check" } */
__builtin_strcpy (NULL, s); /* { dg-warning "null" "null pointer check" } */
__builtin_strcpy (s, NULL); /* { dg-warning "null" "null pointer check" } */
__builtin_strncpy (NULL, s, 16); /* { dg-warning "null" "null pointer check" } */
__builtin_strncpy (s, NULL, 16); /* { dg-warning "null" "null pointer check" } */
__builtin_strcasecmp (NULL, s); /* { dg-warning "null" "null pointer check" } */
__builtin_strcasecmp (s, NULL); /* { dg-warning "null" "null pointer check" } */
__builtin_strncasecmp (NULL, s, 16); /* { dg-warning "null" "null pointer check" } */
__builtin_strncasecmp (s, NULL, 16); /* { dg-warning "null" "null pointer check" } */
__builtin_strcmp (NULL, s); /* { dg-warning "null" "null pointer check" } */
__builtin_strcmp (s, NULL); /* { dg-warning "null" "null pointer check" } */
__builtin_strncmp (NULL, s, 16); /* { dg-warning "null" "null pointer check" } */