aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2006-01-18 15:04:01 -0500
committerDJ Delorie <dj@gcc.gnu.org>2006-01-18 15:04:01 -0500
commitcea24134be6d4996322733862d327a3d40268d2d (patch)
tree0ce66fbd7f1ed533eda7b0fb37b3023a151aae03 /gcc
parent79cf599406a6a51e2fdd47810fdba89e04cbf1cc (diff)
downloadgcc-cea24134be6d4996322733862d327a3d40268d2d.zip
gcc-cea24134be6d4996322733862d327a3d40268d2d.tar.gz
gcc-cea24134be6d4996322733862d327a3d40268d2d.tar.bz2
Werror-1.c, [...]: New.
* 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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/gcc.dg/Werror-1.c21
-rw-r--r--gcc/testsuite/gcc.dg/Werror-10.c18
-rw-r--r--gcc/testsuite/gcc.dg/Werror-11.c18
-rw-r--r--gcc/testsuite/gcc.dg/Werror-12.c17
-rw-r--r--gcc/testsuite/gcc.dg/Werror-2.c16
-rw-r--r--gcc/testsuite/gcc.dg/Werror-3.c15
-rw-r--r--gcc/testsuite/gcc.dg/Werror-4.c17
-rw-r--r--gcc/testsuite/gcc.dg/Werror-5.c16
-rw-r--r--gcc/testsuite/gcc.dg/Werror-6.c15
-rw-r--r--gcc/testsuite/gcc.dg/Werror-7.c16
-rw-r--r--gcc/testsuite/gcc.dg/Werror-8.c17
-rw-r--r--gcc/testsuite/gcc.dg/Werror-9.c17
13 files changed, 210 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index f797394..deca25d 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..d50e07c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Werror-1.c
@@ -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
index 0000000..3e2c9df
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Werror-10.c
@@ -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
index 0000000..14aae31
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Werror-11.c
@@ -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
index 0000000..0cb1f78
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Werror-12.c
@@ -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
index 0000000..8e08ba0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Werror-2.c
@@ -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
index 0000000..a994714
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Werror-3.c
@@ -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
index 0000000..45d217b3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Werror-4.c
@@ -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
index 0000000..3912590
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Werror-5.c
@@ -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
index 0000000..11f28b0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Werror-6.c
@@ -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
index 0000000..e667199
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Werror-7.c
@@ -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
index 0000000..ec70a2e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Werror-8.c
@@ -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
index 0000000..5b28779
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Werror-9.c
@@ -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 ();
+}