Posix Tests Compiler Warnings v2

Joel Sherrill joel.sherrill at OARcorp.com
Thu Aug 22 13:45:33 UTC 2013


On 8/22/2013 2:32 AM, Sebastian Huber wrote:
> On 2013-08-22 08:11, Rempel, Cynthia wrote:
>> @@ -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 );
> This fixes the warning, but it doesn't fix the root cause.  In tmacros.h we have
>
> /* HACK: newlib defines pthread_t as a typedef to __uint32_t */
> /* HACK: There is no portable way to print pthread_t's */
> #define PRIxpthread_t PRIx32
>
> The problem is that Newlibs __uint32_t is not the same type as uint32_t in general.
>
> I prefer to keep the warning until this Newlib inconsistency is fixed.
>
I personally like the type specific macros for printing. The whole point 
of typedefs
is to hide the underlying type.

Can we define PRIxpthread_t in a way that avoids the warning?
There is some code in configure.ac to probe the size of various types
and the results of this are used to define the PRIxxx constants for
those types. Can this be used?

AC_CHECK_SIZEOF([off_t])
AC_CHECK_SIZEOF([blksize_t])
AC_CHECK_SIZEOF([blkcnt_t])
AC_CHECK_SIZEOF([time_t])
AC_CHECK_SIZEOF([mode_t])


And why is it in tmacros.h and not pmacros.h? It is posix specific. :(

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill at OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985




More information about the devel mailing list