From 1331d16fd4b57c5927cec03b5a320bc59366a628 Mon Sep 17 00:00:00 2001 From: Roger Sayle Date: Mon, 14 Apr 2003 02:55:31 +0000 Subject: builtin-types.def (BT_FN_STRING_CONST_STRING): New builtin type. * builtin-types.def (BT_FN_STRING_CONST_STRING): New builtin type. (BT_FN_PTR_SIZE_SIZE): Likewise. * builtins.def (BUILT_IN_MALLOC, BUILT_IN_CALLOC, BUILT_IN_STRDUP): New built-in functions for malloc, calloc and strdup respectively. * calls.c (special_function_p): No need to handle malloc-like functions any longer. ECF_MALLOC is set via built-in attributes. * c-decl.c (duplicate_decls): Preserve pure and malloc attributes. * cp/decl.c (duplicate_decls): Preserve pure and malloc attributes. * f/com.c (duplicate_decls): Preserve pure and malloc attributes. * doc/extend.texi: Document these new built-in functions. * gcc.dg/builtins-13.c: New test case. * gcc.dg/builtins-14.c: New test case. From-SVN: r65560 --- gcc/builtins.def | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'gcc/builtins.def') diff --git a/gcc/builtins.def b/gcc/builtins.def index 1d456e9..f0d118b 100644 --- a/gcc/builtins.def +++ b/gcc/builtins.def @@ -936,3 +936,19 @@ DEF_C99_BUILTIN(BUILT_IN__EXIT2, BT_FN_VOID_INT, ATTR_NORETURN_NOTHROW_LIST) +/* Declare malloc, calloc and strdup. */ +DEF_LIB_BUILTIN(BUILT_IN_MALLOC, + "__builtin_malloc", + BT_FN_PTR_SIZE, + ATTR_MALLOC_NOTHROW_LIST) + +DEF_LIB_BUILTIN(BUILT_IN_CALLOC, + "__builtin_calloc", + BT_FN_PTR_SIZE_SIZE, + ATTR_MALLOC_NOTHROW_LIST) + +DEF_EXT_LIB_BUILTIN(BUILT_IN_STRDUP, + "__builtin_strdup", + BT_FN_STRING_CONST_STRING, + ATTR_MALLOC_NOTHROW_LIST) + -- cgit v1.1