aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/builtins-12.c
diff options
context:
space:
mode:
authorRoger Sayle <roger@eyesopen.com>2003-04-14 02:55:31 +0000
committerRoger Sayle <sayle@gcc.gnu.org>2003-04-14 02:55:31 +0000
commit1331d16fd4b57c5927cec03b5a320bc59366a628 (patch)
treedd3d088e82001ccf169ac01fc9027aa8ec737b49 /gcc/testsuite/gcc.dg/builtins-12.c
parente235df1f71573b7652df5ecec912f190055baf22 (diff)
downloadgcc-1331d16fd4b57c5927cec03b5a320bc59366a628.zip
gcc-1331d16fd4b57c5927cec03b5a320bc59366a628.tar.gz
gcc-1331d16fd4b57c5927cec03b5a320bc59366a628.tar.bz2
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
Diffstat (limited to 'gcc/testsuite/gcc.dg/builtins-12.c')
-rw-r--r--gcc/testsuite/gcc.dg/builtins-12.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/builtins-12.c b/gcc/testsuite/gcc.dg/builtins-12.c
new file mode 100644
index 0000000..22ba8ce
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/builtins-12.c
@@ -0,0 +1,27 @@
+/* Copyright (C) 2003 Free Software Foundation.
+
+ Verify that all the malloc-like __builtin_ allocation functions are
+ recognized by the compiler.
+
+ Written by Roger Sayle, 12th April 2003. */
+
+/* { dg-do compile } */
+/* { dg-final { scan-assembler-not "__builtin_" } } */
+
+typedef __SIZE_TYPE__ size_t;
+
+void *test1(size_t n)
+{
+ return __builtin_malloc(n);
+}
+
+void *test2(size_t n, size_t s)
+{
+ return __builtin_calloc(n,s);
+}
+
+char *test3(const char *ptr)
+{
+ return __builtin_strdup(ptr);
+}
+