On 9/4/2014 11:21 AM, Gedare Bloom wrote: > On Wed, Sep 3, 2014 at 11:26 AM, Joel Sherrill > <joel.sherr...@oarcorp.com> wrote: >> --- >> cpukit/libfs/src/rfs/rtems-rfs-buffer.c | 5 ++--- >> 1 file changed, 2 insertions(+), 3 deletions(-) >> >> diff --git a/cpukit/libfs/src/rfs/rtems-rfs-buffer.c >> b/cpukit/libfs/src/rfs/rtems-rfs-buffer.c >> index 3d89f5f..4192b21 100644 >> --- a/cpukit/libfs/src/rfs/rtems-rfs-buffer.c >> +++ b/cpukit/libfs/src/rfs/rtems-rfs-buffer.c >> @@ -52,13 +52,12 @@ rtems_rfs_scan_chain (rtems_chain_control* chain, >> buffer = (rtems_rfs_buffer*) node; >> >> if (rtems_rfs_trace (RTEMS_RFS_TRACE_BUFFER_CHAINS)) >> - printf ("%" PRIuPTR " ", ((intptr_t) buffer->user)); >> + printf ("%p ", buffer->user); >> >> if (((rtems_rfs_buffer_block) ((intptr_t)(buffer->user))) == block) >> { >> if (rtems_rfs_trace (RTEMS_RFS_TRACE_BUFFER_CHAINS)) >> - printf (": found block=%" PRIuPTR "\n", >> - ((intptr_t)(buffer->user))); >> + printf (": found block=%p\n", buffer->user); > What is the warning this fixed? The "PRIuPTR" should be the right way > to print an (unsigned) pointer. Perhaps changing the cast to > (uintptr_t) would fix the warning? log/moxie-moxiesim.log:../../../../../../rtems/c/src/../../cpukit/libfs/src/rfs/rtems-rfs-buffer.c:55:7: warning: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'long int' [-Wformat=] log/moxie-moxiesim.log:../../../../../../rtems/c/src/../../cpukit/libfs/src/rfs/rtems-rfs-buffer.c:55:7: warning: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'long int' [-Wformat=] log/moxie-moxiesim.log:../../../../../../rtems/c/src/../../cpukit/libfs/src/rfs/rtems-rfs-buffer.c:61:17: warning: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'long int' [-Wformat=] log/moxie-moxiesim.log:../../../../../../rtems/c/src/../../cpukit/libfs/src/rfs/rtems-rfs-buffer.c:61:17: warning: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'long int' [-Wformat=]
This seems to have happened on bfin, h8300, i386, m32r, m68k and moxie. Casting it to a uintptr_t on moxie change it to this: ../../../../../../rtems/c/src/../../cpukit/libfs/src/rfs/rtems-rfs-buffer.c:55:7: warning: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=] printf ("%" PRIuPTR " ", ((uintptr_t) buffer->user)); Checking the preprocessor output, I see: typedef long int __intptr_t; typedef long unsigned int __uintptr_t; inttypes.h has this: #if PTRDIFF_MAX <= __INTTYPES_EXP(INT_MAX) # define __PRIPTR(x) __STRINGIFY(x) # define __SCNPTR(x) __STRINGIFY(x) #elif PTRDIFF_MAX <= __INTTYPES_EXP(LONG_MAX) || !defined(__have_longlong64) ... I checked PTRDIFF_MAX and INT_MAX and they are equal. They are also equal on arm-rtems4.11-gcc which does not produce this warning. I changed that to a < (not <=), the format became "%lu", and the warning went away. Checking Linux on Centos, it is lu if 32 bit and llu if 64 bit. The RTEMS inttypes.h is unique to us. I am wondering if changing the <= on both those checks is desirable. This could just be a bug in inttypes.h Any thoughts? >> (*count)--; >> rtems_chain_extract_unprotected (node); >> -- >> 1.9.3 >> >> _______________________________________________ >> devel mailing list >> devel@rtems.org >> http://lists.rtems.org/mailman/listinfo/devel -- Joel Sherrill, Ph.D. Director of Research & Development joel.sherr...@oarcorp.com On-Line Applications Research Ask me about RTEMS: a free RTOS Huntsville AL 35805 Support Available (256) 722-9985 _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel