summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/cleanup-2.c
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2003-06-04 17:06:00 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2003-06-04 17:06:00 +0000
commit7acb29a3d9e072c65c26e582d4f4204dcf232d4a (patch)
treed3d591092d6a64dfc049785317e9f17e96cf7276 /gcc/testsuite/gcc.dg/cleanup-2.c
parent3fd62642d6a042a192f405ab559a0fef3c49f588 (diff)
downloadgcc-7acb29a3d9e072c65c26e582d4f4204dcf232d4a.tar.gz
* c-common.c (handle_cleanup_attribute): New.
(c_common_attributes): Add it. * c-decl.c (finish_decl): Honor the cleanup attribute. * doc/extend.texi (Variable Attributes): Document it. * unwind-c.c: New file. * Makefile.in (LIB2ADDEH): Add it. * config/t-darwin, config/t-linux, config/t-linux-gnulibc1, config/ia64/t-ia64: Likewise. * gcc.dg/cleanup-1.c: New. * gcc.dg/cleanup-2.c: New. * gcc.dg/cleanup-3.c: New. * gcc.dg/cleanup-4.c: New. * gcc.dg/cleanup-5.c: New. * gcc.dg/cleanup-6.c: New. * gcc.dg/cleanup-7.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@67449 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/cleanup-2.c')
-rw-r--r--gcc/testsuite/gcc.dg/cleanup-2.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/cleanup-2.c b/gcc/testsuite/gcc.dg/cleanup-2.c
new file mode 100644
index 00000000000..2c798023ccb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cleanup-2.c
@@ -0,0 +1,22 @@
+/* { dg-do run } */
+/* { dg-options "" } */
+/* Verify that cleanup works in the most basic of ways. */
+
+extern void exit(int);
+extern void abort(void);
+
+static void handler(void *p __attribute__((unused)))
+{
+ exit (0);
+}
+
+static void doit(void)
+{
+ int x __attribute__((cleanup (handler)));
+}
+
+int main()
+{
+ doit ();
+ abort ();
+}