aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/c-c++-common/Wvarargs-2.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/c-c++-common/Wvarargs-2.c')
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/Wvarargs-2.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/Wvarargs-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/Wvarargs-2.c
new file mode 100644
index 000000000..a2e031f91
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/Wvarargs-2.c
@@ -0,0 +1,33 @@
+/*
+ { dg-options "-Wno-varargs" }
+ { dg-do compile }
+ */
+
+#include <stdarg.h>
+
+void
+err (int a)
+{
+ va_list vp;
+ va_start (vp, a); // { dg-error "used in function with fixed args" }
+}
+
+void
+foo0 (int a, int b, ...)
+{
+ va_list vp;
+ /* 'a' is not the last argument of the enclosing function, but
+ don't warn because we are ignoring -Wvarargs. */
+ va_start (vp, a);
+ va_end (vp);
+}
+
+void
+foo1 (int a, register int b, ...)
+{
+ va_list vp;
+ /* 'b' is declared with register storage, but don't warn
+ because we are ignoring -Wvarargs. */
+ va_start (vp, b);
+ va_end (vp);
+}