summaryrefslogtreecommitdiffstats
path: root/gcc/testsuite/gcc.dg/cleanup-2.c
diff options
context:
space:
mode:
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 ();
+}
OpenPOWER on IntegriCloud