===================================================================
@@ -0,0 +1,7 @@
+/* Test C2x attribute syntax: rejected in C11. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic-errors" } */
+
+[[]]; /* { dg-error "attributes before C2X" } */
+
+void f [[]] (void); /* { dg-error "attributes before C2X" } */
===================================================================
@@ -0,0 +1,7 @@
+/* Test C2x attribute syntax: rejected in C11. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic" } */
+
+[[]]; /* { dg-warning "attributes before C2X" } */
+
+void f [[]] (void); /* { dg-warning "attributes before C2X" } */
===================================================================
@@ -0,0 +1,8 @@
+/* Test C2x attribute syntax: rejected in C11, but warning disabled
+ with -Wno-c11-c2x-compat. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic -Wno-c11-c2x-compat" } */
+
+[[]];
+
+void f [[]] (void);
===================================================================
@@ -89,3 +89,11 @@
{
return y.b; /* { dg-warning "deprecated" } */
}
+
+struct [[deprecated]] s { int x; };
+
+void
+f12 (void)
+{
+ struct s var; /* { dg-warning "deprecated" } */
+}
===================================================================
@@ -16,6 +16,12 @@
case 3:
b += 7;
break;
+ case 4:
+ b = 5;
+ [[__fallthrough__]];
+ case 5:
+ b += 1;
+ break;
}
return b;
}
===================================================================
@@ -0,0 +1,7 @@
+/* Test C2x attribute syntax: diagnosed with -Wc11-c2x-compat. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors -Wc11-c2x-compat" } */
+
+[[]]; /* { dg-warning "attributes before C2X" } */
+
+void f [[]] (void); /* { dg-warning "attributes before C2X" } */