summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2012-02-03 20:19:33 (GMT)
committerDavid Malcolm <dmalcolm@redhat.com>2012-02-03 20:19:33 (GMT)
commit6ef592d9e473eea205b1fad866bebcac40943006 (patch)
treec1e6b743978bddd86e0c891157e119bc02fb8d3d
parent491158fbed92f707e48eca996e5b88825ddf1ab7 (diff)
downloadgcc-python-plugin-6ef592d9e473eea205b1fad866bebcac40943006.zip
gcc-python-plugin-6ef592d9e473eea205b1fad866bebcac40943006.tar.gz
gcc-python-plugin-6ef592d9e473eea205b1fad866bebcac40943006.tar.xz
fix bugs in test code visible with -Wformat
Fix buggy usage of printf format strings in various test cases, which show up when compiling with -Wformat. Reported by Emílio Wuerges: https://fedorahosted.org/pipermail/gcc-python-plugin/2012-February/000171.html
-rw-r--r--tests/plugin/gc/_gc_selftest/input.c6
-rw-r--r--tests/plugin/gimple-walk-tree/dump-all/input.c6
-rw-r--r--tests/plugin/gimple-walk-tree/dump-all/stdout.txt3
-rw-r--r--tests/plugin/gimple-walk-tree/exceptions/input.c6
-rw-r--r--tests/plugin/gimple-walk-tree/find-one/input.c6
-rw-r--r--tests/plugin/gimple-walk-tree/find-one/stdout.txt2
6 files changed, 15 insertions, 14 deletions
diff --git a/tests/plugin/gc/_gc_selftest/input.c b/tests/plugin/gc/_gc_selftest/input.c
index 769d1a6..7bfa8a7 100644
--- a/tests/plugin/gc/_gc_selftest/input.c
+++ b/tests/plugin/gc/_gc_selftest/input.c
@@ -1,6 +1,6 @@
/*
- Copyright 2011 David Malcolm <dmalcolm@redhat.com>
- Copyright 2011 Red Hat, Inc.
+ Copyright 2011, 2012 David Malcolm <dmalcolm@redhat.com>
+ Copyright 2011, 2012 Red Hat, Inc.
This is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
@@ -38,7 +38,7 @@ main(int argc, char **argv)
printf("argc: %i\n", argc);
for (i = 0; i < argc; i++) {
- printf("argv[%i]: %s\n", argv[i]);
+ printf("argv[%i]: %s\n", i, argv[i]);
}
helper_function();
diff --git a/tests/plugin/gimple-walk-tree/dump-all/input.c b/tests/plugin/gimple-walk-tree/dump-all/input.c
index ca4b30f..44dfc9c 100644
--- a/tests/plugin/gimple-walk-tree/dump-all/input.c
+++ b/tests/plugin/gimple-walk-tree/dump-all/input.c
@@ -1,6 +1,6 @@
/*
- Copyright 2011 David Malcolm <dmalcolm@redhat.com>
- Copyright 2011 Red Hat, Inc.
+ Copyright 2011, 2012 David Malcolm <dmalcolm@redhat.com>
+ Copyright 2011, 2012 Red Hat, Inc.
This is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
@@ -38,7 +38,7 @@ main(int argc, char **argv)
printf("argc: %i\n", argc);
for (i = 0; i < argc; i++) {
- printf("argv[%i]: %s\n", argv[i]);
+ printf("argv[%i]: %s\n", i, argv[i]);
}
helper_function();
diff --git a/tests/plugin/gimple-walk-tree/dump-all/stdout.txt b/tests/plugin/gimple-walk-tree/dump-all/stdout.txt
index 0547587..1062b24 100644
--- a/tests/plugin/gimple-walk-tree/dump-all/stdout.txt
+++ b/tests/plugin/gimple-walk-tree/dump-all/stdout.txt
@@ -35,10 +35,11 @@ fun: gcc.Function('main')
node: gcc.StringCst('argv[%i]: %s\n') ("argv[%i]: %s\n")
node: gcc.IntegerCst(0) (0)
node: gcc.VarDecl(nnnn) (D.nnnnn)
- stmt: printf (D.nnnnn, D.nnnnn);
+ stmt: printf (D.nnnnn, i, D.nnnnn);
node: <gcc.AddrExpr object at 0xdeadbeef> (printf)
node: gcc.FunctionDecl('printf') (printf)
node: gcc.VarDecl(nnnn) (D.nnnnn)
+ node: gcc.VarDecl('i') (i)
node: gcc.VarDecl(nnnn) (D.nnnnn)
stmt: i = i + 1;
node: gcc.VarDecl('i') (i)
diff --git a/tests/plugin/gimple-walk-tree/exceptions/input.c b/tests/plugin/gimple-walk-tree/exceptions/input.c
index ca4b30f..44dfc9c 100644
--- a/tests/plugin/gimple-walk-tree/exceptions/input.c
+++ b/tests/plugin/gimple-walk-tree/exceptions/input.c
@@ -1,6 +1,6 @@
/*
- Copyright 2011 David Malcolm <dmalcolm@redhat.com>
- Copyright 2011 Red Hat, Inc.
+ Copyright 2011, 2012 David Malcolm <dmalcolm@redhat.com>
+ Copyright 2011, 2012 Red Hat, Inc.
This is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
@@ -38,7 +38,7 @@ main(int argc, char **argv)
printf("argc: %i\n", argc);
for (i = 0; i < argc; i++) {
- printf("argv[%i]: %s\n", argv[i]);
+ printf("argv[%i]: %s\n", i, argv[i]);
}
helper_function();
diff --git a/tests/plugin/gimple-walk-tree/find-one/input.c b/tests/plugin/gimple-walk-tree/find-one/input.c
index ca4b30f..44dfc9c 100644
--- a/tests/plugin/gimple-walk-tree/find-one/input.c
+++ b/tests/plugin/gimple-walk-tree/find-one/input.c
@@ -1,6 +1,6 @@
/*
- Copyright 2011 David Malcolm <dmalcolm@redhat.com>
- Copyright 2011 Red Hat, Inc.
+ Copyright 2011, 2012 David Malcolm <dmalcolm@redhat.com>
+ Copyright 2011, 2012 Red Hat, Inc.
This is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
@@ -38,7 +38,7 @@ main(int argc, char **argv)
printf("argc: %i\n", argc);
for (i = 0; i < argc; i++) {
- printf("argv[%i]: %s\n", argv[i]);
+ printf("argv[%i]: %s\n", i, argv[i]);
}
helper_function();
diff --git a/tests/plugin/gimple-walk-tree/find-one/stdout.txt b/tests/plugin/gimple-walk-tree/find-one/stdout.txt
index 0aed2ae..7a9c43c 100644
--- a/tests/plugin/gimple-walk-tree/find-one/stdout.txt
+++ b/tests/plugin/gimple-walk-tree/find-one/stdout.txt
@@ -9,7 +9,7 @@ fun: gcc.Function('main')
stmt: D.nnnnn = *D.nnnnn;
stmt: D.nnnnn = (const char * restrict) &"argv[%i]: %s\n"[0];
node: gcc.StringCst('argv[%i]: %s\n') ("argv[%i]: %s\n")
- stmt: printf (D.nnnnn, D.nnnnn);
+ stmt: printf (D.nnnnn, i, D.nnnnn);
stmt: i = i + 1;
stmt: if (i < argc)
stmt: helper_function ();