libunwind-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Libunwind-devel] [PATCH 48/57] Use `UNUSED' in tests


From: Tommi Rantala
Subject: [Libunwind-devel] [PATCH 48/57] Use `UNUSED' in tests
Date: Fri, 21 Sep 2012 14:11:49 +0300

---
 tests/Gtest-bt.c             |    6 ++---
 tests/Gtest-concurrent.c     |    8 +++---
 tests/Gtest-dyn1.c           |    6 +++--
 tests/Gtest-init.cxx         |    3 ++-
 tests/Gtest-resume-sig.c     |    8 +++---
 tests/Gtest-trace.c          |    6 ++---
 tests/Lrs-race.c             |    5 ++--
 tests/Ltest-varargs.c        |    2 +-
 tests/test-async-sig.c       |    4 ++-
 tests/test-coredump-unwind.c |    2 +-
 tests/test-init-remote.c     |    4 ++-
 tests/test-mem.c             |    4 ++-
 tests/test-proc-info.c       |   59 +++++++++++++++++++++---------------------
 tests/test-ptrace-misc.c     |    4 ++-
 tests/test-setjmp.c          |    4 ++-
 tests/test-static-link-loc.c |    3 ++-
 tests/test-strerror.c        |    3 ++-
 17 files changed, 76 insertions(+), 55 deletions(-)

diff --git a/tests/Gtest-bt.c b/tests/Gtest-bt.c
index 4a07c6f..802dd08 100644
--- a/tests/Gtest-bt.c
+++ b/tests/Gtest-bt.c
@@ -127,7 +127,7 @@ do_backtrace (void)
 }
 
 void
-foo (long val __attribute__((unused)))
+foo (long val UNUSED)
 {
   do_backtrace ();
 }
@@ -164,7 +164,7 @@ bar (long v)
 }
 
 void
-sighandler (int signal, void *siginfo __attribute__((unused)), void *context)
+sighandler (int signal, void *siginfo UNUSED, void *context)
 {
   ucontext_t *uc UNUSED;
   int sp;
@@ -206,7 +206,7 @@ sighandler (int signal, void *siginfo 
__attribute__((unused)), void *context)
 }
 
 int
-main (int argc, char **argv __attribute__((unused)))
+main (int argc, char **argv UNUSED)
 {
   struct sigaction act;
   stack_t stk;
diff --git a/tests/Gtest-concurrent.c b/tests/Gtest-concurrent.c
index b98b6c0..6f3447f 100644
--- a/tests/Gtest-concurrent.c
+++ b/tests/Gtest-concurrent.c
@@ -27,6 +27,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.  */
 # include "config.h"
 #endif
 
+#include "compiler.h"
+
 #include <libunwind.h>
 #include <limits.h>
 #include <pthread.h>
@@ -46,7 +48,7 @@ int got_usr1, got_usr2;
 char *sigusr1_sp;
 
 void
-handler (int sig __attribute__((unused)))
+handler (int sig UNUSED)
 {
   unw_word_t ip;
   unw_context_t uc;
@@ -68,7 +70,7 @@ handler (int sig __attribute__((unused)))
 }
 
 void *
-worker (void *arg __attribute__((unused)))
+worker (void *arg UNUSED)
 {
   signal (SIGUSR1, handler);
 
@@ -102,7 +104,7 @@ doit (void)
 }
 
 int
-main (int argc, char **argv __attribute__((unused)))
+main (int argc, char **argv UNUSED)
 {
   if (argc > 1)
     verbose = 1;
diff --git a/tests/Gtest-dyn1.c b/tests/Gtest-dyn1.c
index 96eb706..bc7dc9c 100644
--- a/tests/Gtest-dyn1.c
+++ b/tests/Gtest-dyn1.c
@@ -27,6 +27,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.  */
 
 #include "flush-cache.h"
 
+#include "compiler.h"
+
 #include <libunwind.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -157,13 +159,13 @@ sighandler (int signal)
 }
 
 int
-dev_null (const char *format __attribute__((unused)), ...)
+dev_null (const char *format UNUSED, ...)
 {
   return 0;
 }
 
 int
-main (int argc, char *argv[] __attribute__((unused)))
+main (int argc, char *argv[] 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 9a3f482..afded01 100644
--- a/tests/Gtest-init.cxx
+++ b/tests/Gtest-init.cxx
@@ -31,6 +31,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.  */
 #include <unistd.h>
 
 #include <libunwind.h>
+#include "compiler.h"
 
 int verbose, errors;
 
@@ -99,7 +100,7 @@ Test_Class::Test_Class (void)
 }
 
 int
-main (int argc, char **argv __attribute__((unused)))
+main (int argc, char **argv UNUSED)
 {
   verbose = argc > 1;
   return atexit (a);
diff --git a/tests/Gtest-resume-sig.c b/tests/Gtest-resume-sig.c
index 57939cd..55eb00a 100644
--- a/tests/Gtest-resume-sig.c
+++ b/tests/Gtest-resume-sig.c
@@ -27,6 +27,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.  */
 # include "config.h"
 #endif
 
+#include "compiler.h"
+
 #include <libunwind.h>
 #include <signal.h>
 #include <stdio.h>
@@ -64,8 +66,8 @@ get_bsp (void)
 #ifdef TEST_WITH_SIGINFO
 void
 handler (int sig,
-         siginfo_t *si __attribute__((unused)),
-         void *ucontext __attribute__((unused)))
+         siginfo_t *si UNUSED,
+         void *ucontext UNUSED)
 #else
 void
 handler (int sig)
@@ -135,7 +137,7 @@ handler (int sig)
 }
 
 int
-main (int argc, char **argv __attribute__((unused)))
+main (int argc, char **argv UNUSED)
 {
   struct sigaction sa;
   float d = 1.0;
diff --git a/tests/Gtest-trace.c b/tests/Gtest-trace.c
index e8dd989..dcd467b 100644
--- a/tests/Gtest-trace.c
+++ b/tests/Gtest-trace.c
@@ -139,7 +139,7 @@ do_backtrace (void)
 }
 
 void
-foo (long val __attribute__((unused)))
+foo (long val UNUSED)
 {
   do_backtrace ();
 }
@@ -176,7 +176,7 @@ bar (long v)
 }
 
 void
-sighandler (int signal, void *siginfo __attribute__((unused)), void *context)
+sighandler (int signal, void *siginfo UNUSED, void *context)
 {
   ucontext_t *uc UNUSED;
   int sp;
@@ -220,7 +220,7 @@ sighandler (int signal, void *siginfo 
__attribute__((unused)), void *context)
 }
 
 int
-main (int argc, char **argv __attribute__((unused)))
+main (int argc, char **argv UNUSED)
 {
   struct sigaction act;
   stack_t stk;
diff --git a/tests/Lrs-race.c b/tests/Lrs-race.c
index 061bd8c..e39a62b 100644
--- a/tests/Lrs-race.c
+++ b/tests/Lrs-race.c
@@ -26,6 +26,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.  */
 
 #define UNW_LOCAL_ONLY
 #include <libunwind.h>
+#include "compiler.h"
 
 #include <stdio.h>
 #include <pthread.h>
@@ -1333,7 +1334,7 @@ foo_128 (void)
 }
 
 void *
-bar(void *p __attribute__((unused)))
+bar(void *p UNUSED)
 {
   int i;
   for (i = 0; i < ITERS; ++i) {
@@ -1487,7 +1488,7 @@ int doit ()
 }
 
 int
-main (int argc, char **argv __attribute__((unused)))
+main (int argc, char **argv UNUSED)
 {
   if (argc > 1)
     verbose = 1;
diff --git a/tests/Ltest-varargs.c b/tests/Ltest-varargs.c
index 755bd1d..db0cab7 100644
--- a/tests/Ltest-varargs.c
+++ b/tests/Ltest-varargs.c
@@ -58,7 +58,7 @@ a (int d, ...)
 }
 
 int
-main (int argc, char **argv __attribute__((unused)))
+main (int argc, char **argv UNUSED)
 {
   if (argc > 1)
     verbose = 1;
diff --git a/tests/test-async-sig.c b/tests/test-async-sig.c
index 9a0d39e..2ce8b4b 100644
--- a/tests/test-async-sig.c
+++ b/tests/test-async-sig.c
@@ -27,6 +27,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.  */
 #include "config.h"
 #endif
 
+#include "compiler.h"
+
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -159,7 +161,7 @@ sighandler (int signal)
 }
 
 int
-main (int argc, char **argv __attribute__((unused)))
+main (int argc, char **argv UNUSED)
 {
   struct sigaction act;
   long i = 0;
diff --git a/tests/test-coredump-unwind.c b/tests/test-coredump-unwind.c
index d7c7954..5254708 100644
--- a/tests/test-coredump-unwind.c
+++ b/tests/test-coredump-unwind.c
@@ -263,7 +263,7 @@ static void install_sigsegv_handler(void)
 }
 
 int
-main(int argc __attribute__((unused)), char **argv)
+main(int argc 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 47d9548..66f2d6a 100644
--- a/tests/test-init-remote.c
+++ b/tests/test-init-remote.c
@@ -32,6 +32,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.  */
 # include "config.h"
 #endif
 
+#include "compiler.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -91,7 +93,7 @@ foo (void)
 }
 
 int
-main (int argc, char **argv __attribute__((unused)))
+main (int argc, char **argv UNUSED)
 {
   verbose = (argc > 1);
 
diff --git a/tests/test-mem.c b/tests/test-mem.c
index 2a24359..52c9774 100644
--- a/tests/test-mem.c
+++ b/tests/test-mem.c
@@ -25,6 +25,8 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 
AN ACTION
 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
 
+#include "compiler.h"
+
 #include <libunwind.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -82,7 +84,7 @@ consume_some_stack_space (void)
 }
 
 int
-main (int argc, char **argv __attribute__((unused)))
+main (int argc, char **argv UNUSED)
 {
   struct rlimit rlim;
 
diff --git a/tests/test-proc-info.c b/tests/test-proc-info.c
index e97ef2b..c4145bc 100644
--- a/tests/test-proc-info.c
+++ b/tests/test-proc-info.c
@@ -36,6 +36,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.  */
 #include <string.h>
 
 #include <libunwind.h>
+#include "compiler.h"
 
 int errors;
 
@@ -43,20 +44,20 @@ int errors;
        { ++errors; fprintf (stderr, args); return -1; }
 
 static int
-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)))
+find_proc_info (unw_addr_space_t as UNUSED,
+                unw_word_t ip UNUSED,
+                unw_proc_info_t *pip UNUSED,
+                int need_unwind_info UNUSED,
+                void *arg UNUSED)
 {
   return -UNW_ESTOPUNWIND;
 }
 
 static int
-access_mem (unw_addr_space_t as __attribute__((unused)),
-            unw_word_t addr __attribute__((unused)),
+access_mem (unw_addr_space_t as UNUSED,
+            unw_word_t addr UNUSED,
             unw_word_t *valp, int write,
-            void *arg __attribute__((unused)))
+            void *arg UNUSED)
 {
   if (!write)
     *valp = 0;
@@ -64,10 +65,10 @@ access_mem (unw_addr_space_t as __attribute__((unused)),
 }
 
 static int
-access_reg (unw_addr_space_t as __attribute__((unused)),
-            unw_regnum_t regnum __attribute__((unused)),
+access_reg (unw_addr_space_t as UNUSED,
+            unw_regnum_t regnum UNUSED,
             unw_word_t *valp, int write,
-            void *arg __attribute__((unused)))
+            void *arg UNUSED)
 {
   if (!write)
     *valp = 32;
@@ -75,10 +76,10 @@ access_reg (unw_addr_space_t as __attribute__((unused)),
 }
 
 static int
-access_fpreg (unw_addr_space_t as __attribute__((unused)),
-              unw_regnum_t regnum __attribute__((unused)),
+access_fpreg (unw_addr_space_t as UNUSED,
+              unw_regnum_t regnum UNUSED,
               unw_fpreg_t *valp, int write,
-              void *arg __attribute__((unused)))
+              void *arg UNUSED)
 {
   if (!write)
     memset (valp, 0, sizeof (*valp));
@@ -86,37 +87,37 @@ access_fpreg (unw_addr_space_t as __attribute__((unused)),
 }
 
 static int
-get_dyn_info_list_addr (unw_addr_space_t as __attribute__((unused)),
-                        unw_word_t *dilap __attribute__((unused)),
-                        void *arg __attribute__((unused)))
+get_dyn_info_list_addr (unw_addr_space_t as UNUSED,
+                        unw_word_t *dilap UNUSED,
+                        void *arg UNUSED)
 {
   return -UNW_ENOINFO;
 }
 
 static void
-put_unwind_info (unw_addr_space_t as __attribute__((unused)),
-                 unw_proc_info_t *pi __attribute__((unused)),
-                 void *arg __attribute__((unused)))
+put_unwind_info (unw_addr_space_t as UNUSED,
+                 unw_proc_info_t *pi UNUSED,
+                 void *arg UNUSED)
 {
   ++errors;
   fprintf (stderr, "%s() got called!\n", __FUNCTION__);
 }
 
 static int
-resume (unw_addr_space_t as __attribute__((unused)),
-        unw_cursor_t *reg __attribute__((unused)),
-        void *arg __attribute__((unused)))
+resume (unw_addr_space_t as UNUSED,
+        unw_cursor_t *reg UNUSED,
+        void *arg UNUSED)
 {
   panic ("%s() got called!\n", __FUNCTION__);
 }
 
 static int
-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)))
+get_proc_name (unw_addr_space_t as UNUSED,
+               unw_word_t ip UNUSED,
+               char *buf UNUSED,
+               size_t buf_len UNUSED,
+               unw_word_t *offp UNUSED,
+               void *arg UNUSED)
 {
   panic ("%s() got called!\n", __FUNCTION__);
 }
diff --git a/tests/test-ptrace-misc.c b/tests/test-ptrace-misc.c
index fbbec9c..374059d 100644
--- a/tests/test-ptrace-misc.c
+++ b/tests/test-ptrace-misc.c
@@ -23,6 +23,8 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 
AN ACTION
 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
 
+#include "compiler.h"
+
 #include <signal.h>
 #include <stdint.h>
 #include <stdio.h>
@@ -104,7 +106,7 @@ bar (int v)
 }
 
 int
-main (int argc, char **argv __attribute__((unused)))
+main (int argc, char **argv UNUSED)
 {
   int val = argc;
 
diff --git a/tests/test-setjmp.c b/tests/test-setjmp.c
index 3054574..769b71b 100644
--- a/tests/test-setjmp.c
+++ b/tests/test-setjmp.c
@@ -23,6 +23,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.  */
 
 /* The setjmp()/longjmp(), sigsetjmp()/siglongjmp().  */
 
+#include "compiler.h"
+
 #include <setjmp.h>
 #include <signal.h>
 #include <stdio.h>
@@ -139,7 +141,7 @@ sighandler (int signal)
 }
 
 int
-main (int argc, char **argv __attribute__((unused)))
+main (int argc, char **argv 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 ed94f55..4e47e45 100644
--- a/tests/test-static-link-loc.c
+++ b/tests/test-static-link-loc.c
@@ -33,6 +33,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.  */
 
 #define UNW_LOCAL_ONLY
 #include <libunwind.h>
+#include "compiler.h"
 
 extern int test_generic (void);
 
@@ -87,7 +88,7 @@ test_local (void)
 #endif /* !UNW_REMOTE_ONLY */
 
 int
-main (int argc, char **argv __attribute__((unused)))
+main (int argc, char **argv UNUSED)
 {
   if (argc > 1)
     verbose = 1;
diff --git a/tests/test-strerror.c b/tests/test-strerror.c
index 4470952..f7ae61e 100644
--- a/tests/test-strerror.c
+++ b/tests/test-strerror.c
@@ -1,8 +1,9 @@
+#include "compiler.h"
 #include <libunwind.h>
 #include <stdio.h>
 
 int
-main (int argc, char **argv __attribute__((unused)))
+main (int argc, char **argv UNUSED)
 {
   int i, verbose = argc > 1;
   const char *msg;
-- 
1.7.9.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]