summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-26 02:25:30 +0000
committerghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-26 02:25:30 +0000
commit7e50d4062575106eac0efb7c5b7d037ff38b08d7 (patch)
treea2a76b1c0137364ea9eeb9b2d2c99e5b63eacf77
parentaef9b5f07d51b14d498449ee4dd3ea66eb299eb9 (diff)
downloadgcc-7e50d4062575106eac0efb7c5b7d037ff38b08d7.tar.gz
* builtin-types.def (BT_FN_STRING_CONST_STRING_SIZE): New.
* builtins.def (BUILT_IN_STRNDUP): New. testsuite: * gcc.dg/nonnull-3.c: Also test __builtin_strndup. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@97077 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/builtin-types.def2
-rw-r--r--gcc/builtins.def1
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/nonnull-3.c1
5 files changed, 13 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 71e4822bf08..fb5ac8639e0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2005-03-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * builtin-types.def (BT_FN_STRING_CONST_STRING_SIZE): New.
+ * builtins.def (BUILT_IN_STRNDUP): New.
+
2005-03-25 Pat Haugen <pthaugen@us.ibm.com>
PR tree-optimization/20470
diff --git a/gcc/builtin-types.def b/gcc/builtin-types.def
index 845863108b0..a3c804c9181 100644
--- a/gcc/builtin-types.def
+++ b/gcc/builtin-types.def
@@ -172,6 +172,8 @@ DEF_FUNCTION_TYPE_2 (BT_FN_SIZE_CONST_STRING_CONST_STRING,
BT_SIZE, BT_CONST_STRING, BT_CONST_STRING)
DEF_FUNCTION_TYPE_2 (BT_FN_STRING_CONST_STRING_INT,
BT_STRING, BT_CONST_STRING, BT_INT)
+DEF_FUNCTION_TYPE_2 (BT_FN_STRING_CONST_STRING_SIZE,
+ BT_STRING, BT_CONST_STRING, BT_SIZE)
DEF_FUNCTION_TYPE_2 (BT_FN_INT_CONST_STRING_FILEPTR,
BT_INT, BT_CONST_STRING, BT_FILEPTR)
DEF_FUNCTION_TYPE_2 (BT_FN_INT_INT_FILEPTR,
diff --git a/gcc/builtins.def b/gcc/builtins.def
index d324e01a584..394723e3cd5 100644
--- a/gcc/builtins.def
+++ b/gcc/builtins.def
@@ -468,6 +468,7 @@ DEF_LIB_BUILTIN (BUILT_IN_STRCMP, "strcmp", BT_FN_INT_CONST_STRING_CONST_
DEF_LIB_BUILTIN (BUILT_IN_STRCPY, "strcpy", BT_FN_STRING_STRING_CONST_STRING, ATTR_NOTHROW_NONNULL)
DEF_LIB_BUILTIN (BUILT_IN_STRCSPN, "strcspn", BT_FN_SIZE_CONST_STRING_CONST_STRING, ATTR_PURE_NOTHROW_NONNULL)
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_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)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 9e5cdf9fedc..03e5d9b3a67 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2005-03-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * gcc.dg/nonnull-3.c: Also test __builtin_strndup.
+
2005-03-25 Mark Mitchell <mark@codesourcery.com>
* lib/g++.exp (g++_link_flags): Use gcc-set-multilib-library-path.
diff --git a/gcc/testsuite/gcc.dg/nonnull-3.c b/gcc/testsuite/gcc.dg/nonnull-3.c
index 3b53eaf7b95..e8725cf12d2 100644
--- a/gcc/testsuite/gcc.dg/nonnull-3.c
+++ b/gcc/testsuite/gcc.dg/nonnull-3.c
@@ -51,6 +51,7 @@ foo (void *p, char *s)
__builtin_strchr (NULL, 16); /* { dg-warning "null" "null pointer check" } */
__builtin_strrchr (NULL, 16); /* { dg-warning "null" "null pointer check" } */
__builtin_strdup (NULL); /* { dg-warning "null" "null pointer check" } */
+ __builtin_strndup (NULL, 16); /* { dg-warning "null" "null pointer check" } */
__builtin_nan (NULL); /* { dg-warning "null" "null pointer check" } */
__builtin_nanf (NULL); /* { dg-warning "null" "null pointer check" } */