]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Werror-1.c, [...]: New.
authorDJ Delorie <dj@redhat.com>
Wed, 18 Jan 2006 20:04:01 +0000 (15:04 -0500)
committerDJ Delorie <dj@gcc.gnu.org>
Wed, 18 Jan 2006 20:04:01 +0000 (15:04 -0500)
* 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.

From-SVN: r109908

13 files changed:
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/Werror-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Werror-10.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Werror-11.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Werror-12.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Werror-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Werror-3.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Werror-4.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Werror-5.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Werror-6.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Werror-7.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Werror-8.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Werror-9.c [new file with mode: 0644]

index f7973945267d7a7086c76ff25a10c76b0d4b7ad9..deca25d98502149dc84adfa0e86623a08e395f22 100644 (file)
@@ -1,3 +1,10 @@
+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
diff --git a/gcc/testsuite/gcc.dg/Werror-1.c b/gcc/testsuite/gcc.dg/Werror-1.c
new file mode 100644 (file)
index 0000000..d50e07c
--- /dev/null
@@ -0,0 +1,21 @@
+/* { 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 ();
+}
diff --git a/gcc/testsuite/gcc.dg/Werror-10.c b/gcc/testsuite/gcc.dg/Werror-10.c
new file mode 100644 (file)
index 0000000..3e2c9df
--- /dev/null
@@ -0,0 +1,18 @@
+/* { 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 ();
+}
diff --git a/gcc/testsuite/gcc.dg/Werror-11.c b/gcc/testsuite/gcc.dg/Werror-11.c
new file mode 100644 (file)
index 0000000..14aae31
--- /dev/null
@@ -0,0 +1,18 @@
+/* { 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 ();
+}
diff --git a/gcc/testsuite/gcc.dg/Werror-12.c b/gcc/testsuite/gcc.dg/Werror-12.c
new file mode 100644 (file)
index 0000000..0cb1f78
--- /dev/null
@@ -0,0 +1,17 @@
+/* { 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 ();
+}
diff --git a/gcc/testsuite/gcc.dg/Werror-2.c b/gcc/testsuite/gcc.dg/Werror-2.c
new file mode 100644 (file)
index 0000000..8e08ba0
--- /dev/null
@@ -0,0 +1,16 @@
+/* { 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 ();
+}
diff --git a/gcc/testsuite/gcc.dg/Werror-3.c b/gcc/testsuite/gcc.dg/Werror-3.c
new file mode 100644 (file)
index 0000000..a994714
--- /dev/null
@@ -0,0 +1,15 @@
+/* { 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 ();
+}
diff --git a/gcc/testsuite/gcc.dg/Werror-4.c b/gcc/testsuite/gcc.dg/Werror-4.c
new file mode 100644 (file)
index 0000000..45d217b
--- /dev/null
@@ -0,0 +1,17 @@
+/* { 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 ();
+}
diff --git a/gcc/testsuite/gcc.dg/Werror-5.c b/gcc/testsuite/gcc.dg/Werror-5.c
new file mode 100644 (file)
index 0000000..3912590
--- /dev/null
@@ -0,0 +1,16 @@
+/* { 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 ();
+}
diff --git a/gcc/testsuite/gcc.dg/Werror-6.c b/gcc/testsuite/gcc.dg/Werror-6.c
new file mode 100644 (file)
index 0000000..11f28b0
--- /dev/null
@@ -0,0 +1,15 @@
+/* { 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 ();
+}
diff --git a/gcc/testsuite/gcc.dg/Werror-7.c b/gcc/testsuite/gcc.dg/Werror-7.c
new file mode 100644 (file)
index 0000000..e667199
--- /dev/null
@@ -0,0 +1,16 @@
+/* { 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 ();
+}
diff --git a/gcc/testsuite/gcc.dg/Werror-8.c b/gcc/testsuite/gcc.dg/Werror-8.c
new file mode 100644 (file)
index 0000000..ec70a2e
--- /dev/null
@@ -0,0 +1,17 @@
+/* { 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 ();
+}
diff --git a/gcc/testsuite/gcc.dg/Werror-9.c b/gcc/testsuite/gcc.dg/Werror-9.c
new file mode 100644 (file)
index 0000000..5b28779
--- /dev/null
@@ -0,0 +1,17 @@
+/* { 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 ();
+}