tr-warn4.c, [...]: New tests.
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>
Wed, 23 Aug 2000 16:13:47 +0000 (16:13 +0000)
committerKaveh Ghazi <ghazi@gcc.gnu.org>
Wed, 23 Aug 2000 16:13:47 +0000 (16:13 +0000)
* gcc.dg/cpp/tr-warn4.c, gcc.dg/cpp/tr-warn5.c,
gcc.dg/wtr-aggr-init-1.c, gcc.dg/wtr-escape-1.c,
gcc.dg/wtr-int-type-1.c, gcc.dg/wtr-static-1.c,
gcc.dg/wtr-strcat-1.c, gcc.dg/wtr-switch-1.c,
gcc.dg/wtr-unary-plus-1.c, gcc.dg/wtr-union-init-1.c: New tests.

From-SVN: r35913

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/cpp/tr-warn4.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/cpp/tr-warn5.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/wtr-aggr-init-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/wtr-escape-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/wtr-int-type-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/wtr-static-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/wtr-strcat-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/wtr-switch-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/wtr-unary-plus-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/wtr-union-init-1.c [new file with mode: 0644]

index 45221fb5c7de15093646c109069f4214b39b3333..3eb6b803d42f75a72bdeb8e6e5f38c7f62e69cd1 100644 (file)
@@ -1,3 +1,11 @@
+2000-08-23  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * gcc.dg/cpp/tr-warn4.c, gcc.dg/cpp/tr-warn5.c,
+       gcc.dg/wtr-aggr-init-1.c, gcc.dg/wtr-escape-1.c,
+       gcc.dg/wtr-int-type-1.c, gcc.dg/wtr-static-1.c,
+       gcc.dg/wtr-strcat-1.c, gcc.dg/wtr-switch-1.c,
+       gcc.dg/wtr-unary-plus-1.c, gcc.dg/wtr-union-init-1.c: New tests.
+
 2000-08-22  Joseph S. Myers  <jsm28@cam.ac.uk>
 
        * gcc.dg/c90-strftime-2.c, gcc.dg/c99-strftime-1.c,
diff --git a/gcc/testsuite/gcc.dg/cpp/tr-warn4.c b/gcc/testsuite/gcc.dg/cpp/tr-warn4.c
new file mode 100644 (file)
index 0000000..1083977
--- /dev/null
@@ -0,0 +1,26 @@
+/* Test for -Wtraditional warnings on integer constant suffixes.
+   Note, gcc should omit these warnings in system header files.
+   By Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 8/22/2000.  */
+/* { dg-do preprocess } */
+/* { dg-options "-Wtraditional -fno-show-column" } */
+
+#if 1U /* { dg-warning "traditional C rejects.*suffix" "numeric constant suffix" } */
+#endif
+#if 1u /* { dg-warning "traditional C rejects.*suffix" "numeric constant suffix" } */
+#endif
+#if 1L
+#endif
+#if 1l
+#endif
+  
+#line 17 "sys-header.h" 3
+/* We are in system headers now, no -Wtraditional warnings should issue.  */
+
+#if 1U
+#endif
+#if 1u
+#endif
+#if 1L
+#endif
+#if 1l
+#endif
diff --git a/gcc/testsuite/gcc.dg/cpp/tr-warn5.c b/gcc/testsuite/gcc.dg/cpp/tr-warn5.c
new file mode 100644 (file)
index 0000000..ab301b3
--- /dev/null
@@ -0,0 +1,14 @@
+/* Test for -Wtraditional warnings on the unary plus operator.
+   Note, gcc should omit these warnings in system header files.
+   By Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 8/22/2000.  */
+/* { dg-do preprocess } */
+/* { dg-options "-Wtraditional -fno-show-column" } */
+
+#if +1 /* { dg-warning "unary plus operator" "unary plus operator" } */
+#endif
+  
+#line 11 "sys-header.h" 3
+/* We are in system headers now, no -Wtraditional warnings should issue.  */
+
+#if +1
+#endif
diff --git a/gcc/testsuite/gcc.dg/wtr-aggr-init-1.c b/gcc/testsuite/gcc.dg/wtr-aggr-init-1.c
new file mode 100644 (file)
index 0000000..259716e
--- /dev/null
@@ -0,0 +1,38 @@
+/* Test for -Wtraditional warnings on automatic aggregate initialization.
+   Note, gcc should omit these warnings in system header files.
+   By Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 8/22/2000.  */
+/* { dg-do compile } */
+/* { dg-options "-Wtraditional" } */
+
+struct foo
+{
+  int i;
+  long l;
+};
+
+struct foo f0 = { 0, 0 };
+static struct foo f1 = { 0, 0 };
+
+void
+testfunc1 (void)
+{
+  struct foo f3 = { 0, 0 }; /* { dg-warning "traditional C rejects automatic" "automatic aggregate initialization" } */
+  static struct foo f4 = { 0, 0 };
+  
+  f3 = f4;
+}
+  
+#line 26 "sys-header.h" 3
+/* We are in system headers now, no -Wtraditional warnings should issue.  */
+
+struct foo f5 = { 0, 0 };
+static struct foo f6 = { 0, 0 };
+
+void
+testfunc2 (void)
+{
+  struct foo f7 = { 0, 0 };
+  static struct foo f8 = { 0, 0 };
+  
+  f7 = f8;
+}
diff --git a/gcc/testsuite/gcc.dg/wtr-escape-1.c b/gcc/testsuite/gcc.dg/wtr-escape-1.c
new file mode 100644 (file)
index 0000000..a83bdc5
--- /dev/null
@@ -0,0 +1,22 @@
+/* Test for -Wtraditional warnings on escape characters.
+   Note, gcc should omit these warnings in system header files.
+   By Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 8/22/2000.  */
+/* { dg-do compile } */
+/* { dg-options "-Wtraditional" } */
+
+void
+testfunc (void)
+{
+  char c;
+
+  c = '\a'; /* { dg-warning "the meaning of" "escaped character warning " } */
+  c = '\x2'; /* { dg-warning "the meaning of" "escaped character warning " } */
+  c = '\n';
+
+#line 17 "sys-header.h" 3
+/* We are in system headers now, no -Wtraditional warnings should issue.  */
+
+  c = '\a';
+  c = '\x2';
+  c = '\n';
+}
diff --git a/gcc/testsuite/gcc.dg/wtr-int-type-1.c b/gcc/testsuite/gcc.dg/wtr-int-type-1.c
new file mode 100644 (file)
index 0000000..27ab144
--- /dev/null
@@ -0,0 +1,24 @@
+/* Test for -Wtraditional warnings on integer constant types.
+   Note, gcc should omit these warnings in system header files.
+   By Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 8/22/2000.  */
+/* { dg-do compile } */
+/* { dg-options "-Wtraditional" } */
+
+void
+testfunc (void)
+{
+  long long i;
+  
+  i = 0x80000000;
+  i = 0x8000000000000000;
+  i = 9223372036854775807; /* { dg-warning "integer constant.*with -traditional" "integer constant" } */
+  i = 4294967295; /* { dg-warning "decimal constant|integer constant.*with -traditional" "integer constant" } */
+  
+#line 18 "sys-header.h" 3
+/* We are in system headers now, no -Wtraditional warnings should issue.  */
+
+  i = 0x80000000;
+  i = 0x8000000000000000;
+  i = 9223372036854775807;
+  i = 4294967295; /* { dg-warning "decimal constant" "decimal constant" } */
+}
diff --git a/gcc/testsuite/gcc.dg/wtr-static-1.c b/gcc/testsuite/gcc.dg/wtr-static-1.c
new file mode 100644 (file)
index 0000000..676b482
--- /dev/null
@@ -0,0 +1,14 @@
+/* Test for -Wtraditional warnings on static/non-static mismatches.
+   Note, gcc should omit these warnings in system header files.
+   By Kaveh R. Ghazi <ghazi@caip.rutgers.edu>  8/22/2000.  */
+/* { dg-do compile } */
+/* { dg-options "-Wtraditional" } */
+
+static void testfunc1(void);
+void testfunc1(void) {} /* { dg-warning "non-static.*follows static" "non-static follows static" } */
+
+#line 11 "sys-header.h" 3
+/* We are in system headers now, no -Wtraditional warnings should issue.  */
+
+static void testfunc2(void);
+void testfunc2(void) {}
diff --git a/gcc/testsuite/gcc.dg/wtr-strcat-1.c b/gcc/testsuite/gcc.dg/wtr-strcat-1.c
new file mode 100644 (file)
index 0000000..06806b1
--- /dev/null
@@ -0,0 +1,18 @@
+/* Test for -Wtraditional warnings on string concatenation.
+   Note, gcc should omit these warnings in system header files.
+   By Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 8/22/2000.  */
+/* { dg-do compile } */
+/* { dg-options "-Wtraditional" } */
+
+void
+testfunc (void)
+{
+  const char *foo;
+  
+  foo = "hello" "hello"; /* { dg-warning "string concatenation" "string concatenation" } */
+
+#line 15 "sys-header.h" 3
+/* We are in system headers now, no -Wtraditional warnings should issue.  */
+
+  foo = "hello" "hello";
+}
diff --git a/gcc/testsuite/gcc.dg/wtr-switch-1.c b/gcc/testsuite/gcc.dg/wtr-switch-1.c
new file mode 100644 (file)
index 0000000..c42cdb1
--- /dev/null
@@ -0,0 +1,24 @@
+/* Test for -Wtraditional warnings on switch operands of type long.
+   Note, gcc should omit these warnings in system header files.
+   By Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 8/22/2000.  */
+/* { dg-do compile } */
+/* { dg-options "-Wtraditional" } */
+
+void
+testfunc (long l)
+{
+  switch (l) /* { dg-warning "switch expression" "switch expression" } */
+  {
+  default:
+    break;
+  }
+
+#line 17 "sys-header.h" 3
+/* We are in system headers now, no -Wtraditional warnings should issue.  */
+
+  switch (l)
+  {
+  default:
+    break;
+  }
+}
diff --git a/gcc/testsuite/gcc.dg/wtr-unary-plus-1.c b/gcc/testsuite/gcc.dg/wtr-unary-plus-1.c
new file mode 100644 (file)
index 0000000..ec3cd19
--- /dev/null
@@ -0,0 +1,20 @@
+/* Test for -Wtraditional warnings on the unary plus operator.
+   Note, gcc should omit these warnings in system header files.
+   By Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 8/22/2000.  */
+/* { dg-do compile } */
+/* { dg-options "-Wtraditional" } */
+
+void
+testfunc (void)
+{
+  int i;
+  
+  i = +1; /* { dg-warning "unary plus operator" "unary plus operator" } */
+  i = +i; /* { dg-warning "unary plus operator" "unary plus operator" } */
+  
+#line 16 "sys-header.h" 3
+/* We are in system headers now, no -Wtraditional warnings should issue.  */
+
+  i = +1;
+  i = +i;
+}
diff --git a/gcc/testsuite/gcc.dg/wtr-union-init-1.c b/gcc/testsuite/gcc.dg/wtr-union-init-1.c
new file mode 100644 (file)
index 0000000..1f00069
--- /dev/null
@@ -0,0 +1,25 @@
+/* Test for -Wtraditional warnings on union initialization.
+   Note, gcc should omit these warnings in system header files.
+   By Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 8/22/2000.  */
+/* { dg-do compile } */
+/* { dg-options "-Wtraditional" } */
+
+union foo
+{
+  int i;
+  long l;
+};
+
+void
+testfunc (void)
+{
+  /* Note we only warn for non-zero initializers.  */
+  static union foo f1 = { 0 };
+  static union foo f2 = { 1 }; /* { dg-warning "traditional C rejects initialization of unions" "initialization of unions" } */
+
+#line 21 "sys-header.h" 3
+/* We are in system headers now, no -Wtraditional warnings should issue.  */
+
+  static union foo f3 = { 0 };
+  static union foo f4 = { 1 };
+}