aboutsummaryrefslogtreecommitdiff
path: root/gcc/builtins.def
diff options
context:
space:
mode:
authorRoger Sayle <roger@eyesopen.com>2003-03-02 01:34:34 +0000
committerRoger Sayle <sayle@gcc.gnu.org>2003-03-02 01:34:34 +0000
commit082916584969704a8b996bdbd0ea353a3b742bd3 (patch)
tree13a26927c2fd8d16601ecab3d5325e98595e4c07 /gcc/builtins.def
parent66c4e25802794e3c3c92e3cfdafe3ee8bd3b005c (diff)
downloadgcc-082916584969704a8b996bdbd0ea353a3b742bd3.zip
gcc-082916584969704a8b996bdbd0ea353a3b742bd3.tar.gz
gcc-082916584969704a8b996bdbd0ea353a3b742bd3.tar.bz2
re PR c++/9367 (error: nonnull argument with extern "C" snprintf prototype)
PR c++/9367 * builtin-types.def (DEF_FUNCTION_TYPE_VAR_3): New macro. (BT_FN_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_CONST_STRING_VALIST_ARG, BT_FN_INT_CONST_STRING_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_CONST_STRING_VAR, BT_FN_INT_CONST_STRING_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_CONST_STRING_VAR): New built-in types. * builtin-attrs.def (ATTR_NONNULL_1, ATTR_NONNULL_2, ATTR_NONNULL_3): Also include the nothrow attribute. (sprintf, scanf, sscanf, vprintf, vsprintf, snprintf, vsnprintf, vscanf, vsscanf): Don't define attributes here. * builtins.def (putchar, puts): Make full C89 built-ins. (snprintf, sprintf, scanf, sscanf, vprintf, vscanf, vsscanf, vsnprintf, vsprintf): New built-ins. * c-common.c (c_common_nodes_and_builtins): Handle new macro DEF_FUNCTION_TYPE_VAR_3. * doc/extend.texi: Document these new built-in functions. * java/builtins.c (builtin_type): Handle DEF_FUNCTION_TYPE_VAR_3. (initialize_builtins): Handle DEF_FUNCTION_TYPE_VAR_3. * g++.old-deja/g++.other/builtins10.C: New test for PR 9367. * gcc.dg/format/attr-5.c: Handle new conflicting types warning. From-SVN: r63650
Diffstat (limited to 'gcc/builtins.def')
-rw-r--r--gcc/builtins.def80
1 files changed, 63 insertions, 17 deletions
diff --git a/gcc/builtins.def b/gcc/builtins.def
index ae7d640..48fd197 100644
--- a/gcc/builtins.def
+++ b/gcc/builtins.def
@@ -711,27 +711,69 @@ DEF_GCC_BUILTIN(BUILT_IN_PREFETCH,
BT_FN_VOID_CONST_PTR_VAR,
ATTR_NULL)
-/* Stdio builtins. */
-DEF_FALLBACK_BUILTIN(BUILT_IN_PUTCHAR,
- "__builtin_putchar",
- BT_FN_INT_INT,
- ATTR_NOTHROW_LIST)
-DEF_FALLBACK_BUILTIN(BUILT_IN_PUTS,
- "__builtin_puts",
- BT_FN_INT_CONST_STRING,
- ATTR_NOTHROW_LIST)
+/* stdio.h builtins (without FILE *). */
+
DEF_FRONT_END_LIB_BUILTIN(BUILT_IN_PRINTF,
"__builtin_printf",
BT_FN_INT_CONST_STRING_VAR,
ATTR_FORMAT_PRINTF_1_2)
-DEF_FALLBACK_BUILTIN(BUILT_IN_FPUTC,
- "__builtin_fputc",
- BT_FN_INT_INT_PTR,
- ATTR_NOTHROW_LIST)
+DEF_LIB_BUILTIN(BUILT_IN_PUTCHAR,
+ "__builtin_putchar",
+ BT_FN_INT_INT,
+ ATTR_NOTHROW_LIST)
+DEF_LIB_BUILTIN(BUILT_IN_PUTS,
+ "__builtin_puts",
+ BT_FN_INT_CONST_STRING,
+ ATTR_NOTHROW_LIST)
+DEF_C99_BUILTIN(BUILT_IN_SNPRINTF,
+ "__builtin_snprintf",
+ BT_FN_INT_STRING_SIZE_CONST_STRING_VAR,
+ ATTR_FORMAT_PRINTF_3_4)
+DEF_LIB_BUILTIN(BUILT_IN_SPRINTF,
+ "__builtin_sprintf",
+ BT_FN_INT_STRING_CONST_STRING_VAR,
+ ATTR_FORMAT_PRINTF_2_3)
+DEF_LIB_BUILTIN(BUILT_IN_SCANF,
+ "__builtin_scanf",
+ BT_FN_INT_CONST_STRING_VAR,
+ ATTR_FORMAT_SCANF_1_2)
+DEF_LIB_BUILTIN(BUILT_IN_SSCANF,
+ "__builtin_sscanf",
+ BT_FN_INT_CONST_STRING_CONST_STRING_VAR,
+ ATTR_FORMAT_SCANF_2_3)
+DEF_LIB_BUILTIN(BUILT_IN_VPRINTF,
+ "__builtin_vprintf",
+ BT_FN_INT_CONST_STRING_VALIST_ARG,
+ ATTR_FORMAT_PRINTF_1_0)
+DEF_C99_BUILTIN(BUILT_IN_VSCANF,
+ "__builtin_vscanf",
+ BT_FN_INT_CONST_STRING_VALIST_ARG,
+ ATTR_FORMAT_SCANF_1_0)
+DEF_C99_BUILTIN(BUILT_IN_VSSCANF,
+ "__builtin_vsscanf",
+ BT_FN_INT_CONST_STRING_CONST_STRING_VALIST_ARG,
+ ATTR_FORMAT_SCANF_2_0)
+DEF_C99_BUILTIN(BUILT_IN_VSNPRINTF,
+ "__builtin_vsnprintf",
+ BT_FN_INT_STRING_SIZE_CONST_STRING_VALIST_ARG,
+ ATTR_FORMAT_PRINTF_3_0)
+DEF_LIB_BUILTIN(BUILT_IN_VSPRINTF,
+ "__builtin_vsprintf",
+ BT_FN_INT_STRING_CONST_STRING_VALIST_ARG,
+ ATTR_FORMAT_PRINTF_2_0)
+
+
+/* stdio.h builtins (with FILE *). */
+
/* Declare the __builtin_ style with arguments and the regular style
without them. We rely on stdio.h to supply the arguments for the
regular style declaration since we had to use void* instead of
FILE* in the __builtin_ prototype supplied here. */
+
+DEF_FALLBACK_BUILTIN(BUILT_IN_FPUTC,
+ "__builtin_fputc",
+ BT_FN_INT_INT_PTR,
+ ATTR_NOTHROW_LIST)
DEF_BUILTIN (BUILT_IN_FPUTS,
"__builtin_fputs",
BUILT_IN_NORMAL,
@@ -747,7 +789,7 @@ DEF_FRONT_END_LIB_BUILTIN(BUILT_IN_FPRINTF,
BT_FN_INT_PTR_CONST_STRING_VAR,
ATTR_FORMAT_PRINTF_2_3)
-/* Stdio unlocked builtins. */
+/* stdio unlocked builtins (without FILE *). */
DEF_EXT_FALLBACK_BUILTIN(BUILT_IN_PUTCHAR_UNLOCKED,
"__builtin_putchar_unlocked",
@@ -759,13 +801,17 @@ DEF_EXT_FRONT_END_LIB_BUILTIN(BUILT_IN_PRINTF_UNLOCKED,
"__builtin_printf_unlocked",
BT_FN_INT_CONST_STRING_VAR,
ATTR_FORMAT_PRINTF_1_2)
-DEF_EXT_FALLBACK_BUILTIN(BUILT_IN_FPUTC_UNLOCKED,
- "__builtin_fputc_unlocked",
- BT_FN_INT_INT_PTR)
+
+/* stdio unlocked builtins (with FILE *). */
+
/* Declare the __builtin_ style with arguments and the regular style
without them. We rely on stdio.h to supply the arguments for the
regular style declaration since we had to use void* instead of
FILE* in the __builtin_ prototype supplied here. */
+
+DEF_EXT_FALLBACK_BUILTIN(BUILT_IN_FPUTC_UNLOCKED,
+ "__builtin_fputc_unlocked",
+ BT_FN_INT_INT_PTR)
DEF_BUILTIN (BUILT_IN_FPUTS_UNLOCKED,
"__builtin_fputs_unlocked",
BUILT_IN_NORMAL,