summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pack-test-2.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/pack-test-2.c')
-rw-r--r--gcc/testsuite/gcc.dg/pack-test-2.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pack-test-2.c b/gcc/testsuite/gcc.dg/pack-test-2.c
new file mode 100644
index 000000000..5c2f6ae46
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pack-test-2.c
@@ -0,0 +1,25 @@
+/* Tests for syntax checking of #pragma pack.
+ Contributed by Mike Coleman <mcoleman2@kc.rr.com> */
+
+/* { dg-do compile } */
+
+#pragma pack(pop) /* { dg-warning "without matching" } */
+
+#pragma pack(push)
+#pragma pack(pop) /* reset */
+
+#pragma pack(push, foo, 1)
+#pragma pack(pop, foo, 1) /* { dg-warning "malformed" } (/
+#pragma pack(pop) /* reset */
+
+#pragma pack(push, foo, 1)
+#pragma pack(pop, bar) /* { dg-warning "without matching" } */
+#pragma pack(pop) /* reset */
+
+#pragma pack(push, foo, 1)
+#pragma pack(pop)
+#pragma pack(pop, foo) /* { dg-warning "without matching" } */
+
+#pragma pack(push, foo, 3) /* { dg-warning "small power of two" } */
+
+extern int blah; /* prevent "ISO C forbids an empty translation unit" */