135 lines
9.5 KiB
Diff
135 lines
9.5 KiB
Diff
|
2007-09-06 Jakub Jelinek <jakub@redhat.com>
|
||
|
|
||
|
* builtin-attrs.def (ATTR_NONNULL_3): New.
|
||
|
(DEF_FORMAT_ATTRIBUTE): Use just ATTR_NONNULL_##FA instead of
|
||
|
ATTR_NOTHROW_NONNULL_##FA.
|
||
|
(DEF_FORMAT_ATTRIBUTE_NOTHROW, DEF_FORMAT_ATTRIBUTE_BOTH): New macros.
|
||
|
(ATTR_FORMAT_PRINTF_NOTHROW_2_0, ATTR_PRINTF_NOTHROW_2_3,
|
||
|
ATTR_FORMAT_PRINTF_NOTHROW_3_0, ATTR_FORMAT_PRINTF_NOTHROW_3_4,
|
||
|
ATTR_FORMAT_PRINTF_NOTHROW_4_0, ATTR_PRINTF_NOTHROW_4_5,
|
||
|
ATTR_FORMAT_PRINTF_NOTHROW_5_0, ATTR_FORMAT_PRINTF_NOTHROW_5_6,
|
||
|
ATTR_FORMAT_SCANF_NOTHROW_2_0, ATTR_FORMAT_SCANF_NOTHROW_2_3,
|
||
|
ATTR_FORMAT_STRFTIME_NOTHROW_3_0, ATTR_FORMAT_STRFMON_NOTHROW_3_4):
|
||
|
New.
|
||
|
(ATTR_FORMAT_PRINTF_4_0, ATTR_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0,
|
||
|
ATTR_FORMAT_PRINTF_5_6, ATTR_FORMAT_STRFTIME_3_0,
|
||
|
ATTR_FORMAT_NOTHROW_3_4): Remove.
|
||
|
* builtins.def (snprintf, sprintf, sscanf, vsnprintf, vsprintf,
|
||
|
vsscanf, strfmon, strftime, __snprintf_chk, __sprintf_chk,
|
||
|
__vsnprintf_chk, __vsprintf_chk): Use ATTR_FORMAT_*_NOTHROW_*
|
||
|
instead of ATTR_FORMAT_*_*.
|
||
|
|
||
|
--- gcc/builtin-attrs.def.jj 2007-08-13 15:11:18.000000000 +0200
|
||
|
+++ gcc/builtin-attrs.def 2007-09-03 11:26:13.000000000 +0200
|
||
|
@@ -118,6 +118,8 @@ DEF_ATTR_TREE_LIST (ATTR_NONNULL_LIST, A
|
||
|
DEF_ATTR_TREE_LIST (ATTR_NONNULL_1, ATTR_NONNULL, ATTR_LIST_1, ATTR_NULL)
|
||
|
/* Functions whose second parameter is a nonnull pointer. */
|
||
|
DEF_ATTR_TREE_LIST (ATTR_NONNULL_2, ATTR_NONNULL, ATTR_LIST_2, ATTR_NULL)
|
||
|
+/* Functions whose third parameter is a nonnull pointer. */
|
||
|
+DEF_ATTR_TREE_LIST (ATTR_NONNULL_3, ATTR_NONNULL, ATTR_LIST_3, ATTR_NULL)
|
||
|
/* Nothrow functions with the sentinel(1) attribute. */
|
||
|
DEF_ATTR_TREE_LIST (ATTR_NOTHROW_SENTINEL_1, ATTR_SENTINEL, ATTR_LIST_1, \
|
||
|
ATTR_NOTHROW_LIST)
|
||
|
@@ -157,24 +159,38 @@ DEF_ATTR_TREE_LIST (ATTR_MALLOC_NOTHROW_
|
||
|
DEF_ATTR_TREE_LIST (ATTR_##TYPE##_##VALUES, ATTR_NULL, \
|
||
|
ATTR_##TYPE, ATTR_LIST_##VALUES) \
|
||
|
DEF_ATTR_TREE_LIST (ATTR_FORMAT_##TYPE##_##VALUES, ATTR_FORMAT, \
|
||
|
+ ATTR_##TYPE##_##VALUES, ATTR_NONNULL_##FA)
|
||
|
+#define DEF_FORMAT_ATTRIBUTE_NOTHROW(TYPE, FA, VALUES) \
|
||
|
+ DEF_ATTR_TREE_LIST (ATTR_##TYPE##_##VALUES, ATTR_NULL, \
|
||
|
+ ATTR_##TYPE, ATTR_LIST_##VALUES) \
|
||
|
+ DEF_ATTR_TREE_LIST (ATTR_FORMAT_##TYPE##_NOTHROW_##VALUES, ATTR_FORMAT,\
|
||
|
+ ATTR_##TYPE##_##VALUES, ATTR_NOTHROW_NONNULL_##FA)
|
||
|
+#define DEF_FORMAT_ATTRIBUTE_BOTH(TYPE, FA, VALUES) \
|
||
|
+ DEF_ATTR_TREE_LIST (ATTR_##TYPE##_##VALUES, ATTR_NULL, \
|
||
|
+ ATTR_##TYPE, ATTR_LIST_##VALUES) \
|
||
|
+ DEF_ATTR_TREE_LIST (ATTR_FORMAT_##TYPE##_##VALUES, ATTR_FORMAT, \
|
||
|
+ ATTR_##TYPE##_##VALUES, ATTR_NONNULL_##FA) \
|
||
|
+ DEF_ATTR_TREE_LIST (ATTR_FORMAT_##TYPE##_NOTHROW_##VALUES, ATTR_FORMAT,\
|
||
|
ATTR_##TYPE##_##VALUES, ATTR_NOTHROW_NONNULL_##FA)
|
||
|
DEF_FORMAT_ATTRIBUTE(PRINTF,1,1_0)
|
||
|
DEF_FORMAT_ATTRIBUTE(PRINTF,1,1_2)
|
||
|
-DEF_FORMAT_ATTRIBUTE(PRINTF,2,2_0)
|
||
|
-DEF_FORMAT_ATTRIBUTE(PRINTF,2,2_3)
|
||
|
-DEF_FORMAT_ATTRIBUTE(PRINTF,3,3_0)
|
||
|
-DEF_FORMAT_ATTRIBUTE(PRINTF,3,3_4)
|
||
|
-DEF_FORMAT_ATTRIBUTE(PRINTF,4,4_0)
|
||
|
-DEF_FORMAT_ATTRIBUTE(PRINTF,4,4_5)
|
||
|
-DEF_FORMAT_ATTRIBUTE(PRINTF,5,5_0)
|
||
|
-DEF_FORMAT_ATTRIBUTE(PRINTF,5,5_6)
|
||
|
+DEF_FORMAT_ATTRIBUTE_BOTH(PRINTF,2,2_0)
|
||
|
+DEF_FORMAT_ATTRIBUTE_BOTH(PRINTF,2,2_3)
|
||
|
+DEF_FORMAT_ATTRIBUTE_BOTH(PRINTF,3,3_0)
|
||
|
+DEF_FORMAT_ATTRIBUTE_BOTH(PRINTF,3,3_4)
|
||
|
+DEF_FORMAT_ATTRIBUTE_NOTHROW(PRINTF,4,4_0)
|
||
|
+DEF_FORMAT_ATTRIBUTE_NOTHROW(PRINTF,4,4_5)
|
||
|
+DEF_FORMAT_ATTRIBUTE_NOTHROW(PRINTF,5,5_0)
|
||
|
+DEF_FORMAT_ATTRIBUTE_NOTHROW(PRINTF,5,5_6)
|
||
|
DEF_FORMAT_ATTRIBUTE(SCANF,1,1_0)
|
||
|
DEF_FORMAT_ATTRIBUTE(SCANF,1,1_2)
|
||
|
-DEF_FORMAT_ATTRIBUTE(SCANF,2,2_0)
|
||
|
-DEF_FORMAT_ATTRIBUTE(SCANF,2,2_3)
|
||
|
-DEF_FORMAT_ATTRIBUTE(STRFTIME,3,3_0)
|
||
|
-DEF_FORMAT_ATTRIBUTE(STRFMON,3,3_4)
|
||
|
+DEF_FORMAT_ATTRIBUTE_BOTH(SCANF,2,2_0)
|
||
|
+DEF_FORMAT_ATTRIBUTE_BOTH(SCANF,2,2_3)
|
||
|
+DEF_FORMAT_ATTRIBUTE_NOTHROW(STRFTIME,3,3_0)
|
||
|
+DEF_FORMAT_ATTRIBUTE_NOTHROW(STRFMON,3,3_4)
|
||
|
#undef DEF_FORMAT_ATTRIBUTE
|
||
|
+#undef DEF_FORMAT_ATTRIBUTE_NOTHROW
|
||
|
+#undef DEF_FORMAT_ATTRIBUTE_BOTH
|
||
|
|
||
|
/* Construct a tree for a format_arg attribute. */
|
||
|
#define DEF_FORMAT_ARG_ATTRIBUTE(FA) \
|
||
|
--- gcc/builtins.def.jj 2007-08-30 18:46:59.000000000 +0200
|
||
|
+++ gcc/builtins.def 2007-09-03 10:52:18.000000000 +0200
|
||
|
@@ -553,16 +553,16 @@ DEF_EXT_LIB_BUILTIN (BUILT_IN_PUTCHAR
|
||
|
DEF_LIB_BUILTIN (BUILT_IN_PUTS, "puts", BT_FN_INT_CONST_STRING, ATTR_NONNULL_LIST)
|
||
|
DEF_EXT_LIB_BUILTIN (BUILT_IN_PUTS_UNLOCKED, "puts_unlocked", BT_FN_INT_CONST_STRING, ATTR_NONNULL_LIST)
|
||
|
DEF_LIB_BUILTIN (BUILT_IN_SCANF, "scanf", BT_FN_INT_CONST_STRING_VAR, ATTR_FORMAT_SCANF_1_2)
|
||
|
-DEF_C99_BUILTIN (BUILT_IN_SNPRINTF, "snprintf", BT_FN_INT_STRING_SIZE_CONST_STRING_VAR, ATTR_FORMAT_PRINTF_3_4)
|
||
|
-DEF_LIB_BUILTIN (BUILT_IN_SPRINTF, "sprintf", BT_FN_INT_STRING_CONST_STRING_VAR, ATTR_FORMAT_PRINTF_2_3)
|
||
|
-DEF_LIB_BUILTIN (BUILT_IN_SSCANF, "sscanf", BT_FN_INT_CONST_STRING_CONST_STRING_VAR, ATTR_FORMAT_SCANF_2_3)
|
||
|
+DEF_C99_BUILTIN (BUILT_IN_SNPRINTF, "snprintf", BT_FN_INT_STRING_SIZE_CONST_STRING_VAR, ATTR_FORMAT_PRINTF_NOTHROW_3_4)
|
||
|
+DEF_LIB_BUILTIN (BUILT_IN_SPRINTF, "sprintf", BT_FN_INT_STRING_CONST_STRING_VAR, ATTR_FORMAT_PRINTF_NOTHROW_2_3)
|
||
|
+DEF_LIB_BUILTIN (BUILT_IN_SSCANF, "sscanf", BT_FN_INT_CONST_STRING_CONST_STRING_VAR, ATTR_FORMAT_SCANF_NOTHROW_2_3)
|
||
|
DEF_LIB_BUILTIN (BUILT_IN_VFPRINTF, "vfprintf", BT_FN_INT_FILEPTR_CONST_STRING_VALIST_ARG, ATTR_FORMAT_PRINTF_2_0)
|
||
|
DEF_C99_BUILTIN (BUILT_IN_VFSCANF, "vfscanf", BT_FN_INT_FILEPTR_CONST_STRING_VALIST_ARG, ATTR_FORMAT_SCANF_2_0)
|
||
|
DEF_LIB_BUILTIN (BUILT_IN_VPRINTF, "vprintf", BT_FN_INT_CONST_STRING_VALIST_ARG, ATTR_FORMAT_PRINTF_1_0)
|
||
|
DEF_C99_BUILTIN (BUILT_IN_VSCANF, "vscanf", BT_FN_INT_CONST_STRING_VALIST_ARG, ATTR_FORMAT_SCANF_1_0)
|
||
|
-DEF_C99_BUILTIN (BUILT_IN_VSNPRINTF, "vsnprintf", BT_FN_INT_STRING_SIZE_CONST_STRING_VALIST_ARG, ATTR_FORMAT_PRINTF_3_0)
|
||
|
-DEF_LIB_BUILTIN (BUILT_IN_VSPRINTF, "vsprintf", BT_FN_INT_STRING_CONST_STRING_VALIST_ARG, ATTR_FORMAT_PRINTF_2_0)
|
||
|
-DEF_C99_BUILTIN (BUILT_IN_VSSCANF, "vsscanf", BT_FN_INT_CONST_STRING_CONST_STRING_VALIST_ARG, ATTR_FORMAT_SCANF_2_0)
|
||
|
+DEF_C99_BUILTIN (BUILT_IN_VSNPRINTF, "vsnprintf", BT_FN_INT_STRING_SIZE_CONST_STRING_VALIST_ARG, ATTR_FORMAT_PRINTF_NOTHROW_3_0)
|
||
|
+DEF_LIB_BUILTIN (BUILT_IN_VSPRINTF, "vsprintf", BT_FN_INT_STRING_CONST_STRING_VALIST_ARG, ATTR_FORMAT_PRINTF_NOTHROW_2_0)
|
||
|
+DEF_C99_BUILTIN (BUILT_IN_VSSCANF, "vsscanf", BT_FN_INT_CONST_STRING_CONST_STRING_VALIST_ARG, ATTR_FORMAT_SCANF_NOTHROW_2_0)
|
||
|
|
||
|
/* Category: ctype builtins. */
|
||
|
DEF_LIB_BUILTIN (BUILT_IN_ISALNUM, "isalnum", BT_FN_INT_INT, ATTR_PURE_NOTHROW_LIST)
|
||
|
@@ -693,8 +693,8 @@ DEF_GCC_BUILTIN (BUILT_IN_RETURN_
|
||
|
DEF_GCC_BUILTIN (BUILT_IN_SAVEREGS, "saveregs", BT_FN_PTR_VAR, ATTR_NULL)
|
||
|
DEF_GCC_BUILTIN (BUILT_IN_SETJMP, "setjmp", BT_FN_INT_PTR, ATTR_NULL)
|
||
|
DEF_GCC_BUILTIN (BUILT_IN_STDARG_START, "stdarg_start", BT_FN_VOID_VALIST_REF_VAR, ATTR_NULL)
|
||
|
-DEF_EXT_LIB_BUILTIN (BUILT_IN_STRFMON, "strfmon", BT_FN_SSIZE_STRING_SIZE_CONST_STRING_VAR, ATTR_FORMAT_STRFMON_3_4)
|
||
|
-DEF_LIB_BUILTIN (BUILT_IN_STRFTIME, "strftime", BT_FN_SIZE_STRING_SIZE_CONST_STRING_CONST_PTR, ATTR_FORMAT_STRFTIME_3_0)
|
||
|
+DEF_EXT_LIB_BUILTIN (BUILT_IN_STRFMON, "strfmon", BT_FN_SSIZE_STRING_SIZE_CONST_STRING_VAR, ATTR_FORMAT_STRFMON_NOTHROW_3_4)
|
||
|
+DEF_LIB_BUILTIN (BUILT_IN_STRFTIME, "strftime", BT_FN_SIZE_STRING_SIZE_CONST_STRING_CONST_PTR, ATTR_FORMAT_STRFTIME_NOTHROW_3_0)
|
||
|
DEF_GCC_BUILTIN (BUILT_IN_TRAP, "trap", BT_FN_VOID, ATTR_NORETURN_NOTHROW_LIST)
|
||
|
DEF_GCC_BUILTIN (BUILT_IN_UNWIND_INIT, "unwind_init", BT_FN_VOID, ATTR_NULL)
|
||
|
DEF_GCC_BUILTIN (BUILT_IN_UPDATE_SETJMP_BUF, "update_setjmp_buf", BT_FN_VOID_PTR_INT, ATTR_NULL)
|
||
|
@@ -730,10 +730,10 @@ DEF_EXT_LIB_BUILTIN (BUILT_IN_STRCAT_
|
||
|
DEF_EXT_LIB_BUILTIN (BUILT_IN_STRCPY_CHK, "__strcpy_chk", BT_FN_STRING_STRING_CONST_STRING_SIZE, ATTR_NOTHROW_NONNULL)
|
||
|
DEF_EXT_LIB_BUILTIN (BUILT_IN_STRNCAT_CHK, "__strncat_chk", BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, ATTR_NOTHROW_NONNULL)
|
||
|
DEF_EXT_LIB_BUILTIN (BUILT_IN_STRNCPY_CHK, "__strncpy_chk", BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, ATTR_NOTHROW_NONNULL)
|
||
|
-DEF_EXT_LIB_BUILTIN (BUILT_IN_SNPRINTF_CHK, "__snprintf_chk", BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR, ATTR_FORMAT_PRINTF_5_6)
|
||
|
-DEF_EXT_LIB_BUILTIN (BUILT_IN_SPRINTF_CHK, "__sprintf_chk", BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, ATTR_FORMAT_PRINTF_4_5)
|
||
|
-DEF_EXT_LIB_BUILTIN (BUILT_IN_VSNPRINTF_CHK, "__vsnprintf_chk", BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, ATTR_FORMAT_PRINTF_5_0)
|
||
|
-DEF_EXT_LIB_BUILTIN (BUILT_IN_VSPRINTF_CHK, "__vsprintf_chk", BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, ATTR_FORMAT_PRINTF_4_0)
|
||
|
+DEF_EXT_LIB_BUILTIN (BUILT_IN_SNPRINTF_CHK, "__snprintf_chk", BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR, ATTR_FORMAT_PRINTF_NOTHROW_5_6)
|
||
|
+DEF_EXT_LIB_BUILTIN (BUILT_IN_SPRINTF_CHK, "__sprintf_chk", BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, ATTR_FORMAT_PRINTF_NOTHROW_4_5)
|
||
|
+DEF_EXT_LIB_BUILTIN (BUILT_IN_VSNPRINTF_CHK, "__vsnprintf_chk", BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, ATTR_FORMAT_PRINTF_NOTHROW_5_0)
|
||
|
+DEF_EXT_LIB_BUILTIN (BUILT_IN_VSPRINTF_CHK, "__vsprintf_chk", BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, ATTR_FORMAT_PRINTF_NOTHROW_4_0)
|
||
|
DEF_EXT_LIB_BUILTIN (BUILT_IN_FPRINTF_CHK, "__fprintf_chk", BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, ATTR_FORMAT_PRINTF_3_4)
|
||
|
DEF_EXT_LIB_BUILTIN (BUILT_IN_PRINTF_CHK, "__printf_chk", BT_FN_INT_INT_CONST_STRING_VAR, ATTR_FORMAT_PRINTF_2_3)
|
||
|
DEF_EXT_LIB_BUILTIN (BUILT_IN_VFPRINTF_CHK, "__vfprintf_chk", BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, ATTR_FORMAT_PRINTF_3_0)
|