[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Libunwind-devel] [PATCH 07/27] Annotate unused parameters in tests
From: |
Tommi Rantala |
Subject: |
[Libunwind-devel] [PATCH 07/27] Annotate unused parameters in tests |
Date: |
Wed, 22 Aug 2012 14:28:33 +0300 |
Compiling the tests with -Wextra results to lots of warnings for unused
parameters. Annotate these cases with the `unused' attribute to avoid
the warnings.
---
tests/Gtest-bt.c | 6 +++---
tests/Gtest-concurrent.c | 6 +++---
tests/Gtest-dyn1.c | 4 ++--
tests/Gtest-init.cxx | 2 +-
tests/Gtest-resume-sig.c | 2 +-
tests/Gtest-trace.c | 6 +++---
tests/rs-race.c | 4 ++--
tests/test-async-sig.c | 2 +-
tests/test-coredump-unwind.c | 2 +-
tests/test-init-remote.c | 2 +-
tests/test-mem.c | 2 +-
tests/test-proc-info.c | 45 ++++++++++++++++++++++++++++++------------
tests/test-ptrace-misc.c | 2 +-
tests/test-setjmp.c | 2 +-
tests/test-static-link-loc.c | 2 +-
tests/test-strerror.c | 2 +-
16 files changed, 55 insertions(+), 36 deletions(-)
diff --git a/tests/Gtest-bt.c b/tests/Gtest-bt.c
index b5f4439..57ace85 100644
--- a/tests/Gtest-bt.c
+++ b/tests/Gtest-bt.c
@@ -123,7 +123,7 @@ do_backtrace (void)
}
void
-foo (long val)
+foo (long val __attribute__((unused)))
{
do_backtrace ();
}
@@ -160,7 +160,7 @@ bar (long v)
}
void
-sighandler (int signal, void *siginfo, void *context)
+sighandler (int signal, void *siginfo __attribute__((unused)), void *context)
{
ucontext_t *uc = context;
int sp;
@@ -200,7 +200,7 @@ sighandler (int signal, void *siginfo, void *context)
}
int
-main (int argc, char **argv)
+main (int argc, char **argv __attribute__((unused)))
{
struct sigaction act;
stack_t stk;
diff --git a/tests/Gtest-concurrent.c b/tests/Gtest-concurrent.c
index 126aced..b98b6c0 100644
--- a/tests/Gtest-concurrent.c
+++ b/tests/Gtest-concurrent.c
@@ -46,7 +46,7 @@ int got_usr1, got_usr2;
char *sigusr1_sp;
void
-handler (int sig)
+handler (int sig __attribute__((unused)))
{
unw_word_t ip;
unw_context_t uc;
@@ -68,7 +68,7 @@ handler (int sig)
}
void *
-worker (void *arg)
+worker (void *arg __attribute__((unused)))
{
signal (SIGUSR1, handler);
@@ -102,7 +102,7 @@ doit (void)
}
int
-main (int argc, char **argv)
+main (int argc, char **argv __attribute__((unused)))
{
if (argc > 1)
verbose = 1;
diff --git a/tests/Gtest-dyn1.c b/tests/Gtest-dyn1.c
index e084813..b530dd7 100644
--- a/tests/Gtest-dyn1.c
+++ b/tests/Gtest-dyn1.c
@@ -157,13 +157,13 @@ sighandler (int signal)
}
int
-dev_null (const char *format, ...)
+dev_null (const char *format __attribute__((unused)), ...)
{
return 0;
}
int
-main (int argc, char *argv[])
+main (int argc, char *argv[] __attribute__((unused)))
{
unw_dyn_region_info_t *region;
unw_dyn_info_t di;
diff --git a/tests/Gtest-init.cxx b/tests/Gtest-init.cxx
index d83ddbf..18f1463 100644
--- a/tests/Gtest-init.cxx
+++ b/tests/Gtest-init.cxx
@@ -99,7 +99,7 @@ Test_Class::Test_Class (void)
}
int
-main (int argc, char **argv)
+main (int argc, char **argv __attribute__((unused)))
{
verbose = argc > 1;
return atexit (a);
diff --git a/tests/Gtest-resume-sig.c b/tests/Gtest-resume-sig.c
index 68e17eb..4ed42e3 100644
--- a/tests/Gtest-resume-sig.c
+++ b/tests/Gtest-resume-sig.c
@@ -127,7 +127,7 @@ handler (int sig)
}
int
-main (int argc, char **argv)
+main (int argc, char **argv __attribute__((unused)))
{
float d = 1.0;
int n = 0;
diff --git a/tests/Gtest-trace.c b/tests/Gtest-trace.c
index 7488ee6..5145e65 100644
--- a/tests/Gtest-trace.c
+++ b/tests/Gtest-trace.c
@@ -137,7 +137,7 @@ do_backtrace (void)
}
void
-foo (long val)
+foo (long val __attribute__((unused)))
{
do_backtrace ();
}
@@ -174,7 +174,7 @@ bar (long v)
}
void
-sighandler (int signal, void *siginfo, void *context)
+sighandler (int signal, void *siginfo __attribute__((unused)), void *context)
{
ucontext_t *uc = context;
int sp;
@@ -216,7 +216,7 @@ sighandler (int signal, void *siginfo, void *context)
}
int
-main (int argc, char **argv)
+main (int argc, char **argv __attribute__((unused)))
{
struct sigaction act;
stack_t stk;
diff --git a/tests/rs-race.c b/tests/rs-race.c
index c67584c..cf34b97 100644
--- a/tests/rs-race.c
+++ b/tests/rs-race.c
@@ -1331,7 +1331,7 @@ foo_128 (void)
}
void *
-bar(void *p)
+bar(void *p __attribute__((unused)))
{
int i;
for (i = 0; i < ITERS; ++i) {
@@ -1485,7 +1485,7 @@ int doit ()
}
int
-main (int argc, char **argv)
+main (int argc, char **argv __attribute__((unused)))
{
if (argc > 1)
verbose = 1;
diff --git a/tests/test-async-sig.c b/tests/test-async-sig.c
index 5e90690..296d58d 100644
--- a/tests/test-async-sig.c
+++ b/tests/test-async-sig.c
@@ -158,7 +158,7 @@ sighandler (int signal)
}
int
-main (int argc, char **argv)
+main (int argc, char **argv __attribute__((unused)))
{
struct sigaction act;
long i = 0;
diff --git a/tests/test-coredump-unwind.c b/tests/test-coredump-unwind.c
index 6e62b8d..841c5e1 100644
--- a/tests/test-coredump-unwind.c
+++ b/tests/test-coredump-unwind.c
@@ -261,7 +261,7 @@ static void install_sigsegv_handler(void)
}
int
-main(int argc, char **argv)
+main(int argc __attribute__((unused)), char **argv)
{
unw_addr_space_t as;
struct UCD_info *ui;
diff --git a/tests/test-init-remote.c b/tests/test-init-remote.c
index ac036d1..47d9548 100644
--- a/tests/test-init-remote.c
+++ b/tests/test-init-remote.c
@@ -91,7 +91,7 @@ foo (void)
}
int
-main (int argc, char **argv)
+main (int argc, char **argv __attribute__((unused)))
{
verbose = (argc > 1);
diff --git a/tests/test-mem.c b/tests/test-mem.c
index 4f7e58c..2a24359 100644
--- a/tests/test-mem.c
+++ b/tests/test-mem.c
@@ -82,7 +82,7 @@ consume_some_stack_space (void)
}
int
-main (int argc, char **argv)
+main (int argc, char **argv __attribute__((unused)))
{
struct rlimit rlim;
diff --git a/tests/test-proc-info.c b/tests/test-proc-info.c
index e8915fb..3c8fdea 100644
--- a/tests/test-proc-info.c
+++ b/tests/test-proc-info.c
@@ -43,15 +43,20 @@ int errors;
{ ++errors; fprintf (stderr, args); return -1; }
static int
-find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pip,
- int need_unwind_info, void *arg)
+find_proc_info (unw_addr_space_t as __attribute__((unused)),
+ unw_word_t ip __attribute__((unused)),
+ unw_proc_info_t *pip __attribute__((unused)),
+ int need_unwind_info __attribute__((unused)),
+ void *arg __attribute__((unused)))
{
return -UNW_ESTOPUNWIND;
}
static int
-access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *valp,
- int write, void *arg)
+access_mem (unw_addr_space_t as __attribute__((unused)),
+ unw_word_t addr __attribute__((unused)),
+ unw_word_t *valp, int write,
+ void *arg __attribute__((unused)))
{
if (!write)
*valp = 0;
@@ -59,8 +64,10 @@ access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t
*valp,
}
static int
-access_reg (unw_addr_space_t as, unw_regnum_t regnum, unw_word_t *valp,
- int write, void *arg)
+access_reg (unw_addr_space_t as __attribute__((unused)),
+ unw_regnum_t regnum __attribute__((unused)),
+ unw_word_t *valp, int write,
+ void *arg __attribute__((unused)))
{
if (!write)
*valp = 32;
@@ -68,8 +75,10 @@ access_reg (unw_addr_space_t as, unw_regnum_t regnum,
unw_word_t *valp,
}
static int
-access_fpreg (unw_addr_space_t as, unw_regnum_t regnum, unw_fpreg_t *valp,
- int write, void *arg)
+access_fpreg (unw_addr_space_t as __attribute__((unused)),
+ unw_regnum_t regnum __attribute__((unused)),
+ unw_fpreg_t *valp, int write,
+ void *arg __attribute__((unused)))
{
if (!write)
memset (valp, 0, sizeof (*valp));
@@ -77,27 +86,37 @@ access_fpreg (unw_addr_space_t as, unw_regnum_t regnum,
unw_fpreg_t *valp,
}
static int
-get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dilap, void *arg)
+get_dyn_info_list_addr (unw_addr_space_t as __attribute__((unused)),
+ unw_word_t *dilap __attribute__((unused)),
+ void *arg __attribute__((unused)))
{
return -UNW_ENOINFO;
}
static void
-put_unwind_info (unw_addr_space_t as, unw_proc_info_t *pi, void *arg)
+put_unwind_info (unw_addr_space_t as __attribute__((unused)),
+ unw_proc_info_t *pi __attribute__((unused)),
+ void *arg __attribute__((unused)))
{
++errors;
fprintf (stderr, "%s() got called!\n", __FUNCTION__);
}
static int
-resume (unw_addr_space_t as, unw_cursor_t *reg, void *arg)
+resume (unw_addr_space_t as __attribute__((unused)),
+ unw_cursor_t *reg __attribute__((unused)),
+ void *arg __attribute__((unused)))
{
panic ("%s() got called!\n", __FUNCTION__);
}
static int
-get_proc_name (unw_addr_space_t as, unw_word_t ip, char *buf, size_t buf_len,
- unw_word_t *offp, void *arg)
+get_proc_name (unw_addr_space_t as __attribute__((unused)),
+ unw_word_t ip __attribute__((unused)),
+ char *buf __attribute__((unused)),
+ size_t buf_len __attribute__((unused)),
+ unw_word_t *offp __attribute__((unused)),
+ void *arg __attribute__((unused)))
{
panic ("%s() got called!\n", __FUNCTION__);
}
diff --git a/tests/test-ptrace-misc.c b/tests/test-ptrace-misc.c
index 562636a..fbbec9c 100644
--- a/tests/test-ptrace-misc.c
+++ b/tests/test-ptrace-misc.c
@@ -104,7 +104,7 @@ bar (int v)
}
int
-main (int argc, char **argv)
+main (int argc, char **argv __attribute__((unused)))
{
int val = argc;
diff --git a/tests/test-setjmp.c b/tests/test-setjmp.c
index 65c343b..3054574 100644
--- a/tests/test-setjmp.c
+++ b/tests/test-setjmp.c
@@ -139,7 +139,7 @@ sighandler (int signal)
}
int
-main (int argc, char **argv)
+main (int argc, char **argv __attribute__((unused)))
{
volatile sigset_t sigset1, sigset2, sigset3;
volatile struct sigaction act;
diff --git a/tests/test-static-link-loc.c b/tests/test-static-link-loc.c
index d4a8a68..ed94f55 100644
--- a/tests/test-static-link-loc.c
+++ b/tests/test-static-link-loc.c
@@ -87,7 +87,7 @@ test_local (void)
#endif /* !UNW_REMOTE_ONLY */
int
-main (int argc, char **argv)
+main (int argc, char **argv __attribute__((unused)))
{
if (argc > 1)
verbose = 1;
diff --git a/tests/test-strerror.c b/tests/test-strerror.c
index 582d322..4470952 100644
--- a/tests/test-strerror.c
+++ b/tests/test-strerror.c
@@ -2,7 +2,7 @@
#include <stdio.h>
int
-main (int argc, char **argv)
+main (int argc, char **argv __attribute__((unused)))
{
int i, verbose = argc > 1;
const char *msg;
--
1.7.9.5
- [Libunwind-devel] [PATCH 21/27] ARM: fix with-signal-frame local unw_resume(), (continued)
- [Libunwind-devel] [PATCH 21/27] ARM: fix with-signal-frame local unw_resume(), Tommi Rantala, 2012/08/22
- [Libunwind-devel] [PATCH 24/27] Flush icache with __builtin___clear_cache() in tests when compiling with GCC, Tommi Rantala, 2012/08/22
- [Libunwind-devel] [PATCH 26/27] Fix function name duplication in Debug() output, Tommi Rantala, 2012/08/22
- [Libunwind-devel] [PATCH 27/27] Add missing newline to debug message in _UCD_access_reg_linux.c, Tommi Rantala, 2012/08/22
- [Libunwind-devel] [PATCH 02/27] HPPA: add `global_cache' member to unw_addr_space struct, Tommi Rantala, 2012/08/22
- [Libunwind-devel] [PATCH 09/27] Run `autoupdate' to stop using obsoleted macros in `configure.in', Tommi Rantala, 2012/08/22
- [Libunwind-devel] [PATCH 01/27] HPPA: fix tdep_put_unwind_info() macro, Tommi Rantala, 2012/08/22
- [Libunwind-devel] [PATCH 06/27] Eliminate unused parameters in tests, Tommi Rantala, 2012/08/22
- [Libunwind-devel] [PATCH 07/27] Annotate unused parameters in tests,
Tommi Rantala <=
- [Libunwind-devel] [PATCH 03/27] HPPA: include `mempool.h' in `libunwind_i.h', Tommi Rantala, 2012/08/22
- Re: [Libunwind-devel] [PATCH 00/27] Misc fixes II, Arun Sharma, 2012/08/26