<div dir="ltr">Following up on my own post. You can avoid some casts. <div>This is also an example of how pulling a thread can lead </div><div>somewhere more complicated. :)<br><div><br></div><div>%z should work portably for size_t and should avoid a cast.</div><div><br></div><div>libdl already has this in libdl/rtl-shell.c which tries to provide a</div><div>C99 inttypes.h like constant.</div><div><div><br></div><div><div>if defined(__moxie__)</div><div>#define PRIdoff_t PRIo32</div><div>#else</div><div>#define PRIdoff_t PRIo64</div><div>#endif</div></div><div><br></div><div>Unfortunately, there is something similar defined in </div><div>testsuites/psxtests/include/pmacros.h which looks to be</div><div>better done.</div><div><br></div><div>Searching in cpukit for similar code turns up a number of</div><div>other types and repetitions.</div><div><br></div><div><div>grep -r "#define PRI" . | grep -v PRIORITY | grep -v PRINT</div></div><div><br></div><div>I would suggest the more elegant solution for the PRI constant</div><div>off_t, time_t, and mode_t would be cpukit/include/rtems/inttypes_extensions.h</div><div>and that the best of all the duplicated definitions be moved there.</div><div>That centralizes them and them everyone uses the same ones.</div><div><br></div><div>I suspect that many of the remaining printf format warnings can then</div><div>be resolved using these helpers or by adding more.</div><div><br></div><div>This idea needs a review and approval by at least one other</div><div>developer. Especially the file name.</div><div><br></div><div>--joel</div><div><br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 6, 2017 at 4:10 PM, Cillian O'Donnell <span dir="ltr"><<a href="mailto:cpodonnell8@gmail.com" target="_blank">cpodonnell8@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">2 of the warnings cropped up on further testing of other BSPs. Sorry, should of been more careful.<br>
Also git send-email format.<br>
---<br>
 cpukit/libdl/rtl-obj-cache.c | 18 +++++++++---------<br>
 1 file changed, 9 insertions(+), 9 deletions(-)<br>
<br>
diff --git a/cpukit/libdl/rtl-obj-cache.c b/cpukit/libdl/rtl-obj-cache.c<br>
index a4676cf..d3cd953 100644<br>
--- a/cpukit/libdl/rtl-obj-cache.c<br>
+++ b/cpukit/libdl/rtl-obj-cache.c<br>
@@ -78,11 +78,11 @@ rtems_rtl_obj_cache_read (rtems_rtl_obj_cache_t* cache,<br>
   struct stat sb;<br>
<br>
   if (rtems_rtl_trace (RTEMS_RTL_TRACE_CACHE))<br>
-    printf ("rtl: cache: %2d: fd=%d offset=%d length=%d area=[%d,%d] cache=[%d,%d] size=%d\n",<br>
-            fd, cache->fd, (int) offset, (int) *length,<br>
-            (int) offset, (int) offset + *length,<br>
-            (int) cache->offset, (int) cache->offset + cache->level,<br>
-            (int) cache->file_size);<br>
+    printf ("rtl: cache: %2d: fd=%d offset=%llu length=%d area=[%d,%llu] cache=[%llu,%llu] size=%lu\n",<br>
+            fd, cache->fd, offset, (int) *length,<br>
+            (int) offset, offset + *length,<br>
+            cache->offset, cache->offset + cache->level,<br>
+            (unsigned long) cache->file_size);<br>
<br>
   if (*length > cache->size)<br>
   {<br>
@@ -172,10 +172,10 @@ rtems_rtl_obj_cache_read (rtems_rtl_obj_cache_t* cache,<br>
     }<br>
<br>
     if (rtems_rtl_trace (RTEMS_RTL_TRACE_CACHE))<br>
-      printf ("rtl: cache: %2d: seek: offset=%d buffer_offset=%d read=%d cache=[%d,%d] dist=%d\n",<br>
-              fd, (int) offset + buffer_offset, (int) buffer_offset, (int) buffer_read,<br>
-              (int) offset, (int) offset + buffer_read,<br>
-              (int) (cache->file_size - offset));<br>
+      printf ("rtl: cache: %2d: seek: offset=%llu buffer_offset=%lu read=%d cache=[%d,%llu] dist=%llu\n",<br>
+              fd, offset + buffer_offset, (unsigned long) buffer_offset, (int) buffer_read,<br>
+              (int) offset, offset + buffer_read,<br>
+              (cache->file_size - offset));<br>
<br>
     if (lseek (fd, offset + buffer_offset, SEEK_SET) < 0)<br>
     {<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.7.4<br>
<br>
______________________________<wbr>_________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/<wbr>mailman/listinfo/devel</a><br>
</font></span></blockquote></div><br></div>