summaryrefslogtreecommitdiff
path: root/gcc/builtins.def
diff options
context:
space:
mode:
authorghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2003-05-04 22:18:17 +0000
committerghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2003-05-04 22:18:17 +0000
commitaf16b3b25c0e7e64f9bffcd741ebe3ad1e6a211f (patch)
tree10df2a1679aeee49958f47f877d8ad19884d6165 /gcc/builtins.def
parent9bb0a517ec3990852648a0f27ae14c8e60929fd4 (diff)
downloadgcc-af16b3b25c0e7e64f9bffcd741ebe3ad1e6a211f.tar.gz
gcc:
* builtin-attrs.def (ATTR_NOTHROW_NONNULL_1, ATTR_NOTHROW_NONNULL_2, ATTR_NOTHROW_NONNULL_3): Renamed from ATTR_NONNULL_1, ATTR_NONNULL_2 and ATTR_NONNULL_3. (ATTR_NOTHROW_NONNULL_1_2, ATTR_NOTHROW_NONNULL_1_4, ATTR_CONST_NOTHROW_NONNULL_1, ATTR_PURE_NOTHROW_NONNULL_1, ATTR_PURE_NOTHROW_NONNULL_1_2, ATTR_MALLOC_NOTHROW_NONNULL_1): New. * builtins.def (DEF_EXT_FALLBACK_BUILTIN): Accept ATTRS argument. (BUILT_IN_BZERO, BUILT_IN_BCOPY, BUILT_IN_BCMP): Update comment (BUILT_IN_INDEX, BUILT_IN_RINDEX, BUILT_IN_MEMCPY, BUILT_IN_MEMMOVE, BUILT_IN_MEMCMP, BUILT_IN_MEMSET, BUILT_IN_MEMPCPY, BUILT_IN_STRCAT, BUILT_IN_STRNCAT, BUILT_IN_STPCPY, BUILT_IN_STRCPY, BUILT_IN_STRNCPY, BUILT_IN_STRCMP, BUILT_IN_STRNCMP, BUILT_IN_STRLEN, BUILT_IN_STRSTR, BUILT_IN_STRPBRK, BUILT_IN_STRSPN, BUILT_IN_STRCSPN, BUILT_IN_STRCHR, BUILT_IN_STRRCHR, BUILT_IN_NAN, BUILT_IN_NANF, BUILT_IN_NANL, BUILT_IN_NANS, BUILT_IN_NANSF, BUILT_IN_NANSL, BUILT_IN_PUTS, BUILT_IN_FPUTC, BUILT_IN_FPUTS, BUILT_IN_FWRITE, BUILT_IN_PUTS_UNLOCKED, BUILT_IN_FPUTC_UNLOCKED, BUILT_IN_FPUTS_UNLOCKED, BUILT_IN_FWRITE_UNLOCKED, BUILT_IN_STRDUP): Add "nonnull" attribute. testsuite: * gcc.dg/nonnull-3.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@66468 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/builtins.def')
-rw-r--r--gcc/builtins.def85
1 files changed, 44 insertions, 41 deletions
diff --git a/gcc/builtins.def b/gcc/builtins.def
index a74673196a6..a45641cf0ae 100644
--- a/gcc/builtins.def
+++ b/gcc/builtins.def
@@ -85,9 +85,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
we ignore the version of these builtins that does not begin with
__builtin. */
#undef DEF_EXT_FALLBACK_BUILTIN
-#define DEF_EXT_FALLBACK_BUILTIN(ENUM, NAME, TYPE) \
+#define DEF_EXT_FALLBACK_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
- false, true, true, ATTR_NOTHROW_LIST, true)
+ false, true, true, ATTRS, true)
/* A library builtin (like __builtin_strchr) is a builtin equivalent
of an ANSI/ISO standard library function. In addition to the
@@ -287,8 +287,11 @@ DEF_C99_BUILTIN(BUILT_IN_CIMAGL,
ATTR_CONST_NOTHROW_LIST)
/* The system prototypes for `bzero', 'bcopy' and `bcmp' functions
- have many variations, so don't specify parameters to avoid conflicts.
- The expand_* functions check the argument types anyway. */
+ have many variations, so don't specify parameters to avoid
+ conflicts. The expand_* functions check the argument types anyway.
+ In addition, these functions have traditionally accepted NULL
+ pointers when the length parameter is zero, so don't apply
+ attribute "nonnull". */
DEF_BUILTIN (BUILT_IN_BZERO,
"__builtin_bzero",
BUILT_IN_NORMAL,
@@ -377,89 +380,89 @@ DEF_GCC_BUILTIN(BUILT_IN_PARITYLL,
DEF_EXT_LIB_BUILTIN(BUILT_IN_INDEX,
"__builtin_index",
BT_FN_STRING_CONST_STRING_INT,
- ATTR_PURE_NOTHROW_LIST)
+ ATTR_PURE_NOTHROW_NONNULL_1)
DEF_EXT_LIB_BUILTIN(BUILT_IN_RINDEX,
"__builtin_rindex",
BT_FN_STRING_CONST_STRING_INT,
- ATTR_PURE_NOTHROW_LIST)
+ ATTR_PURE_NOTHROW_NONNULL_1)
DEF_LIB_BUILTIN(BUILT_IN_MEMCPY,
"__builtin_memcpy",
BT_FN_PTR_PTR_CONST_PTR_SIZE,
- ATTR_NOTHROW_LIST)
+ ATTR_NOTHROW_NONNULL_1_2)
DEF_LIB_BUILTIN(BUILT_IN_MEMMOVE,
"__builtin_memmove",
BT_FN_PTR_PTR_CONST_PTR_SIZE,
- ATTR_NOTHROW_LIST)
+ ATTR_NOTHROW_NONNULL_1_2)
DEF_LIB_BUILTIN(BUILT_IN_MEMCMP,
"__builtin_memcmp",
BT_FN_INT_CONST_PTR_CONST_PTR_SIZE,
- ATTR_PURE_NOTHROW_LIST)
+ ATTR_PURE_NOTHROW_NONNULL_1_2)
DEF_LIB_BUILTIN(BUILT_IN_MEMSET,
"__builtin_memset",
BT_FN_PTR_PTR_INT_SIZE,
- ATTR_NOTHROW_LIST)
+ ATTR_NOTHROW_NONNULL_1)
DEF_EXT_LIB_BUILTIN(BUILT_IN_MEMPCPY,
"__builtin_mempcpy",
BT_FN_PTR_PTR_CONST_PTR_SIZE,
- ATTR_NOTHROW_LIST)
+ ATTR_NOTHROW_NONNULL_1_2)
DEF_LIB_BUILTIN(BUILT_IN_STRCAT,
"__builtin_strcat",
BT_FN_STRING_STRING_CONST_STRING,
- ATTR_NOTHROW_LIST)
+ ATTR_NOTHROW_NONNULL_1_2)
DEF_LIB_BUILTIN(BUILT_IN_STRNCAT,
"__builtin_strncat",
BT_FN_STRING_STRING_CONST_STRING_SIZE,
- ATTR_NOTHROW_LIST)
+ ATTR_NOTHROW_NONNULL_1_2)
DEF_EXT_LIB_BUILTIN(BUILT_IN_STPCPY,
"__builtin_stpcpy",
BT_FN_STRING_STRING_CONST_STRING,
- ATTR_NOTHROW_LIST)
+ ATTR_NOTHROW_NONNULL_1_2)
DEF_LIB_BUILTIN(BUILT_IN_STRCPY,
"__builtin_strcpy",
BT_FN_STRING_STRING_CONST_STRING,
- ATTR_NOTHROW_LIST)
+ ATTR_NOTHROW_NONNULL_1_2)
DEF_LIB_BUILTIN(BUILT_IN_STRNCPY,
"__builtin_strncpy",
BT_FN_STRING_STRING_CONST_STRING_SIZE,
- ATTR_NOTHROW_LIST)
+ ATTR_NOTHROW_NONNULL_1_2)
DEF_LIB_BUILTIN(BUILT_IN_STRCMP,
"__builtin_strcmp",
BT_FN_INT_CONST_STRING_CONST_STRING,
- ATTR_PURE_NOTHROW_LIST)
+ ATTR_PURE_NOTHROW_NONNULL_1_2)
DEF_LIB_BUILTIN(BUILT_IN_STRNCMP,
"__builtin_strncmp",
BT_FN_INT_CONST_STRING_CONST_STRING_SIZE,
- ATTR_PURE_NOTHROW_LIST)
+ ATTR_PURE_NOTHROW_NONNULL_1_2)
DEF_LIB_BUILTIN(BUILT_IN_STRLEN,
"__builtin_strlen",
BT_FN_SIZE_CONST_STRING,
- ATTR_PURE_NOTHROW_LIST)
+ ATTR_PURE_NOTHROW_NONNULL_1)
DEF_LIB_BUILTIN(BUILT_IN_STRSTR,
"__builtin_strstr",
BT_FN_STRING_CONST_STRING_CONST_STRING,
- ATTR_PURE_NOTHROW_LIST)
+ ATTR_PURE_NOTHROW_NONNULL_1_2)
DEF_LIB_BUILTIN(BUILT_IN_STRPBRK,
"__builtin_strpbrk",
BT_FN_STRING_CONST_STRING_CONST_STRING,
- ATTR_PURE_NOTHROW_LIST)
+ ATTR_PURE_NOTHROW_NONNULL_1_2)
DEF_LIB_BUILTIN(BUILT_IN_STRSPN,
"__builtin_strspn",
BT_FN_SIZE_CONST_STRING_CONST_STRING,
- ATTR_PURE_NOTHROW_LIST)
+ ATTR_PURE_NOTHROW_NONNULL_1_2)
DEF_LIB_BUILTIN(BUILT_IN_STRCSPN,
"__builtin_strcspn",
BT_FN_SIZE_CONST_STRING_CONST_STRING,
- ATTR_PURE_NOTHROW_LIST)
+ ATTR_PURE_NOTHROW_NONNULL_1_2)
DEF_LIB_BUILTIN(BUILT_IN_STRCHR,
"__builtin_strchr",
BT_FN_STRING_CONST_STRING_INT,
- ATTR_PURE_NOTHROW_LIST)
+ ATTR_PURE_NOTHROW_NONNULL_1)
DEF_LIB_BUILTIN(BUILT_IN_STRRCHR,
"__builtin_strrchr",
BT_FN_STRING_CONST_STRING_INT,
- ATTR_PURE_NOTHROW_LIST)
+ ATTR_PURE_NOTHROW_NONNULL_1)
DEF_LIB_BUILTIN(BUILT_IN_SQRT,
"__builtin_sqrt",
@@ -647,28 +650,28 @@ DEF_GCC_BUILTIN(BUILT_IN_HUGE_VALL,
DEF_LIB_BUILTIN(BUILT_IN_NAN,
"__builtin_nan",
BT_FN_DOUBLE_CONST_STRING,
- ATTR_CONST_NOTHROW_LIST)
+ ATTR_CONST_NOTHROW_NONNULL_1)
DEF_LIB_BUILTIN(BUILT_IN_NANF,
"__builtin_nanf",
BT_FN_FLOAT_CONST_STRING,
- ATTR_CONST_NOTHROW_LIST)
+ ATTR_CONST_NOTHROW_NONNULL_1)
DEF_LIB_BUILTIN(BUILT_IN_NANL,
"__builtin_nanl",
BT_FN_LONG_DOUBLE_CONST_STRING,
- ATTR_CONST_NOTHROW_LIST)
+ ATTR_CONST_NOTHROW_NONNULL_1)
DEF_LIB_BUILTIN(BUILT_IN_NANS,
"__builtin_nans",
BT_FN_DOUBLE_CONST_STRING,
- ATTR_CONST_NOTHROW_LIST)
+ ATTR_CONST_NOTHROW_NONNULL_1)
DEF_LIB_BUILTIN(BUILT_IN_NANSF,
"__builtin_nansf",
BT_FN_FLOAT_CONST_STRING,
- ATTR_CONST_NOTHROW_LIST)
+ ATTR_CONST_NOTHROW_NONNULL_1)
DEF_LIB_BUILTIN(BUILT_IN_NANSL,
"__builtin_nansl",
BT_FN_LONG_DOUBLE_CONST_STRING,
- ATTR_CONST_NOTHROW_LIST)
+ ATTR_CONST_NOTHROW_NONNULL_1)
DEF_GCC_BUILTIN(BUILT_IN_SAVEREGS,
"__builtin_saveregs",
@@ -744,7 +747,7 @@ DEF_LIB_BUILTIN(BUILT_IN_PUTCHAR,
DEF_LIB_BUILTIN(BUILT_IN_PUTS,
"__builtin_puts",
BT_FN_INT_CONST_STRING,
- ATTR_NOTHROW_LIST)
+ ATTR_NOTHROW_NONNULL_1)
DEF_C99_BUILTIN(BUILT_IN_SNPRINTF,
"__builtin_snprintf",
BT_FN_INT_STRING_SIZE_CONST_STRING_VAR,
@@ -793,17 +796,17 @@ DEF_LIB_BUILTIN(BUILT_IN_VSPRINTF,
DEF_FALLBACK_BUILTIN(BUILT_IN_FPUTC,
"__builtin_fputc",
BT_FN_INT_INT_PTR,
- ATTR_NOTHROW_LIST)
+ ATTR_NOTHROW_NONNULL_2)
DEF_BUILTIN (BUILT_IN_FPUTS,
"__builtin_fputs",
BUILT_IN_NORMAL,
BT_FN_INT_CONST_STRING_PTR,
BT_FN_INT_VAR,
- true, true, false, ATTR_NOTHROW_LIST, true)
+ true, true, false, ATTR_NOTHROW_NONNULL_1_2, true)
DEF_FALLBACK_BUILTIN(BUILT_IN_FWRITE,
"__builtin_fwrite",
BT_FN_SIZE_CONST_PTR_SIZE_SIZE_PTR,
- ATTR_NOTHROW_LIST)
+ ATTR_NOTHROW_NONNULL_1_4)
DEF_FRONT_END_LIB_BUILTIN(BUILT_IN_FPRINTF,
"__builtin_fprintf",
BT_FN_INT_PTR_CONST_STRING_VAR,
@@ -813,10 +816,10 @@ DEF_FRONT_END_LIB_BUILTIN(BUILT_IN_FPRINTF,
DEF_EXT_FALLBACK_BUILTIN(BUILT_IN_PUTCHAR_UNLOCKED,
"__builtin_putchar_unlocked",
- BT_FN_INT_INT)
+ BT_FN_INT_INT, ATTR_NOTHROW_LIST)
DEF_EXT_FALLBACK_BUILTIN(BUILT_IN_PUTS_UNLOCKED,
"__builtin_puts_unlocked",
- BT_FN_INT_CONST_STRING)
+ BT_FN_INT_CONST_STRING, ATTR_NOTHROW_NONNULL_1)
DEF_EXT_FRONT_END_LIB_BUILTIN(BUILT_IN_PRINTF_UNLOCKED,
"__builtin_printf_unlocked",
BT_FN_INT_CONST_STRING_VAR,
@@ -831,16 +834,16 @@ DEF_EXT_FRONT_END_LIB_BUILTIN(BUILT_IN_PRINTF_UNLOCKED,
DEF_EXT_FALLBACK_BUILTIN(BUILT_IN_FPUTC_UNLOCKED,
"__builtin_fputc_unlocked",
- BT_FN_INT_INT_PTR)
+ BT_FN_INT_INT_PTR, ATTR_NOTHROW_NONNULL_2)
DEF_BUILTIN (BUILT_IN_FPUTS_UNLOCKED,
"__builtin_fputs_unlocked",
BUILT_IN_NORMAL,
BT_FN_INT_CONST_STRING_PTR,
BT_FN_INT_VAR,
- true, true, true, ATTR_NOTHROW_LIST, true)
+ true, true, true, ATTR_NOTHROW_NONNULL_1_2, true)
DEF_EXT_FALLBACK_BUILTIN(BUILT_IN_FWRITE_UNLOCKED,
"__builtin_fwrite_unlocked",
- BT_FN_SIZE_CONST_PTR_SIZE_SIZE_PTR)
+ BT_FN_SIZE_CONST_PTR_SIZE_SIZE_PTR, ATTR_NOTHROW_NONNULL_1_4)
DEF_EXT_FRONT_END_LIB_BUILTIN(BUILT_IN_FPRINTF_UNLOCKED,
"__builtin_fprintf_unlocked",
BT_FN_INT_PTR_CONST_STRING_VAR,
@@ -961,5 +964,5 @@ DEF_LIB_BUILTIN(BUILT_IN_CALLOC,
DEF_EXT_LIB_BUILTIN(BUILT_IN_STRDUP,
"__builtin_strdup",
BT_FN_STRING_CONST_STRING,
- ATTR_MALLOC_NOTHROW_LIST)
+ ATTR_MALLOC_NOTHROW_NONNULL_1)