summaryrefslogtreecommitdiffstats
path: root/gcc/testsuite/gcc.dg
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg')
-rw-r--r--gcc/testsuite/gcc.dg/cpp/tr-warn2.c2
-rw-r--r--gcc/testsuite/gcc.dg/wtr-aggr-init-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/wtr-conversion-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/wtr-escape-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/wtr-func-def-1.c204
-rw-r--r--gcc/testsuite/gcc.dg/wtr-int-type-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/wtr-label-1.c6
-rw-r--r--gcc/testsuite/gcc.dg/wtr-static-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/wtr-strcat-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/wtr-suffix-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/wtr-switch-1.c3
-rw-r--r--gcc/testsuite/gcc.dg/wtr-unary-plus-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/wtr-union-init-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/wtr-union-init-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/wtr-union-init-3.c2
15 files changed, 225 insertions, 18 deletions
diff --git a/gcc/testsuite/gcc.dg/cpp/tr-warn2.c b/gcc/testsuite/gcc.dg/cpp/tr-warn2.c
index 303b0ff2bb1..413ac5c4e22 100644
--- a/gcc/testsuite/gcc.dg/cpp/tr-warn2.c
+++ b/gcc/testsuite/gcc.dg/cpp/tr-warn2.c
@@ -8,7 +8,7 @@ enum { SIGN_EXTEND = 23 };
#define SIGN_EXTEND(v) (((v) < 0) ? -1 : 0)
-int fun(void)
+int fun()
{
return SIGN_EXTEND; /* { dg-warning "must be used with arguments" } */
}
diff --git a/gcc/testsuite/gcc.dg/wtr-aggr-init-1.c b/gcc/testsuite/gcc.dg/wtr-aggr-init-1.c
index c60a6955003..f17531e8fb9 100644
--- a/gcc/testsuite/gcc.dg/wtr-aggr-init-1.c
+++ b/gcc/testsuite/gcc.dg/wtr-aggr-init-1.c
@@ -14,7 +14,7 @@ struct foo f0 = { 0, 0 };
static struct foo f1 = { 0, 0 };
void
-testfunc1 (void)
+testfunc1 ()
{
struct foo f3 = { 0, 0 }; /* { dg-warning "traditional C rejects automatic" "automatic aggregate initialization" } */
static struct foo f4 = { 0, 0 };
@@ -39,7 +39,7 @@ struct foo f7 = { 0, 0 };
static struct foo f8 = { 0, 0 };
void
-testfunc2 (void)
+testfunc2 ()
{
struct foo f9 = { 0, 0 };
static struct foo f10 = { 0, 0 };
diff --git a/gcc/testsuite/gcc.dg/wtr-conversion-1.c b/gcc/testsuite/gcc.dg/wtr-conversion-1.c
index ecf688fe405..18d26165f2a 100644
--- a/gcc/testsuite/gcc.dg/wtr-conversion-1.c
+++ b/gcc/testsuite/gcc.dg/wtr-conversion-1.c
@@ -15,7 +15,7 @@ extern long double ld;
extern __complex__ double cd;
void
-testfunc1 (void)
+testfunc1 ()
{
foo_i (i);
foo_i (f); /* { dg-warning "as integer rather than floating" "prototype conversion warning" } */
@@ -42,7 +42,7 @@ testfunc1 (void)
/* We are in system headers now, no -Wtraditional warnings should issue. */
void
-testfunc2 (void)
+testfunc2 ()
{
foo_i (i);
foo_i (f);
diff --git a/gcc/testsuite/gcc.dg/wtr-escape-1.c b/gcc/testsuite/gcc.dg/wtr-escape-1.c
index 150b4ce15bf..7f48de5e8c6 100644
--- a/gcc/testsuite/gcc.dg/wtr-escape-1.c
+++ b/gcc/testsuite/gcc.dg/wtr-escape-1.c
@@ -5,7 +5,7 @@
/* { dg-options "-Wtraditional" } */
void
-testfunc (void)
+testfunc ()
{
char c;
diff --git a/gcc/testsuite/gcc.dg/wtr-func-def-1.c b/gcc/testsuite/gcc.dg/wtr-func-def-1.c
new file mode 100644
index 00000000000..c300d22ee3e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/wtr-func-def-1.c
@@ -0,0 +1,204 @@
+/* Test for -Wtraditional warnings on ISO C function definitions.
+ Note, gcc should omit these warnings in system header files.
+ Origin: Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 6/30/2002. */
+/* { dg-do compile } */
+/* { dg-options "-Wtraditional" } */
+
+/* Test some simple cases. */
+
+void f_void1 (void)
+{ /* { dg-warning "traditional C rejects ISO C style" } */
+ return;
+}
+
+void f_void2 ()
+{
+ return;
+}
+
+void f_int1 (int f)
+{ /* { dg-warning "traditional C rejects ISO C style" } */
+ return;
+}
+
+void f_int2 (f)
+ int f;
+{
+ return;
+}
+
+/* Test that we don't ever warn about nested functions. */
+
+void f_int3 (int f)
+{ /* { dg-warning "traditional C rejects ISO C style" } */
+ void f3a (void) { return; }
+ void f3b () { return; }
+ void f3c (int f) { return; }
+ void f3d (f) int f; { return; }
+ void f3e (const char *f, ...) { return; }
+ return;
+}
+
+void f_int4 (int f)
+{ /* { dg-warning "traditional C rejects ISO C style" } */
+ void f4a (void) { return; }
+ void f4b () { return; }
+ void f4c (int f) { return; }
+ void f4d (f) int f; { return; }
+ void f4e (const char *f, ...) { return; }
+ auto f4f (void) { return 0; }
+ return;
+}
+
+void f_int5 (f)
+ int f;
+{
+ void f5a (void) { return; }
+ void f5b () { return; }
+ void f5c (int f) { return; }
+ void f5d (f) int f; { return; }
+ void f5e (const char *f, ...) { return; }
+ return;
+}
+
+void f_int6 (f)
+ int f;
+{
+ void f6a (void) { return; }
+ void f6b () { return; }
+ void f6c (int f) { return; }
+ void f6d (f) int f; { return; }
+ void f6e (const char *f, ...) { return; }
+ auto f6f (void) { return 0; }
+ return;
+}
+
+/* Test that prototypes are silently accepted and function definitions
+ are still warned about. */
+
+extern void f_int_p1 (int);
+void f_int_p1 (int f)
+{ /* { dg-warning "traditional C rejects ISO C style" } */
+ return;
+}
+
+extern void f_int_p2 (int f);
+void f_int_p2 (int f)
+{ /* { dg-warning "traditional C rejects ISO C style" } */
+ return;
+}
+
+extern void f_int_p3 (int);
+void f_int_p3 (f)
+ int f;
+{
+ return;
+}
+
+extern void f_int_p4 (int f);
+void f_int_p4 (f)
+ int f;
+{
+ return;
+}
+
+extern void f_void_p1 ();
+void f_void_p1 (void)
+{ /* { dg-warning "traditional C rejects ISO C style" } */
+ return;
+}
+
+extern void f_void_p2 (void);
+void f_void_p2 (void)
+{ /* { dg-warning "traditional C rejects ISO C style" } */
+ return;
+}
+
+extern void f_blank_p1 ();
+void f_blank_p1 ()
+{
+ return;
+}
+
+extern void f_blank_p2 (void);
+void f_blank_p2 ()
+{
+ return;
+}
+
+/* Test some implicit int functions. */
+
+f_impl1()
+{
+ return 0;
+}
+
+f_impl2(void)
+{ /* { dg-warning "traditional C rejects ISO C style" } */
+ return 0;
+}
+
+f_impl3(int f)
+{ /* { dg-warning "traditional C rejects ISO C style" } */
+ return 0;
+}
+
+/* Test that we don't warn about stdarg functions. */
+
+f_stdarg1(const char *s, ...)
+{
+ return 0;
+}
+
+void f_stdarg2(const char *s, ...)
+{
+ return;
+}
+
+extern void f_stdarg3(const char *, ...);
+void f_stdarg3(const char *s, ...)
+{
+ return;
+}
+
+/* Test handling function pointer parameters. */
+
+void f_fnptr1 (int f, int (*fp)(int));
+void f_fnptr1 (int f, int (*fp)(int))
+{ /* { dg-warning "traditional C rejects ISO C style" } */
+ return;
+}
+
+void f_fnptr2 (int f, int (*fp)(int));
+void f_fnptr2 (f, fp)
+ int f;
+ int (*fp)(int);
+{
+ return;
+}
+
+/* Test for main. */
+
+int
+main (int argc, char **argv)
+{ /* { dg-warning "traditional C rejects ISO C style" } */
+ return 0;
+}
+
+# 182 "sys-header.h" 3
+/* We are in system headers now, no -Wtraditional warnings should issue. */
+
+void fsys1 (void)
+{
+ return;
+}
+
+void fsys2 (int f)
+{
+ return;
+}
+
+void fsys3 (const char *f, ...)
+{
+ return;
+}
diff --git a/gcc/testsuite/gcc.dg/wtr-int-type-1.c b/gcc/testsuite/gcc.dg/wtr-int-type-1.c
index bb3a7de3cab..d44165d90b9 100644
--- a/gcc/testsuite/gcc.dg/wtr-int-type-1.c
+++ b/gcc/testsuite/gcc.dg/wtr-int-type-1.c
@@ -5,7 +5,7 @@
/* { dg-options "-std=c99 -Wtraditional" } */
void
-testfunc (void)
+testfunc ()
{
long long i;
diff --git a/gcc/testsuite/gcc.dg/wtr-label-1.c b/gcc/testsuite/gcc.dg/wtr-label-1.c
index 38ccd16ad87..78a4d6b0a4b 100644
--- a/gcc/testsuite/gcc.dg/wtr-label-1.c
+++ b/gcc/testsuite/gcc.dg/wtr-label-1.c
@@ -11,7 +11,8 @@ int foo4;
typedef int foo5;
void
-testfunc1 (int foo6)
+testfunc1 (foo6)
+ int foo6;
{
int foo7;
@@ -32,7 +33,8 @@ testfunc1 (int foo6)
/* We are in system headers now, no -Wtraditional warnings should issue. */
void
-testfunc2 (int foo6)
+testfunc2 (foo6)
+ int foo6;
{
int foo7;
diff --git a/gcc/testsuite/gcc.dg/wtr-static-1.c b/gcc/testsuite/gcc.dg/wtr-static-1.c
index f00cd8a7b5f..310c1eab925 100644
--- a/gcc/testsuite/gcc.dg/wtr-static-1.c
+++ b/gcc/testsuite/gcc.dg/wtr-static-1.c
@@ -5,10 +5,10 @@
/* { dg-options "-Wtraditional" } */
static void testfunc1(void);
-void testfunc1(void) {} /* { dg-warning "non-static.*follows static" "non-static follows static" } */
+void testfunc1() {} /* { dg-warning "non-static.*follows static" "non-static follows static" } */
# 11 "sys-header.h" 3
/* We are in system headers now, no -Wtraditional warnings should issue. */
static void testfunc2(void);
-void testfunc2(void) {}
+void testfunc2() {}
diff --git a/gcc/testsuite/gcc.dg/wtr-strcat-1.c b/gcc/testsuite/gcc.dg/wtr-strcat-1.c
index ca85a5c4077..b3966529ad7 100644
--- a/gcc/testsuite/gcc.dg/wtr-strcat-1.c
+++ b/gcc/testsuite/gcc.dg/wtr-strcat-1.c
@@ -5,7 +5,7 @@
/* { dg-options "-Wtraditional" } */
void
-testfunc (void)
+testfunc ()
{
const char *foo;
diff --git a/gcc/testsuite/gcc.dg/wtr-suffix-1.c b/gcc/testsuite/gcc.dg/wtr-suffix-1.c
index f6b6300ac1f..ed0b40ecf30 100644
--- a/gcc/testsuite/gcc.dg/wtr-suffix-1.c
+++ b/gcc/testsuite/gcc.dg/wtr-suffix-1.c
@@ -5,7 +5,7 @@
/* { dg-options "-Wtraditional" } */
void
-testfunc (void)
+testfunc ()
{
int i;
double f;
diff --git a/gcc/testsuite/gcc.dg/wtr-switch-1.c b/gcc/testsuite/gcc.dg/wtr-switch-1.c
index e1c0d30df9a..f0381bc5e37 100644
--- a/gcc/testsuite/gcc.dg/wtr-switch-1.c
+++ b/gcc/testsuite/gcc.dg/wtr-switch-1.c
@@ -5,7 +5,8 @@
/* { dg-options "-Wtraditional" } */
void
-testfunc (long l)
+testfunc (l)
+ long l;
{
switch (l) /* { dg-warning "switch expression" "switch expression" } */
{
diff --git a/gcc/testsuite/gcc.dg/wtr-unary-plus-1.c b/gcc/testsuite/gcc.dg/wtr-unary-plus-1.c
index b6b053c033d..aee892c532e 100644
--- a/gcc/testsuite/gcc.dg/wtr-unary-plus-1.c
+++ b/gcc/testsuite/gcc.dg/wtr-unary-plus-1.c
@@ -5,7 +5,7 @@
/* { dg-options "-Wtraditional" } */
void
-testfunc (void)
+testfunc ()
{
int i;
diff --git a/gcc/testsuite/gcc.dg/wtr-union-init-1.c b/gcc/testsuite/gcc.dg/wtr-union-init-1.c
index 312bfa92600..18869813d28 100644
--- a/gcc/testsuite/gcc.dg/wtr-union-init-1.c
+++ b/gcc/testsuite/gcc.dg/wtr-union-init-1.c
@@ -11,7 +11,7 @@ union foo
};
void
-testfunc (void)
+testfunc ()
{
/* Note we only warn for non-zero initializers. */
static union foo f1 = { 0 };
diff --git a/gcc/testsuite/gcc.dg/wtr-union-init-2.c b/gcc/testsuite/gcc.dg/wtr-union-init-2.c
index 6366ff326d8..3112ba27762 100644
--- a/gcc/testsuite/gcc.dg/wtr-union-init-2.c
+++ b/gcc/testsuite/gcc.dg/wtr-union-init-2.c
@@ -19,7 +19,7 @@ union foo2
};
void
-testfunc (void)
+testfunc ()
{
/* Note we only warn for non-zero initializers. */
static union foo1 f1 = {0};
diff --git a/gcc/testsuite/gcc.dg/wtr-union-init-3.c b/gcc/testsuite/gcc.dg/wtr-union-init-3.c
index c5d8e73a377..bb8e300289d 100644
--- a/gcc/testsuite/gcc.dg/wtr-union-init-3.c
+++ b/gcc/testsuite/gcc.dg/wtr-union-init-3.c
@@ -38,7 +38,7 @@ struct baz2
};
void
-testfunc (void)
+testfunc ()
{
/* Note we only warn for non-zero initializers. Xfail on substructures. */
static union foo f1 = {{0,0}}; /* { dg-bogus "traditional C rejects initialization of unions" "initialization of unions" { xfail *-*-* } } */
OpenPOWER on IntegriCloud