builtins.def (DEF_FALLBACK_BUILTIN): Delete.

* builtins.def (DEF_FALLBACK_BUILTIN): Delete.
	(DEF_EXT_FALLBACK_BUILTIN): Delete.
	(BUILT_IN_BZERO, BUILT_IN_BCOPY, BUILT_IN_BCMP): Declare using
	the regular DEF_EXT_LIB_BUILTIN macro.
	(BUILT_IN_FPUTC, BUILT_IN_FPUTS, BUILT_IN_FWRITE): Declare using
	the regular DEF_LIB_BUILTIN macro.
	(BUILT_IN_PUTCHAR_UNLOCKED, BUILT_IN_PUTS_UNLOCKED,
	BUILT_IN_FPUTC_UNLOCKED, BUILT_IN_FPUTS_UNLOCKED,
	BUILT_IN_FWRITE_UNLOCKED): Declare using the regular
	DEF_EXT_LIB_BUILTIN macro.

	* c-decl.c (duplicate_decls): Remove code to handle builtin
	functions prototyped without an argument list.

From-SVN: r69814
This commit is contained in:
Roger Sayle 2003-07-26 13:27:20 +00:00 committed by Roger Sayle
parent 92e7a6efaf
commit cc42f5f54c
3 changed files with 63 additions and 95 deletions

View File

@ -1,3 +1,19 @@
2003-07-26 Roger Sayle <roger@eyesopen.com>
* builtins.def (DEF_FALLBACK_BUILTIN): Delete.
(DEF_EXT_FALLBACK_BUILTIN): Delete.
(BUILT_IN_BZERO, BUILT_IN_BCOPY, BUILT_IN_BCMP): Declare using
the regular DEF_EXT_LIB_BUILTIN macro.
(BUILT_IN_FPUTC, BUILT_IN_FPUTS, BUILT_IN_FWRITE): Declare using
the regular DEF_LIB_BUILTIN macro.
(BUILT_IN_PUTCHAR_UNLOCKED, BUILT_IN_PUTS_UNLOCKED,
BUILT_IN_FPUTC_UNLOCKED, BUILT_IN_FPUTS_UNLOCKED,
BUILT_IN_FWRITE_UNLOCKED): Declare using the regular
DEF_EXT_LIB_BUILTIN macro.
* c-decl.c (duplicate_decls): Remove code to handle builtin
functions prototyped without an argument list.
2003-07-26 Danny Smith <dannysmith@users.sourceforge.net>
* config/i386/winnt.c: Revert 2003-07-08 change.

View File

@ -70,24 +70,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, TYPE, BT_LAST, \
false, false, false, ATTRS, true)
/* A fallback builtin is a builtin (like __builtin_puts) that falls
back to the corresponding library function if necessary -- but
for which we should not introduce the non-`__builtin' variant of
the name. */
#undef DEF_FALLBACK_BUILTIN
#define DEF_FALLBACK_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
false, true, false, ATTRS, true)
/* 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, ATTRS) \
DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
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
`__builtin' version, we will create an ordinary version (e.g,
@ -273,33 +255,20 @@ DEF_C99_BUILTIN(BUILT_IN_CABSL,
BT_FN_LONG_DOUBLE_COMPLEX_LONG_DOUBLE,
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.
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,
BT_FN_VOID_PTR_SIZE,
BT_FN_VOID_VAR,
true, true, true,
ATTR_NOTHROW_LIST, false)
DEF_BUILTIN (BUILT_IN_BCOPY,
"__builtin_bcopy",
BUILT_IN_NORMAL,
BT_FN_VOID_CONST_PTR_PTR_SIZE,
BT_FN_VOID_VAR,
true, true, true,
ATTR_NOTHROW_LIST, false)
DEF_BUILTIN (BUILT_IN_BCMP,
"__builtin_bcmp",
BUILT_IN_NORMAL,
BT_FN_INT_CONST_PTR_CONST_PTR_SIZE,
BT_FN_INT_VAR,
true, true, true,
ATTR_PURE_NOTHROW_LIST, false)
/* These functions have traditionally accepted NULL pointers when the
length parameter is zero, so don't apply attribute "nonnull". */
DEF_EXT_LIB_BUILTIN(BUILT_IN_BZERO,
"__builtin_bzero",
BT_FN_VOID_PTR_SIZE,
ATTR_NOTHROW_LIST)
DEF_EXT_LIB_BUILTIN(BUILT_IN_BCOPY,
"__builtin_bcopy",
BT_FN_VOID_CONST_PTR_PTR_SIZE,
ATTR_NOTHROW_LIST)
DEF_EXT_LIB_BUILTIN(BUILT_IN_BCMP,
"__builtin_bcmp",
BT_FN_INT_CONST_PTR_CONST_PTR_SIZE,
ATTR_PURE_NOTHROW_LIST)
DEF_EXT_LIB_BUILTIN(BUILT_IN_FFS,
"__builtin_ffs",
@ -810,20 +779,18 @@ DEF_LIB_BUILTIN(BUILT_IN_VSPRINTF,
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_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_NONNULL_1_2, true)
DEF_FALLBACK_BUILTIN(BUILT_IN_FWRITE,
"__builtin_fwrite",
BT_FN_SIZE_CONST_PTR_SIZE_SIZE_PTR,
ATTR_NOTHROW_NONNULL_1_4)
DEF_LIB_BUILTIN(BUILT_IN_FPUTC,
"__builtin_fputc",
BT_FN_INT_INT_PTR,
ATTR_NOTHROW_NONNULL_2)
DEF_LIB_BUILTIN(BUILT_IN_FPUTS,
"__builtin_fputs",
BT_FN_INT_CONST_STRING_PTR,
ATTR_NOTHROW_NONNULL_1_2)
DEF_LIB_BUILTIN(BUILT_IN_FWRITE,
"__builtin_fwrite",
BT_FN_SIZE_CONST_PTR_SIZE_SIZE_PTR,
ATTR_NOTHROW_NONNULL_1_4)
DEF_LIB_BUILTIN(BUILT_IN_FPRINTF,
"__builtin_fprintf",
BT_FN_INT_PTR_CONST_STRING_VAR,
@ -831,12 +798,14 @@ DEF_LIB_BUILTIN(BUILT_IN_FPRINTF,
/* stdio unlocked builtins (without FILE *). */
DEF_EXT_FALLBACK_BUILTIN(BUILT_IN_PUTCHAR_UNLOCKED,
"__builtin_putchar_unlocked",
BT_FN_INT_INT, ATTR_NOTHROW_LIST)
DEF_EXT_FALLBACK_BUILTIN(BUILT_IN_PUTS_UNLOCKED,
"__builtin_puts_unlocked",
BT_FN_INT_CONST_STRING, ATTR_NOTHROW_NONNULL_1)
DEF_EXT_LIB_BUILTIN(BUILT_IN_PUTCHAR_UNLOCKED,
"__builtin_putchar_unlocked",
BT_FN_INT_INT,
ATTR_NOTHROW_LIST)
DEF_EXT_LIB_BUILTIN(BUILT_IN_PUTS_UNLOCKED,
"__builtin_puts_unlocked",
BT_FN_INT_CONST_STRING,
ATTR_NOTHROW_NONNULL_1)
DEF_EXT_LIB_BUILTIN(BUILT_IN_PRINTF_UNLOCKED,
"__builtin_printf_unlocked",
BT_FN_INT_CONST_STRING_VAR,
@ -849,19 +818,18 @@ DEF_EXT_LIB_BUILTIN(BUILT_IN_PRINTF_UNLOCKED,
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, 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_NONNULL_1_2, true)
DEF_EXT_FALLBACK_BUILTIN(BUILT_IN_FWRITE_UNLOCKED,
"__builtin_fwrite_unlocked",
BT_FN_SIZE_CONST_PTR_SIZE_SIZE_PTR,
ATTR_NOTHROW_NONNULL_1_4)
DEF_EXT_LIB_BUILTIN(BUILT_IN_FPUTC_UNLOCKED,
"__builtin_fputc_unlocked",
BT_FN_INT_INT_PTR,
ATTR_NOTHROW_NONNULL_2)
DEF_EXT_LIB_BUILTIN(BUILT_IN_FPUTS_UNLOCKED,
"__builtin_fputs_unlocked",
BT_FN_INT_CONST_STRING_PTR,
ATTR_NOTHROW_NONNULL_1_2)
DEF_EXT_LIB_BUILTIN(BUILT_IN_FWRITE_UNLOCKED,
"__builtin_fwrite_unlocked",
BT_FN_SIZE_CONST_PTR_SIZE_SIZE_PTR,
ATTR_NOTHROW_NONNULL_1_4)
DEF_EXT_LIB_BUILTIN(BUILT_IN_FPRINTF_UNLOCKED,
"__builtin_fprintf_unlocked",
BT_FN_INT_PTR_CONST_STRING_VAR,

View File

@ -861,7 +861,7 @@ duplicate_decls (tree newdecl, tree olddecl, int different_binding_level,
/* Discard the old built-in function. */
return 0;
}
else if (!types_match)
if (!types_match)
{
/* Accept harmless mismatch in function types.
This is for the ffs and fprintf builtins. */
@ -876,22 +876,6 @@ duplicate_decls (tree newdecl, tree olddecl, int different_binding_level,
TREE_TYPE (olddecl) = oldtype;
}
}
else if (TYPE_ARG_TYPES (oldtype) == NULL
&& TYPE_ARG_TYPES (newtype) != NULL)
{
/* For bcmp, bzero, fputs the builtin type has arguments not
specified. Use the ones from the prototype so that type checking
is done for them. */
tree trytype
= build_function_type (TREE_TYPE (oldtype),
TYPE_ARG_TYPES (newtype));
trytype = build_type_attribute_variant (trytype,
TYPE_ATTRIBUTES (oldtype));
oldtype = trytype;
if (! different_binding_level)
TREE_TYPE (olddecl) = oldtype;
}
if (!types_match)
{
/* If types don't match for a built-in, throw away the built-in. */