]> gcc.gnu.org Git - gcc.git/commitdiff
Joseph S.
authorJoseph Myers <jsm28@cam.ac.uk>
Sun, 2 May 1999 15:14:53 +0000 (08:14 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Sun, 2 May 1999 15:14:53 +0000 (08:14 -0700)
Joseph S. Myers  <jsm28@cam.ac.uk>
        * gcc.dg/cast-qual-1.c, gcc.dg/return-type-1.c, gcc.dg/unused-1.c:
        New tests.

From-SVN: r26731

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/cast-qual-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/return-type-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/unused-1.c [new file with mode: 0644]

index 39c0ee314e6a4bec28ae3d70264b45170b036d2d..64ffc51820d284845b228c84699931fd688805d8 100644 (file)
@@ -1,3 +1,8 @@
+1999-05-02  Joseph S. Myers  <jsm28@cam.ac.uk>
+
+       * gcc.dg/cast-qual-1.c, gcc.dg/return-type-1.c, gcc.dg/unused-1.c:
+       New tests.
+
 1999-05-02  Craig Burley  <craig@jcb-sc.com>
 
        * g77.f-torture/compile/19990502-1.f: New test.
 1999-05-02  Craig Burley  <craig@jcb-sc.com>
 
        * g77.f-torture/compile/19990502-1.f: New test.
diff --git a/gcc/testsuite/gcc.dg/cast-qual-1.c b/gcc/testsuite/gcc.dg/cast-qual-1.c
new file mode 100644 (file)
index 0000000..a7a3470
--- /dev/null
@@ -0,0 +1,30 @@
+/* Incorrect `cast discards `const'' warnings.  There should be warnings
+   in bad_cast and bad_assign; bad_assign gets the correct warning, but
+   good_cast may get the warning instead of bad_cast.
+   gcc 2.7.2.3 passes, egcs-1.1.2 and egcs-ss-19990428 fail.
+   http://www.cygnus.com/ml/egcs-bugs/1998-Aug/0635.html */
+/* { dg-do compile } */
+/* { dg-options "-Wcast-qual" } */
+void
+good_cast(const void *bar)
+{
+  (char *const *)bar; /* { dg-bogus "cast discards" "discarding `const' warning" } */
+}
+
+void
+bad_cast(const void *bar)
+{
+  (const char **)bar; /* { dg-warning "cast discards" "discarding `const' warning" } */
+}
+
+void
+good_assign(const void *bar)
+{
+  char *const *foo = bar;
+}
+
+void
+bad_assign(const void *bar)
+{
+  const char **foo = bar; /* { dg-warning "initialization discards" "discarding `const' warning" } */
+}
diff --git a/gcc/testsuite/gcc.dg/return-type-1.c b/gcc/testsuite/gcc.dg/return-type-1.c
new file mode 100644 (file)
index 0000000..4b24553
--- /dev/null
@@ -0,0 +1,9 @@
+/* Missing warning for falling off the end of a non-void function.
+   egcs-1.1.2 passes, egcs-ss-19990428 fails.
+   http://egcs.cygnus.com/ml/egcs-bugs/1999-03/msg00220.html */
+/* { dg-do compile } */
+/* { dg-options "-O -Wreturn-type" } */
+int
+foo(void)
+{
+} /* { dg-warning "control reaches end of non-void function" "warning for falling off end of non-void function" } */
diff --git a/gcc/testsuite/gcc.dg/unused-1.c b/gcc/testsuite/gcc.dg/unused-1.c
new file mode 100644 (file)
index 0000000..be94186
--- /dev/null
@@ -0,0 +1,11 @@
+/* Missing `unused parameter' warning.
+   egcs-1.1.2 fails, egcs-ss-19990418 passes.
+   http://www.cygnus.com/ml/egcs-bugs/1998-Sep/0199.html */
+/* { dg-do compile } */
+/* { dg-options "-O -Wall -W" } */
+int
+f(c)
+     char c; /* { dg-warning "unused parameter" "unused parameter warning" } */
+{
+  return 0;
+}
This page took 0.076226 seconds and 5 git commands to generate.