Hi,

Reducing the number of unnecessary compiler warnings makes it easier to find 
(and fix) real compiler warnings...

The fix is in accordance with:

https://www.kernel.org/doc/Documentation/printk-formats.txt
If <type> is dependent on a config option for its size (e.g., sector_t,
blkcnt_t) or is architecture-dependent for its size (e.g., tcflag_t), use a
format specifier of its largest possible type and explicitly cast to it.

This patch reduces the number of posix tests compiler warnings, by recasting 
arguments in printf statements...

Thanks,
Cynthia Rempel
From 79e64f15c9ad2975ba95b2f7a5aaf77e2597ff65 Mon Sep 17 00:00:00 2001
From: Cynthia Rempel <[email protected]>
Date: Tue, 20 Aug 2013 20:51:41 -0700
Subject: [PATCH] Remove compiler warnings
 https://www.kernel.org/doc/Documentation/printk-formats.txt If <type> is
 dependent on a config option for its size (e.g., sector_t, blkcnt_t) or is
 architecture-dependent for its size (e.g., tcflag_t), use a format specifier
 of its largest possible type and explicitly cast to it.

---
 testsuites/psxtests/psx01/init.c        | 2 +-
 testsuites/psxtests/psx01/task.c        | 2 +-
 testsuites/psxtests/psx02/init.c        | 2 +-
 testsuites/psxtests/psx03/init.c        | 4 ++--
 testsuites/psxtests/psx04/init.c        | 6 +++---
 testsuites/psxtests/psx05/init.c        | 2 +-
 testsuites/psxtests/psx06/init.c        | 2 +-
 testsuites/psxtests/psx07/init.c        | 2 +-
 testsuites/psxtests/psx08/init.c        | 2 +-
 testsuites/psxtests/psx09/init.c        | 2 +-
 testsuites/psxtests/psx10/task.c        | 2 +-
 testsuites/psxtests/psx10/task2.c       | 2 +-
 testsuites/psxtests/psx10/task3.c       | 2 +-
 testsuites/psxtests/psx11/init.c        | 2 +-
 testsuites/psxtests/psx12/init.c        | 2 +-
 testsuites/psxtests/psxalarm01/init.c   | 4 ++--
 testsuites/psxtests/psxbarrier01/test.c | 4 ++--
 testsuites/psxtests/psxfile01/test.c    | 6 +++---
 testsuites/psxtests/psxkey01/init.c     | 2 +-
 testsuites/psxtests/psxkey01/task.c     | 2 +-
 testsuites/psxtests/psxmsgq02/init.c    | 2 +-
 testsuites/psxtests/psxsignal01/init.c  | 8 ++++----
 testsuites/psxtests/psxstat/test.c      | 6 +++---
 testsuites/psxtests/psxualarm/init.c    | 4 ++--
 24 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/testsuites/psxtests/psx01/init.c b/testsuites/psxtests/psx01/init.c
index 59605b4..37bf5ab 100644
--- a/testsuites/psxtests/psx01/init.c
+++ b/testsuites/psxtests/psx01/init.c
@@ -51,7 +51,7 @@ void *POSIX_Init(
   /* get id of this thread */
 
   Init_id = pthread_self();
-  printf( "Init: ID is 0x%08" PRIxpthread_t "\n", Init_id );
+  printf( "Init: ID is 0x%08" PRIxpthread_t "\n", (long unsigned int)Init_id );
 
   /* exercise get minimum priority */
 
diff --git a/testsuites/psxtests/psx01/task.c b/testsuites/psxtests/psx01/task.c
index f7abd5c..e0dba3b 100644
--- a/testsuites/psxtests/psx01/task.c
+++ b/testsuites/psxtests/psx01/task.c
@@ -50,7 +50,7 @@ void *Task_1_through_3(
   /* get id of this thread */
 
   Task_id = pthread_self();
-  printf( "Task_1: ID is 0x%08" PRIxpthread_t "\n", Task_id );
+  printf( "Task_1: ID is 0x%08" PRIxpthread_t "\n", (long unsigned int)Task_id );
 
   /* exercise pthread_equal */
 
diff --git a/testsuites/psxtests/psx02/init.c b/testsuites/psxtests/psx02/init.c
index 268441b..bd0e947 100644
--- a/testsuites/psxtests/psx02/init.c
+++ b/testsuites/psxtests/psx02/init.c
@@ -53,7 +53,7 @@ void *POSIX_Init(
   /* get id of this thread */
 
   Init_id = pthread_self();
-  printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );
+  printf( "Init's ID is 0x%08" PRIxpthread_t "\n", (long unsigned int)Init_id );
 
   /* install a signal handler */
 
diff --git a/testsuites/psxtests/psx03/init.c b/testsuites/psxtests/psx03/init.c
index 49368f1..785d661 100644
--- a/testsuites/psxtests/psx03/init.c
+++ b/testsuites/psxtests/psx03/init.c
@@ -28,7 +28,7 @@ void Signal_handler(
   printf(
     "Signal: %d caught by 0x%" PRIxpthread_t " (%d)\n",
     signo,
-    pthread_self(),
+    (long unsigned int)pthread_self(),
     Signal_count
   );
   Signal_occurred = 1;
@@ -55,7 +55,7 @@ void *POSIX_Init(
   /* get id of this thread */
 
   Init_id = pthread_self();
-  printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );
+  printf( "Init's ID is 0x%08" PRIxpthread_t "\n", (long unsigned int)Init_id );
 
   /* install a signal handler */
 
diff --git a/testsuites/psxtests/psx04/init.c b/testsuites/psxtests/psx04/init.c
index 140b522..3a86228 100644
--- a/testsuites/psxtests/psx04/init.c
+++ b/testsuites/psxtests/psx04/init.c
@@ -33,7 +33,7 @@ void Signal_handler(
   printf(
     "Signal: %d caught by 0x%" PRIxpthread_t " (%d)\n",
     signo,
-    pthread_self(),
+    (long unsigned int)pthread_self(),
     Signal_count
   );
   Signal_occurred = 1;
@@ -49,7 +49,7 @@ void Signal_info_handler(
   printf(
     "Signal_info: %d caught by 0x%" PRIxpthread_t " (%d) si_signo= %d si_code= %d value= %d\n",
     signo,
-    pthread_self(),
+    (long unsigned int)pthread_self(),
     Signal_count,
     info->si_signo,
     info->si_code,
@@ -80,7 +80,7 @@ void *POSIX_Init(
   /* get id of this thread */
 
   Init_id = pthread_self();
-  printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );
+  printf( "Init's ID is 0x%08" PRIxpthread_t "\n", (long unsigned int)Init_id );
 
   /* generate some easy error cases */
 
diff --git a/testsuites/psxtests/psx05/init.c b/testsuites/psxtests/psx05/init.c
index 67300b6..4591f1e 100644
--- a/testsuites/psxtests/psx05/init.c
+++ b/testsuites/psxtests/psx05/init.c
@@ -138,7 +138,7 @@ void *POSIX_Init(
   /* get id of this thread */
 
   Init_id = pthread_self();
-  printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );
+  printf( "Init's ID is 0x%08" PRIxpthread_t "\n", (long unsigned int)Init_id );
 
   /* tes pthread_mutex_attr_init */
 
diff --git a/testsuites/psxtests/psx06/init.c b/testsuites/psxtests/psx06/init.c
index f81cbae..a612b38 100644
--- a/testsuites/psxtests/psx06/init.c
+++ b/testsuites/psxtests/psx06/init.c
@@ -49,7 +49,7 @@ void *POSIX_Init(
   /* get id of this thread */
 
   Init_id = pthread_self();
-  printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );
+  printf( "Init's ID is 0x%08" PRIxpthread_t "\n", (long unsigned int)Init_id );
 
   /* create a couple of threads */
 
diff --git a/testsuites/psxtests/psx07/init.c b/testsuites/psxtests/psx07/init.c
index 36c9c85..f77bbb3 100644
--- a/testsuites/psxtests/psx07/init.c
+++ b/testsuites/psxtests/psx07/init.c
@@ -72,7 +72,7 @@ void *POSIX_Init(
   /* get id of this thread */
 
   Init_id = pthread_self();
-  printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );
+  printf( "Init's ID is 0x%08" PRIxpthread_t "\n", (long unsigned int)Init_id );
 
   /* exercise init and destroy */
 
diff --git a/testsuites/psxtests/psx08/init.c b/testsuites/psxtests/psx08/init.c
index 7517fab..03b2411 100644
--- a/testsuites/psxtests/psx08/init.c
+++ b/testsuites/psxtests/psx08/init.c
@@ -31,7 +31,7 @@ void *POSIX_Init(
   /* get id of this thread */
 
   Init_id = pthread_self();
-  printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );
+  printf( "Init's ID is 0x%08" PRIxpthread_t "\n", (long unsigned int)Init_id );
 
   puts( "Init: pthread_detach - ESRCH (invalid id)" );
   status = pthread_detach( (pthread_t) -1 );
diff --git a/testsuites/psxtests/psx09/init.c b/testsuites/psxtests/psx09/init.c
index bab7edc..75eddba 100644
--- a/testsuites/psxtests/psx09/init.c
+++ b/testsuites/psxtests/psx09/init.c
@@ -70,7 +70,7 @@ void *POSIX_Init(
   /* get id of this thread */
 
   Init_id = pthread_self();
-  printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );
+  printf( "Init's ID is 0x%08" PRIxpthread_t "\n", (long unsigned int)Init_id );
 
   /* try to use this thread as a sporadic server */
 
diff --git a/testsuites/psxtests/psx10/task.c b/testsuites/psxtests/psx10/task.c
index 4a93144..131814c 100644
--- a/testsuites/psxtests/psx10/task.c
+++ b/testsuites/psxtests/psx10/task.c
@@ -30,7 +30,7 @@ void *Task_1(
 /* wait for a condition variable signal from Init */
 
   Task_id = pthread_self();
-  printf( "Task_1: ID is 0x%08" PRIxpthread_t "\n", Task_id );
+  printf( "Task_1: ID is 0x%08" PRIxpthread_t "\n", (long unsigned int)Task_id );
 
   status = pthread_mutex_init( &Mutex_id, NULL );
   rtems_test_assert( !status );
diff --git a/testsuites/psxtests/psx10/task2.c b/testsuites/psxtests/psx10/task2.c
index fcb24bb..336f0e6 100644
--- a/testsuites/psxtests/psx10/task2.c
+++ b/testsuites/psxtests/psx10/task2.c
@@ -28,7 +28,7 @@ void *Task_2(
   int  status;
 
   Task_id = pthread_self();
-  printf( "Task_2: ID is 0x%08" PRIxpthread_t "\n", Task_id );
+  printf( "Task_2: ID is 0x%08" PRIxpthread_t "\n", (long unsigned int)Task_id );
 
   status = pthread_mutex_lock( &Mutex_id );
   rtems_test_assert( !status );
diff --git a/testsuites/psxtests/psx10/task3.c b/testsuites/psxtests/psx10/task3.c
index 64f5543..95a0752 100644
--- a/testsuites/psxtests/psx10/task3.c
+++ b/testsuites/psxtests/psx10/task3.c
@@ -28,7 +28,7 @@ void *Task_3(
   int  status;
 
   Task_id = pthread_self();
-  printf( "Task_3: ID is 0x%08" PRIxpthread_t "\n", Task_id );
+  printf( "Task_3: ID is 0x%08" PRIxpthread_t "\n", (long unsigned int)Task_id );
 
   status = pthread_mutex_lock( &Mutex_id );
   rtems_test_assert( !status );
diff --git a/testsuites/psxtests/psx11/init.c b/testsuites/psxtests/psx11/init.c
index 5e981ff..928f5ee 100644
--- a/testsuites/psxtests/psx11/init.c
+++ b/testsuites/psxtests/psx11/init.c
@@ -38,7 +38,7 @@ void *POSIX_Init(
   /* get id of this thread */
 
   Init_id = pthread_self();
-  printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );
+  printf( "Init's ID is 0x%08" PRIxpthread_t "\n", (long unsigned int)Init_id );
 
   /* exercise pthread_setschedparam */
 
diff --git a/testsuites/psxtests/psx12/init.c b/testsuites/psxtests/psx12/init.c
index 71e0b96..c952eb7 100644
--- a/testsuites/psxtests/psx12/init.c
+++ b/testsuites/psxtests/psx12/init.c
@@ -60,7 +60,7 @@ void *POSIX_Init(
   /* get id of this thread */
 
   Init_id = pthread_self();
-  printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );
+  printf( "Init's ID is 0x%08" PRIxpthread_t "\n", (long unsigned int)Init_id );
 
   /* invalid scheduling policy error */
 
diff --git a/testsuites/psxtests/psxalarm01/init.c b/testsuites/psxtests/psxalarm01/init.c
index be3b4a6..32b83bb 100644
--- a/testsuites/psxtests/psxalarm01/init.c
+++ b/testsuites/psxtests/psxalarm01/init.c
@@ -36,7 +36,7 @@ void Signal_handler(
   printf(
     "Signal: %d caught by 0x%" PRIxpthread_t " (%d)\n",
     signo,
-    pthread_self(),
+    (long unsigned int)pthread_self(),
     Signal_count
   );
   Signal_occurred = 1;
@@ -52,7 +52,7 @@ void Signal_info_handler(
   printf(
     "Signal_info: %d caught by 0x%" PRIxpthread_t " (%d) si_signo= %d si_code= %d value= %d\n",
     signo,
-    pthread_self(),
+    (long unsigned int)pthread_self(),
     Signal_count,
     info->si_signo,
     info->si_code,
diff --git a/testsuites/psxtests/psxbarrier01/test.c b/testsuites/psxtests/psxbarrier01/test.c
index 90e4b80..3373d09 100644
--- a/testsuites/psxtests/psxbarrier01/test.c
+++ b/testsuites/psxtests/psxbarrier01/test.c
@@ -32,9 +32,9 @@ void *BarrierThread(void *arg)
   pthread_t id = *(pthread_t *) arg;
   int       status;
 
-  printf( "pthread_barrier_wait( &Barrier ) for thread 0x%08" PRIxpthread_t "\n", id );
+  printf( "pthread_barrier_wait( &Barrier ) for thread 0x%08" PRIxpthread_t "\n", (long unsigned int)id );
   status = pthread_barrier_wait( &Barrier );
-  printf( "pthread_barrier_wait - 0x%08" PRIxpthread_t " released\n", id );
+  printf( "pthread_barrier_wait - 0x%08" PRIxpthread_t " released\n", (long unsigned int)id );
   rtems_test_assert( (status == 0) || (status == PTHREAD_BARRIER_SERIAL_THREAD) );
 
   return NULL;
diff --git a/testsuites/psxtests/psxfile01/test.c b/testsuites/psxtests/psxfile01/test.c
index 4d7fe0b..a324498 100644
--- a/testsuites/psxtests/psxfile01/test.c
+++ b/testsuites/psxtests/psxfile01/test.c
@@ -92,7 +92,7 @@ void dump_statbuf( struct stat *buf )
   printf( "....st_dev     (0x%" PRIx32 ":0x%" PRIx32 ")\n", major1, minor1 );
   printf( "....st_rdev    (0x%" PRIx32 ":0x%" PRIx32 ")\n", major2, minor2 );
   printf( "....st_ino     %" PRIxino_t "  may vary by small amount\n", buf->st_ino );
-  printf( "....mode  = %08" PRIomode_t "\n", buf->st_mode );
+  printf( "....mode  = %08" PRIomode_t "\n", (long unsigned int)buf->st_mode );
   printf( "....nlink = %d\n", buf->st_nlink );
 
   printf( "....uid = %d\n", buf->st_uid );
@@ -102,8 +102,8 @@ void dump_statbuf( struct stat *buf )
   printf( "....mtime = %s", ctime(&buf->st_mtime) );
   printf( "....ctime = %s", ctime(&buf->st_ctime) );
 
-  printf( "....st_blksize %" PRIxblksize_t "\n", buf->st_blksize );
-  printf( "....st_blocks  %" PRIxblkcnt_t "\n", buf->st_blocks );
+  printf( "....st_blksize %" PRIxblksize_t "\n", (long unsigned int)buf->st_blksize );
+  printf( "....st_blocks  %" PRIxblkcnt_t "\n", (long unsigned int)buf->st_blocks );
 }
 
 void stat_a_file(
diff --git a/testsuites/psxtests/psxkey01/init.c b/testsuites/psxtests/psxkey01/init.c
index e63407c..94676ac 100644
--- a/testsuites/psxtests/psxkey01/init.c
+++ b/testsuites/psxtests/psxkey01/init.c
@@ -39,7 +39,7 @@ void *POSIX_Init(
   /* get id of this thread */
 
   Init_id = pthread_self();
-  printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );
+  printf( "Init's ID is 0x%08" PRIxpthread_t "\n", (long unsigned int)Init_id );
 
   rtems_workspace_greedy_allocate( NULL, 0 );
 
diff --git a/testsuites/psxtests/psxkey01/task.c b/testsuites/psxtests/psxkey01/task.c
index 4f83ebe..a2c7ab4 100644
--- a/testsuites/psxtests/psxkey01/task.c
+++ b/testsuites/psxtests/psxkey01/task.c
@@ -31,7 +31,7 @@ void *Task_1(
   int         status;
   uint32_t   *key_data;
 
-  printf( "Thread 0x%08" PRIxpthread_t "\n", id );
+  printf( "Thread 0x%08" PRIxpthread_t "\n", (long unsigned int)id );
   printf( "Task_1: Setting the key to %d\n", 1 );
   status = pthread_setspecific( Key_id[0], (void *)&Data_array[ 1 ] );
   if ( status )
diff --git a/testsuites/psxtests/psxmsgq02/init.c b/testsuites/psxtests/psxmsgq02/init.c
index 53c4769..06c976c 100644
--- a/testsuites/psxtests/psxmsgq02/init.c
+++ b/testsuites/psxtests/psxmsgq02/init.c
@@ -45,7 +45,7 @@ void *POSIX_Init(
   /* get id of this thread */
 
   Init_id = pthread_self();
-  printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );
+  printf( "Init's ID is 0x%08" PRIxpthread_t "\n", (long unsigned int)Init_id );
 
   rtems_workspace_greedy_allocate( NULL, 0 );
 
diff --git a/testsuites/psxtests/psxsignal01/init.c b/testsuites/psxtests/psxsignal01/init.c
index 2e5925d..8c10d73 100644
--- a/testsuites/psxtests/psxsignal01/init.c
+++ b/testsuites/psxtests/psxsignal01/init.c
@@ -42,7 +42,7 @@ void Handler_1(
   printf(
     "Handler_1: Signal: %d caught by 0x%" PRIxpthread_t " (%d)\n",
     signo,
-    pthread_self(),
+    (long unsigned int)pthread_self(),
     Signal_count
   );
   Signal_occurred = 1;
@@ -56,7 +56,7 @@ void Signal_handler(
   printf(
     "Signal: %d caught by 0x%"PRIxpthread_t " (%d)\n",
     signo,
-    pthread_self(),
+    (long unsigned int)pthread_self(),
     Signal_count
   );
   Signal_occurred = 1;
@@ -72,7 +72,7 @@ void Signal_info_handler(
   printf(
     "Signal_info: %d caught by 0x%" PRIxpthread_t " (%d) si_signo= %d si_code= %d value= %d\n",
     signo,
-    pthread_self(),
+    (long unsigned int)pthread_self(),
     Signal_count,
     info->si_signo,
     info->si_code,
@@ -113,7 +113,7 @@ void *POSIX_Init(
   /* get id of this thread */
 
   Init_id = pthread_self();
-  printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );
+  printf( "Init's ID is 0x%08" PRIxpthread_t "\n", (long unsigned int)Init_id );
 
   Signal_occurred = 0;
   Signal_count = 0;
diff --git a/testsuites/psxtests/psxstat/test.c b/testsuites/psxtests/psxstat/test.c
index f072eab..163747b 100644
--- a/testsuites/psxtests/psxstat/test.c
+++ b/testsuites/psxtests/psxstat/test.c
@@ -235,7 +235,7 @@ void stat_a_file_helper(
 
     printf("\n...st_dev     (0x%x:0x%x)\n", major1, minor1 );
     printf(  "...st_ino     %" PRIxino_t "\n", statbuf.st_ino );
-    printf(  "...st_mode    %" PRIomode_t "\n", statbuf.st_mode );
+    printf(  "...st_mode    %" PRIomode_t "\n", (long unsigned int)statbuf.st_mode );
     printf(  "...st_nlink   %x\n", statbuf.st_nlink );
     printf(  "...st_uid     %d\n", statbuf.st_uid );
     printf(  "...st_gid     %d\n", statbuf.st_gid );
@@ -244,8 +244,8 @@ void stat_a_file_helper(
     printf(  "...st_atime   %s", ctime( &statbuf.st_atime ) );
     printf(  "...st_mtime   %s", ctime( &statbuf.st_mtime ) );
     printf(  "...st_ctime   %s", ctime( &statbuf.st_ctime ) );
-    printf(  "...st_blksize %" PRIxblksize_t "\n", statbuf.st_blksize );
-    printf(  "...st_blocks  %" PRIxblkcnt_t "\n", statbuf.st_blocks );
+    printf(  "...st_blksize %" PRIxblksize_t "\n", (long unsigned int)statbuf.st_blksize );
+    printf(  "...st_blocks  %" PRIxblkcnt_t "\n", (long unsigned int)statbuf.st_blocks );
   }
 }
 
diff --git a/testsuites/psxtests/psxualarm/init.c b/testsuites/psxtests/psxualarm/init.c
index 19c9e44..9c03376 100644
--- a/testsuites/psxtests/psxualarm/init.c
+++ b/testsuites/psxtests/psxualarm/init.c
@@ -39,7 +39,7 @@ void Signal_handler(
   printf(
     "Signal: %d caught by 0x%" PRIxpthread_t " (%d)\n",
     signo,
-    pthread_self(),
+    (long unsigned int)pthread_self(),
     Signal_count
   );
   Signal_occurred = 1;
@@ -75,7 +75,7 @@ void *POSIX_Init(
   /* get id of this thread */
 
   Init_id = pthread_self();
-  printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );
+  printf( "Init's ID is 0x%08" PRIxpthread_t "\n", (long unsigned int)Init_id );
 
   Signal_occurred = 0;
   Signal_count = 0;
-- 
1.8.1.2

_______________________________________________
rtems-devel mailing list
[email protected]
http://www.rtems.org/mailman/listinfo/rtems-devel

Reply via email to