summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2000-08-23 16:13:47 +0000
committerghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2000-08-23 16:13:47 +0000
commit16e82a8e8f2766af39bd891fb2cc0da3b8e0117e (patch)
tree5e8a157ec041c96ec106a6df77176615b5972056 /gcc
parentd039c4a3d58f7b0e6abcd0b343cbf61e8322b05b (diff)
downloadgcc-16e82a8e8f2766af39bd891fb2cc0da3b8e0117e.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35913 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog8
-rw-r--r--gcc/testsuite/gcc.dg/cpp/tr-warn4.c26
-rw-r--r--gcc/testsuite/gcc.dg/cpp/tr-warn5.c14
-rw-r--r--gcc/testsuite/gcc.dg/wtr-aggr-init-1.c38
-rw-r--r--gcc/testsuite/gcc.dg/wtr-escape-1.c22
-rw-r--r--gcc/testsuite/gcc.dg/wtr-int-type-1.c24
-rw-r--r--gcc/testsuite/gcc.dg/wtr-static-1.c14
-rw-r--r--gcc/testsuite/gcc.dg/wtr-strcat-1.c18
-rw-r--r--gcc/testsuite/gcc.dg/wtr-switch-1.c24
-rw-r--r--gcc/testsuite/gcc.dg/wtr-unary-plus-1.c20
-rw-r--r--gcc/testsuite/gcc.dg/wtr-union-init-1.c25
11 files changed, 233 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 45221fb5c7d..3eb6b803d42 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 00000000000..108397761d9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/tr-warn4.c
@@ -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
index 00000000000..ab301b3aa07
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/tr-warn5.c
@@ -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
index 00000000000..259716e5e42
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/wtr-aggr-init-1.c
@@ -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
index 00000000000..a83bdc5117a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/wtr-escape-1.c
@@ -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
index 00000000000..27ab1441001
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/wtr-int-type-1.c
@@ -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
index 00000000000..676b48231e4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/wtr-static-1.c
@@ -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
index 00000000000..06806b13347
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/wtr-strcat-1.c
@@ -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
index 00000000000..c42cdb11031
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/wtr-switch-1.c
@@ -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
index 00000000000..ec3cd19fa19
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/wtr-unary-plus-1.c
@@ -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
index 00000000000..1f00069d510
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/wtr-union-init-1.c
@@ -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 };
+}