Hi, This patch fixes ~32 compiler warnings for the sparc-sis bsp, by making the posix test cases more posix compliant. This also deprecates PRIxpthread_t, PRIxblksize_t, and PRIxblkcnt_t... which are helper macros for testing RTEMS... and don't add to posix compliance...
Most of this patch could have been done with the clever use of sed... >________________________________________ >From: Joel Sherrill [joel.sherr...@oarcorp.com] >Sent: Wednesday, August 21, 2013 9:45 AM >To: Gedare Bloom >Cc: Rempel, Cynthia; rtems-devel@rtems.org >Subject: Re: Posix Tests Compiler Warnings > >On 8/21/2013 7:59 AM, Gedare Bloom wrote: > >Hi, > >>The documentation you pointed to is the Linux kernel doc, which are >>not entirely relevant for RTEMS. Is there a POSIX standard that >>governs this issue? >Well... the basic types are covered by inttypes.h which is POSIX and >the link I posted covers. That file is in newlib. >http://pubs.opengroup.org/onlinepubs/009604599/basedefs/inttypes.h.html >inttypes.h itself is (more than likely) correct. > >As an aside, inttypes.h prototypes four methods. newlib does not >have implementations of them. I started a discussion on adding them >and this is the thread: > >http://sourceware.org/ml/newlib/2013/msg00626.html > >Corinna Vinschen proposed a rather elegant solution which would provide >them as aliases for existing routines. Then the documentation for each >would have to be added. Where would the documentation be done? > >If you are working in this area, this is a good thing to touch on. Interesting... can someone do inline routines in newlib?... that might meet the anti-macro requirement... >>This looks like mostly converting pointer types to long unsigned int? >>Some of the changes seem like they should not be necessary, like: >>- 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 ); Sadly, they are necessary... see: http://pubs.opengroup.org/onlinepubs/009604599/basedefs/inttypes.h.html >These are NOT covered by the POSIX inttypes.h. I see one of them >defined in ./testsuites/psxtests/include/pmacros.h. So they are >test support and logically extend the type specific print specifiers >in inttypes.h. Apparently some of them are wrong. in my humble opinion, it would be easier in the long run to change the tests, and deprecate the non-compliant macros, in favor of posix compliant macros (which has been done in this patch), than to get the non-compliant macros to work... >If you eliminate the warning on sparc or powerpc, then that will >likely cover most targets. But if the underlying type varies based >on target architecture, then you will have to check it on the >varying architectures. This eliminates them on sparc... haven't tried ppc... >Should be a series of one-line fixes which don't reflect the mental >power required to solve. :) Yes, the big patch didn't really require much in-depth thought, just a lot of back-and-forth looking at references... >>Here the printf already should accommodate the size of the type of the >>blksize_t and blkcnt_t. This is how I usually see this issue of >>variably-sized types being printed. I don't know the right answer. I'd suggest considering deprecating the non-compliant macros that are challenging to maintain, and use variable sized print specifiers (i.e. PRIxMAX/uintmax_t) provided by posix (if really needed)... more thought probably should be put into substitutions outside of printf statements in tests, though (as outside of printf statements for testing size, and speed resources are limited)... >>-Gedare On Wed, Aug 21, 2013 at 12:33 AM, Rempel, Cynthia <cynt6...@vandals.uidaho.edu><mailto:cynt6...@vandals.uidaho.edu> wrote: 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 _______________________________________________ rtems-devel mailing list rtems-devel@rtems.org<mailto:rtems-devel@rtems.org> http://www.rtems.org/mailman/listinfo/rtems-devel _______________________________________________ rtems-devel mailing list rtems-devel@rtems.org<mailto:rtems-devel@rtems.org> http://www.rtems.org/mailman/listinfo/rtems-devel -- Joel Sherrill, Ph.D. Director of Research & Development joel.sherr...@oarcorp.com<mailto:joel.sherr...@oarcorp.com> On-Line Applications Research Ask me about RTEMS: a free RTOS Huntsville AL 35805 Support Available (256) 722-9985
From 16c527a86adfcf6eee164efc3f3d1cdefea2f569 Mon Sep 17 00:00:00 2001 From: Cynthia Rempel <cynt...@rtems.org> Date: Wed, 21 Aug 2013 21:57:46 -0700 Subject: [PATCH 1/2] Reduce compiler warnings Reduces compiler warnings by making tests more POSIX compliant. In particular, this removes the dependency of the listed tests on PRIxpthread_t, and other non-compliant printf format specifiers see: http://pubs.opengroup.org/onlinepubs/009604599/basedefs/inttypes.h.html --- testsuites/psxtests/psx01/init.c | 2 +- testsuites/psxtests/psx01/task.c | 4 ++-- testsuites/psxtests/psx02/init.c | 3 ++- testsuites/psxtests/psx03/init.c | 7 ++++--- testsuites/psxtests/psx04/init.c | 11 ++++++----- testsuites/psxtests/psx05/init.c | 3 ++- testsuites/psxtests/psx06/init.c | 3 ++- testsuites/psxtests/psx07/init.c | 4 ++-- testsuites/psxtests/psx08/init.c | 3 ++- testsuites/psxtests/psx09/init.c | 3 ++- testsuites/psxtests/psx10/init.c | 2 +- testsuites/psxtests/psx10/task.c | 4 ++-- testsuites/psxtests/psx10/task2.c | 3 ++- testsuites/psxtests/psx10/task3.c | 3 ++- testsuites/psxtests/psx11/init.c | 3 ++- testsuites/psxtests/psx12/init.c | 3 ++- testsuites/psxtests/psxalarm01/init.c | 9 +++++---- testsuites/psxtests/psxbarrier01/test.c | 5 +++-- testsuites/psxtests/psxfile01/test.c | 6 +++--- testsuites/psxtests/psxfile02/init.c | 2 +- testsuites/psxtests/psxkey01/init.c | 2 +- testsuites/psxtests/psxkey01/task.c | 3 ++- testsuites/psxtests/psxmsgq02/init.c | 3 ++- testsuites/psxtests/psxsignal01/init.c | 15 ++++++++------- testsuites/psxtests/psxstat/test.c | 7 ++++--- testsuites/psxtests/psxualarm/init.c | 7 ++++--- 26 files changed, 69 insertions(+), 51 deletions(-) diff --git a/testsuites/psxtests/psx01/init.c b/testsuites/psxtests/psx01/init.c index 59605b4..8495d26 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" PRIx32 "\n", (uint32_t)Init_id ); /* exercise get minimum priority */ diff --git a/testsuites/psxtests/psx01/task.c b/testsuites/psxtests/psx01/task.c index f7abd5c..f3f3453 100644 --- a/testsuites/psxtests/psx01/task.c +++ b/testsuites/psxtests/psx01/task.c @@ -21,7 +21,7 @@ #endif #include "system.h" - +#include <inttypes.h> void Test_init_routine( void ); void Test_init_routine( void ) @@ -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" PRIx32 "\n", (uint32_t)Task_id ); /* exercise pthread_equal */ diff --git a/testsuites/psxtests/psx02/init.c b/testsuites/psxtests/psx02/init.c index 268441b..cc32b80 100644 --- a/testsuites/psxtests/psx02/init.c +++ b/testsuites/psxtests/psx02/init.c @@ -14,6 +14,7 @@ #define CONFIGURE_INIT #include "system.h" #include <signal.h> +#include <inttypes.h> volatile int Signal_occurred; volatile int Signal_count; @@ -53,7 +54,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" PRIx32 "\n", (uint32_t)Init_id ); /* install a signal handler */ diff --git a/testsuites/psxtests/psx03/init.c b/testsuites/psxtests/psx03/init.c index 49368f1..2ee39ad 100644 --- a/testsuites/psxtests/psx03/init.c +++ b/testsuites/psxtests/psx03/init.c @@ -15,6 +15,7 @@ #include "system.h" #include <signal.h> #include <errno.h> +#include <inttypes.h> volatile int Signal_occurred; volatile int Signal_count; @@ -26,9 +27,9 @@ void Signal_handler( { Signal_count++; printf( - "Signal: %d caught by 0x%" PRIxpthread_t " (%d)\n", + "Signal: %d caught by 0x%" PRIx32 " (%d)\n", signo, - pthread_self(), + (uint32_t)pthread_self(), Signal_count ); Signal_occurred = 1; @@ -55,7 +56,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" PRIx32 "\n", (uint32_t)Init_id ); /* install a signal handler */ diff --git a/testsuites/psxtests/psx04/init.c b/testsuites/psxtests/psx04/init.c index 140b522..e4a06f4 100644 --- a/testsuites/psxtests/psx04/init.c +++ b/testsuites/psxtests/psx04/init.c @@ -15,6 +15,7 @@ #include "system.h" #include <signal.h> #include <errno.h> +#include <inttypes.h> volatile int Signal_occurred; volatile int Signal_count; @@ -31,9 +32,9 @@ void Signal_handler( { Signal_count++; printf( - "Signal: %d caught by 0x%" PRIxpthread_t " (%d)\n", + "Signal: %d caught by 0x%" PRIx32 " (%d)\n", signo, - pthread_self(), + (uint32_t)pthread_self(), Signal_count ); Signal_occurred = 1; @@ -47,9 +48,9 @@ void Signal_info_handler( { Signal_count++; printf( - "Signal_info: %d caught by 0x%" PRIxpthread_t " (%d) si_signo= %d si_code= %d value= %d\n", + "Signal_info: %d caught by 0x%" PRIx32 " (%d) si_signo= %d si_code= %d value= %d\n", signo, - pthread_self(), + (uint32_t)pthread_self(), Signal_count, info->si_signo, info->si_code, @@ -80,7 +81,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" PRIx32 "\n", (uint32_t)Init_id ); /* generate some easy error cases */ diff --git a/testsuites/psxtests/psx05/init.c b/testsuites/psxtests/psx05/init.c index 67300b6..d592520 100644 --- a/testsuites/psxtests/psx05/init.c +++ b/testsuites/psxtests/psx05/init.c @@ -12,6 +12,7 @@ #endif #include <sched.h> +#include <inttypes.h> #define CONFIGURE_INIT #include "system.h" @@ -138,7 +139,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" PRIx32 "\n", (uint32_t)Init_id ); /* tes pthread_mutex_attr_init */ diff --git a/testsuites/psxtests/psx06/init.c b/testsuites/psxtests/psx06/init.c index f81cbae..b8b577b 100644 --- a/testsuites/psxtests/psx06/init.c +++ b/testsuites/psxtests/psx06/init.c @@ -14,6 +14,7 @@ #define CONFIGURE_INIT #include "system.h" #include <errno.h> +#include <inttypes.h> extern void Key_destructor( void *key_data ); @@ -49,7 +50,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" PRIx32 "\n", (uint32_t)Init_id ); /* create a couple of threads */ diff --git a/testsuites/psxtests/psx07/init.c b/testsuites/psxtests/psx07/init.c index 36c9c85..f6ce1f2 100644 --- a/testsuites/psxtests/psx07/init.c +++ b/testsuites/psxtests/psx07/init.c @@ -13,7 +13,7 @@ #include <pthread.h> #include <sched.h> - +#include <inttypes.h> #define CONFIGURE_INIT #include "system.h" #include <errno.h> @@ -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" PRIx32 "\n", (uint32_t)Init_id ); /* exercise init and destroy */ diff --git a/testsuites/psxtests/psx08/init.c b/testsuites/psxtests/psx08/init.c index 7517fab..9721fe2 100644 --- a/testsuites/psxtests/psx08/init.c +++ b/testsuites/psxtests/psx08/init.c @@ -14,6 +14,7 @@ #define CONFIGURE_INIT #include "system.h" #include <errno.h> +#include <inttypes.h> void *POSIX_Init( void *argument @@ -31,7 +32,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" PRIx32 "\n", (uint32_t)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..425b8b8 100644 --- a/testsuites/psxtests/psx09/init.c +++ b/testsuites/psxtests/psx09/init.c @@ -17,6 +17,7 @@ #include "system.h" #include <errno.h> #include "pritime.h" +#include <inttypes.h> void print_schedparam( char *prefix, @@ -70,7 +71,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" PRIx32 "\n", (uint32_t)Init_id ); /* try to use this thread as a sporadic server */ diff --git a/testsuites/psxtests/psx10/init.c b/testsuites/psxtests/psx10/init.c index f0a4e44..a8f571a 100644 --- a/testsuites/psxtests/psx10/init.c +++ b/testsuites/psxtests/psx10/init.c @@ -14,7 +14,7 @@ #define CONFIGURE_INIT #include "system.h" #include <sched.h> - +#include <inttypes.h> void *POSIX_Init( void *argument diff --git a/testsuites/psxtests/psx10/task.c b/testsuites/psxtests/psx10/task.c index 4a93144..c1ff1d9 100644 --- a/testsuites/psxtests/psx10/task.c +++ b/testsuites/psxtests/psx10/task.c @@ -18,7 +18,7 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif - +#include <inttypes.h> #include "system.h" void *Task_1( @@ -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" PRIx32 "\n", (uint32_t)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..7ab2339 100644 --- a/testsuites/psxtests/psx10/task2.c +++ b/testsuites/psxtests/psx10/task2.c @@ -20,6 +20,7 @@ #endif #include "system.h" +#include <inttypes.h> void *Task_2( void *argument @@ -28,7 +29,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" PRIx32 "\n", (uint32_t)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..2df001e 100644 --- a/testsuites/psxtests/psx10/task3.c +++ b/testsuites/psxtests/psx10/task3.c @@ -20,6 +20,7 @@ #endif #include "system.h" +#include <inttypes.h> void *Task_3( void *argument @@ -28,7 +29,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" PRIx32 "\n", (uint32_t)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..6c13a73 100644 --- a/testsuites/psxtests/psx11/init.c +++ b/testsuites/psxtests/psx11/init.c @@ -16,6 +16,7 @@ #define CONFIGURE_INIT #include "system.h" #include <errno.h> +#include <inttypes.h> void *POSIX_Init( void *argument @@ -38,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" PRIx32 "\n", (uint32_t)Init_id ); /* exercise pthread_setschedparam */ diff --git a/testsuites/psxtests/psx12/init.c b/testsuites/psxtests/psx12/init.c index 71e0b96..dece400 100644 --- a/testsuites/psxtests/psx12/init.c +++ b/testsuites/psxtests/psx12/init.c @@ -16,6 +16,7 @@ #define CONFIGURE_INIT #include "system.h" #include <errno.h> +#include <inttypes.h> #include "pritime.h" void print_schedparam( @@ -60,7 +61,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" PRIx32 "\n", (uint32_t)Init_id ); /* invalid scheduling policy error */ diff --git a/testsuites/psxtests/psxalarm01/init.c b/testsuites/psxtests/psxalarm01/init.c index be3b4a6..bd25abd 100644 --- a/testsuites/psxtests/psxalarm01/init.c +++ b/testsuites/psxtests/psxalarm01/init.c @@ -15,6 +15,7 @@ #include <signal.h> #include <errno.h> +#include <inttypes.h> /* forward declarations to avoid warnings */ void *POSIX_Init(void *argument); @@ -34,9 +35,9 @@ void Signal_handler( { Signal_count++; printf( - "Signal: %d caught by 0x%" PRIxpthread_t " (%d)\n", + "Signal: %d caught by 0x%" PRIx32 " (%d)\n", signo, - pthread_self(), + (uint32_t)pthread_self(), Signal_count ); Signal_occurred = 1; @@ -50,9 +51,9 @@ void Signal_info_handler( { Signal_count++; printf( - "Signal_info: %d caught by 0x%" PRIxpthread_t " (%d) si_signo= %d si_code= %d value= %d\n", + "Signal_info: %d caught by 0x%" PRIx32 " (%d) si_signo= %d si_code= %d value= %d\n", signo, - pthread_self(), + (uint32_t)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..63f48c5 100644 --- a/testsuites/psxtests/psxbarrier01/test.c +++ b/testsuites/psxtests/psxbarrier01/test.c @@ -19,6 +19,7 @@ /* #define __USE_XOPEN2K XXX already defined on GNU/Linux */ #include <pthread.h> +#include <inttypes.h> #include "tmacros.h" @@ -32,9 +33,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" PRIx32 "\n", (uint32_t)id ); status = pthread_barrier_wait( &Barrier ); - printf( "pthread_barrier_wait - 0x%08" PRIxpthread_t " released\n", id ); + printf( "pthread_barrier_wait - 0x%08" PRIx32 " released\n", (uint32_t)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..7c106be 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" PRIoMAX "\n", (uintmax_t)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 %" PRIxMAX "\n", (uintmax_t)buf->st_blksize ); + printf( "....st_blocks %" PRIxMAX "\n", (uintmax_t)buf->st_blocks ); } void stat_a_file( diff --git a/testsuites/psxtests/psxfile02/init.c b/testsuites/psxtests/psxfile02/init.c index c663981..db54956 100644 --- a/testsuites/psxtests/psxfile02/init.c +++ b/testsuites/psxtests/psxfile02/init.c @@ -25,7 +25,7 @@ #include <rtems.h> #include <rtems/libio.h> - +#include <inttypes.h> #include <tmacros.h> #include "test_support.h" diff --git a/testsuites/psxtests/psxkey01/init.c b/testsuites/psxtests/psxkey01/init.c index e63407c..db8480f 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" PRIx32 "\n", (uint32_t)Init_id ); rtems_workspace_greedy_allocate( NULL, 0 ); diff --git a/testsuites/psxtests/psxkey01/task.c b/testsuites/psxtests/psxkey01/task.c index 4f83ebe..cfa0b11 100644 --- a/testsuites/psxtests/psxkey01/task.c +++ b/testsuites/psxtests/psxkey01/task.c @@ -22,6 +22,7 @@ #include "system.h" #include <errno.h> +#include <inttypes.h> void *Task_1( void *arg @@ -31,7 +32,7 @@ void *Task_1( int status; uint32_t *key_data; - printf( "Thread 0x%08" PRIxpthread_t "\n", id ); + printf( "Thread 0x%08" PRIx32 "\n", (uint32_t)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..1e5dae0 100644 --- a/testsuites/psxtests/psxmsgq02/init.c +++ b/testsuites/psxtests/psxmsgq02/init.c @@ -15,6 +15,7 @@ #include "system.h" #include <errno.h> #include "tmacros.h" +#include <inttypes.h> #include <mqueue.h> #include <sched.h> #include <fcntl.h> @@ -45,7 +46,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" PRIx32 "\n", (uint32_t)Init_id ); rtems_workspace_greedy_allocate( NULL, 0 ); diff --git a/testsuites/psxtests/psxsignal01/init.c b/testsuites/psxtests/psxsignal01/init.c index 2e5925d..fc0b8b8 100644 --- a/testsuites/psxtests/psxsignal01/init.c +++ b/testsuites/psxtests/psxsignal01/init.c @@ -16,6 +16,7 @@ #include <signal.h> #include <errno.h> #include <reent.h> +#include <inttypes.h> /* forward declarations to avoid warnings */ int test_main(void); @@ -40,9 +41,9 @@ void Handler_1( { Signal_count++; printf( - "Handler_1: Signal: %d caught by 0x%" PRIxpthread_t " (%d)\n", + "Handler_1: Signal: %d caught by 0x%" PRIx32 " (%d)\n", signo, - pthread_self(), + (uint32_t)pthread_self(), Signal_count ); Signal_occurred = 1; @@ -54,9 +55,9 @@ void Signal_handler( { Signal_count++; printf( - "Signal: %d caught by 0x%"PRIxpthread_t " (%d)\n", + "Signal: %d caught by 0x%"PRIx32 " (%d)\n", signo, - pthread_self(), + (uint32_t)pthread_self(), Signal_count ); Signal_occurred = 1; @@ -70,9 +71,9 @@ void Signal_info_handler( { Signal_count++; printf( - "Signal_info: %d caught by 0x%" PRIxpthread_t " (%d) si_signo= %d si_code= %d value= %d\n", + "Signal_info: %d caught by 0x%" PRIx32 " (%d) si_signo= %d si_code= %d value= %d\n", signo, - pthread_self(), + (uint32_t)pthread_self(), Signal_count, info->si_signo, info->si_code, @@ -113,7 +114,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" PRIx32 "\n", (uint32_t)Init_id ); Signal_occurred = 0; Signal_count = 0; diff --git a/testsuites/psxtests/psxstat/test.c b/testsuites/psxtests/psxstat/test.c index f072eab..2a9610a 100644 --- a/testsuites/psxtests/psxstat/test.c +++ b/testsuites/psxtests/psxstat/test.c @@ -34,6 +34,7 @@ #include <rtems/libio.h> #include <rtems/imfs.h> #include <pmacros.h> +#include <inttypes.h> #include "primode.h" @@ -235,7 +236,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 %" PRIoMAX "\n", (uintmax_t)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 +245,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 %" PRIxMAX "\n", (uintmax_t)statbuf.st_blksize ); + printf( "...st_blocks %" PRIxMAX "\n", (uintmax_t)statbuf.st_blocks ); } } diff --git a/testsuites/psxtests/psxualarm/init.c b/testsuites/psxtests/psxualarm/init.c index 19c9e44..83555cf 100644 --- a/testsuites/psxtests/psxualarm/init.c +++ b/testsuites/psxtests/psxualarm/init.c @@ -16,6 +16,7 @@ #include <signal.h> #include <unistd.h> #include <errno.h> +#include <inttypes.h> /* forward declarations to avoid warnings */ void Signal_handler(int signo); @@ -37,9 +38,9 @@ void Signal_handler( { Signal_count++; printf( - "Signal: %d caught by 0x%" PRIxpthread_t " (%d)\n", + "Signal: %d caught by 0x%" PRIx32 " (%d)\n", signo, - pthread_self(), + (uint32_t)pthread_self(), Signal_count ); Signal_occurred = 1; @@ -75,7 +76,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" PRIx32 "\n", (uint32_t)Init_id ); Signal_occurred = 0; Signal_count = 0; -- 1.8.1.2 From 3cae9ea8684c9e3b09cf2dcab5306a0dfc00f186 Mon Sep 17 00:00:00 2001 From: Cynthia Rempel <cynt...@rtems.org> Date: Wed, 21 Aug 2013 22:19:56 -0700 Subject: [PATCH 2/2] Deprecating some non-compliant printf format specifiers --- testsuites/psxtests/include/pmacros.h | 8 ++++++++ testsuites/support/include/tmacros.h | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/testsuites/psxtests/include/pmacros.h b/testsuites/psxtests/include/pmacros.h index 87481a1..258ee60 100644 --- a/testsuites/psxtests/include/pmacros.h +++ b/testsuites/psxtests/include/pmacros.h @@ -99,6 +99,10 @@ #error "unsupported size of off_t" #endif +/** + * @deprecated as of version 4.11: PRIxblksize_t is not in + * http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/inttypes.h.html + */ #if SIZEOF_BLKSIZE_T == 8 #define PRIxblksize_t PRIx64 #elif SIZEOF_BLKSIZE_T == 4 @@ -109,6 +113,10 @@ #define PRIxblksize_t "lx" #endif +/** + * @deprecated as of version 4.11: PRIxblkcnt_t is not in + * http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/inttypes.h.html + */ #if SIZEOF_BLKSIZE_T == 8 #define PRIxblkcnt_t PRIx64 #elif SIZEOF_BLKSIZE_T == 4 diff --git a/testsuites/support/include/tmacros.h b/testsuites/support/include/tmacros.h index c8ace40..307fcb0 100644 --- a/testsuites/support/include/tmacros.h +++ b/testsuites/support/include/tmacros.h @@ -289,6 +289,10 @@ extern "C" { /* HACK: newlib defines pthread_t as a typedef to __uint32_t */ /* HACK: There is no portable way to print pthread_t's */ +/** + * @deprecated as of version 4.11: PRIxpthread_t is not in + * http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/inttypes.h.html + */ #define PRIxpthread_t PRIx32 /* rtems_signal_set is a typedef to uint32_t */ -- 1.8.1.2
_______________________________________________ rtems-devel mailing list rtems-devel@rtems.org http://www.rtems.org/mailman/listinfo/rtems-devel