summaryrefslogtreecommitdiff
path: root/gcc/builtins.def
diff options
context:
space:
mode:
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>2001-12-21 02:36:37 +0000
committerKaveh Ghazi <ghazi@gcc.gnu.org>2001-12-21 02:36:37 +0000
commitb4c984fbec1caaaa03c2c2bf2c9b42d3f7679223 (patch)
tree840ebfbffcd09b2abfcb6059dc21b1f965cc1ab5 /gcc/builtins.def
parentbfa8af3e37f63413295d14f15eae6dda770d4a02 (diff)
downloadgcc-b4c984fbec1caaaa03c2c2bf2c9b42d3f7679223.tar.gz
builtin-attrs.def (__builtin_printf_unlocked, [...]): Mark with the __printf__ attribute.
* builtin-attrs.def (__builtin_printf_unlocked, __builtin_fprintf_unlocked, printf_unlocked, fprintf_unlocked): Mark with the __printf__ attribute. * builtins.c (expand_builtin_fputs): Add an `unlocked' parameter and set the replacement function depending on it. (expand_builtin): Skip BUILT_IN_*_UNLOCKED when not optimizing. Handle BUILT_IN_*_UNLOCKED when optimizing. * builtins.def (DEF_EXT_FALLBACK_BUILTIN, DEF_EXT_FRONT_END_LIB_BUILTIN): New macros. Declare the "unlocked" stdio functions. * c-common.c (c_expand_builtin_printf, c_expand_builtin_fprintf): Add an `unlocked' parameter and set the replacement function depending on it. (c_expand_builtin): Handle BUILT_IN_PRINTF_UNLOCKED and BUILT_IN_FPRINTF_UNLOCKED. * doc/extend.texi (printf_unlocked, fprintf_unlocked, fputs_unlocked): Document. testsuite: * gcc.dg/format/builtin-1.c: Test unlocked stdio. * gcc.dg/format/c90-printf-3.c: Likewise. * gcc.dg/format/c99-printf-3.c: Likewise. * gcc.dg/format/ext-1.c: Likewise. * gcc.dg/format/ext-6.c: Likewise. * gcc.dg/format/format.h: Prototype unlocked stdio. From-SVN: r48229
Diffstat (limited to 'gcc/builtins.def')
-rw-r--r--gcc/builtins.def49
1 files changed, 49 insertions, 0 deletions
diff --git a/gcc/builtins.def b/gcc/builtins.def
index 58d94932504..7b58bef1ae1 100644
--- a/gcc/builtins.def
+++ b/gcc/builtins.def
@@ -70,6 +70,15 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
false, true, false)
+/* Like DEF_FALLBACK_BUILTIN, except that the function is not one that
+ is specified by ANSI/ISO C. So, when we're being fully conformant
+ 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) \
+ DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
+ false, true, true)
+
/* A library builtin (like __builtin_strchr) is a builtin equivalent
of an ANSI/ISO standard library function. In addition to the
`__builtin' version, we will create an ordinary version (e.g,
@@ -111,6 +120,15 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
DEF_BUILTIN (ENUM, NAME, BUILT_IN_FRONTEND, TYPE, TYPE, \
true, true, false)
+/* Like DEF_FRONT_END_LIB_BUILTIN, except that the function is not one
+ that is specified by ANSI/ISO C. So, when we're being fully
+ conformant we ignore the version of these builtins that does not
+ begin with __builtin. */
+#undef DEF_EXT_FRONT_END_LIB_BUILTIN
+#define DEF_EXT_FRONT_END_LIB_BUILTIN(ENUM, NAME, TYPE) \
+ DEF_BUILTIN (ENUM, NAME, BUILT_IN_FRONTEND, TYPE, TYPE, \
+ true, true, true)
+
/* A built-in that is not currently used. */
#undef DEF_UNUSED_BUILTIN
#define DEF_UNUSED_BUILTIN(X) \
@@ -370,6 +388,37 @@ DEF_FRONT_END_LIB_BUILTIN(BUILT_IN_FPRINTF,
"__builtin_fprintf",
BT_FN_INT_PTR_CONST_STRING_VAR)
+/* Stdio unlocked builtins. */
+
+DEF_EXT_FALLBACK_BUILTIN(BUILT_IN_PUTCHAR_UNLOCKED,
+ "__builtin_putchar_unlocked",
+ BT_FN_INT_INT)
+DEF_EXT_FALLBACK_BUILTIN(BUILT_IN_PUTS_UNLOCKED,
+ "__builtin_puts_unlocked",
+ BT_FN_INT_CONST_STRING)
+DEF_EXT_FRONT_END_LIB_BUILTIN(BUILT_IN_PRINTF_UNLOCKED,
+ "__builtin_printf_unlocked",
+ BT_FN_INT_CONST_STRING_VAR)
+DEF_EXT_FALLBACK_BUILTIN(BUILT_IN_FPUTC_UNLOCKED,
+ "__builtin_fputc_unlocked",
+ BT_FN_INT_INT_PTR)
+/* 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_BUILTIN (BUILT_IN_FPUTS_UNLOCKED,
+ "__builtin_fputs_unlocked",
+ BUILT_IN_NORMAL,
+ BT_FN_INT_CONST_STRING_PTR,
+ BT_FN_INT_VAR,
+ true, true, true)
+DEF_EXT_FALLBACK_BUILTIN(BUILT_IN_FWRITE_UNLOCKED,
+ "__builtin_fwrite_unlocked",
+ BT_FN_SIZE_CONST_PTR_SIZE_SIZE_PTR)
+DEF_EXT_FRONT_END_LIB_BUILTIN(BUILT_IN_FPRINTF_UNLOCKED,
+ "__builtin_fprintf_unlocked",
+ BT_FN_INT_PTR_CONST_STRING_VAR)
+
/* ISO C99 floating point unordered comparisons. */
DEF_GCC_BUILTIN(BUILT_IN_ISGREATER,
"__builtin_isgreater",