+2006-01-18 DJ Delorie <dj@redhat.com>
+
+ * gcc.dg/Werror-1.c, gcc.dg/Werror-2.c, gcc.dg/Werror-3.c,
+ gcc.dg/Werror-4.c, gcc.dg/Werror-5.c, gcc.dg/Werror-6.c,
+ gcc.dg/Werror-7.c, gcc.dg/Werror-8.c, gcc.dg/Werror-9.c,
+ gcc.dg/Werror-10.c, gcc.dg/Werror-11.c, gcc.dg/Werror-12: New.
+
2006-01-18 Jeff Law <law@redhat.com>
* gcc.c-torture/execute/930529-1.x: Use -fwrapv as test depends
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-Walways-true -Wattributes -Werror" } */
+/* { dg-warning "warnings being treated as errors" "" {target "*-*-*"} 0 } */
+
+/* This is the first in a series of test cases that test the
+ interaction between -Wfoo, -Werror, -Werror=foo, and #pragma GCC
+ diagnostic error foo. This one has all the bits we're testing, the
+ others are subsets of this one. */
+
+#pragma GCC diagnostic error "-Walways-true"
+
+void __attribute__((dj)) bar() { } /* { dg-warning "warning: .* attribute directive ignored" } */
+
+int i;
+
+void
+foo ()
+{
+ if (&i) /* { dg-error "error: .* will always evaluate as 'true'" } */
+ grill ();
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-Wattributes -Werror" } */
+/* { dg-warning "warnings being treated as errors" "" {target "*-*-*"} 0 } */
+
+/* Make sure #pragma can work with -Werror. */
+
+#pragma GCC diagnostic error "-Walways-true"
+
+void __attribute__((dj)) bar() { } /* { dg-warning "warning: .* attribute directive ignored" } */
+
+int i;
+
+void
+foo ()
+{
+ if (&i) /* { dg-error "error: .* will always evaluate as 'true'" } */
+ grill ();
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-Wattributes -Werror" } */
+/* { dg-warning "warnings being treated as errors" "" {target "*-*-*"} 0 } */
+
+/* Make sure #pragma can override -Werror. */
+
+#pragma GCC diagnostic warning "-Walways-true"
+
+void __attribute__((dj)) bar() { } /* { dg-warning "warning: .* attribute directive ignored" } */
+
+int i;
+
+void
+foo ()
+{
+ if (&i) /* { dg-warning "warning: .* will always evaluate as 'true'" } */
+ grill ();
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-Wattributes -Walways-true" } */
+
+/* Make sure #pragma can override -Wfoo. */
+
+#pragma GCC diagnostic ignored "-Walways-true"
+
+void __attribute__((dj)) bar() { } /* { dg-warning "attribute directive ignored" } */
+
+int i;
+
+void
+foo ()
+{
+ if (&i) /* { dg-bogus "true" } */
+ grill ();
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+/* This one is the baseline. Make sure with no option we get no
+ warnings. */
+
+void __attribute__((dj)) bar() { } /* { dg-warning "warning: .* attribute directive ignored" } */
+
+int i;
+
+void
+foo ()
+{
+ if (&i)
+ grill ();
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-Walways-true -Wattributes" } */
+
+/* Make sure the command line option enables the warning. */
+
+void __attribute__((dj)) bar() { } /* { dg-warning "warning: .* attribute directive ignored" } */
+
+int i;
+
+void
+foo ()
+{
+ if (&i) /* { dg-warning "warning: .* will always evaluate as 'true'" } */
+ grill ();
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-Wattributes" } */
+
+/* Make sure the pragma enables the error. */
+
+#pragma GCC diagnostic error "-Walways-true"
+
+void __attribute__((dj)) bar() { } /* { dg-warning "warning: .* attribute directive ignored" } */
+
+int i;
+
+void
+foo ()
+{
+ if (&i) /* { dg-error "error: .* will always evaluate as 'true'" } */
+ grill ();
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-Walways-true -Wattributes -Werror" } */
+/* { dg-warning "warnings being treated as errors" "" {target "*-*-*"} 0 } */
+
+/* Make sure -Werror turns warnings in to errors. */
+
+void __attribute__((dj)) bar() { } /* { dg-warning "warning: .* attribute directive ignored" } */
+
+int i;
+
+void
+foo ()
+{
+ if (&i) /* { dg-warning "warning: .* will always evaluate as 'true'" } */
+ grill ();
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-Wattributes -Werror=always-true" } */
+
+/* Make sure -Werror-foo emits an error and not a warning */
+
+void __attribute__((dj)) bar() { } /* { dg-warning "warning: .* attribute directive ignored" } */
+
+int i;
+
+void
+foo ()
+{
+ if (&i) /* { dg-error "error: .* will always evaluate as 'true'" } */
+ grill ();
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-Walways-true -Werror -Wno-error=always-true -Wattributes" } */
+/* { dg-warning "warnings being treated as errors" "" {target "*-*-*"} 0 } */
+
+/* Make sure -Wno-error= overrides -Werror. */
+
+void __attribute__((dj)) bar() { } /* { dg-warning "warning: .* attribute directive ignored" } */
+
+int i;
+
+void
+foo ()
+{
+ if (&i) /* { dg-warning "warning: .* will always evaluate as 'true'" } */
+ grill ();
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-Wattributes" } */
+
+/* Make sure #pragma can enable a warning. */
+
+#pragma GCC diagnostic warning "-Walways-true"
+
+void __attribute__((dj)) bar() { } /* { dg-warning "warning: .* attribute directive ignored" } */
+
+int i;
+
+void
+foo ()
+{
+ if (&i) /* { dg-warning "warning: .* will always evaluate as 'true'" } */
+ grill ();
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-Wattributes" } */
+
+/* Make sure #pragma can enable a warning as an error. */
+
+#pragma GCC diagnostic error "-Walways-true"
+
+void __attribute__((dj)) bar() { } /* { dg-warning "warning: .* attribute directive ignored" } */
+
+int i;
+
+void
+foo ()
+{
+ if (&i) /* { dg-error "error: .* will always evaluate as 'true'" } */
+ grill ();
+}