<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 6, 2017 at 5:37 PM, Gedare Bloom <span dir="ltr"><<a href="mailto:gedare@rtems.org" target="_blank">gedare@rtems.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Thu, Apr 6, 2017 at 6:30 PM, Joel Sherrill <<a href="mailto:joel@rtems.org">joel@rtems.org</a>> wrote:<br>
> Following up on my own post. You can avoid some casts.<br>
> This is also an example of how pulling a thread can lead<br>
> somewhere more complicated. :)<br>
><br>
> %z should work portably for size_t and should avoid a cast.<br>
><br>
> libdl already has this in libdl/rtl-shell.c which tries to provide a<br>
> C99 inttypes.h like constant.<br>
><br>
> if defined(__moxie__)<br>
> #define PRIdoff_t PRIo32<br>
> #else<br>
> #define PRIdoff_t PRIo64<br>
> #endif<br>
><br>
> Unfortunately, there is something similar defined in<br>
> testsuites/psxtests/include/<wbr>pmacros.h which looks to be<br>
> better done.<br>
><br>
> Searching in cpukit for similar code turns up a number of<br>
> other types and repetitions.<br>
><br>
> grep -r "#define PRI" . | grep -v PRIORITY | grep -v PRINT<br>
><br>
> I would suggest the more elegant solution for the PRI constant<br>
> off_t, time_t, and mode_t would be<br>
> cpukit/include/rtems/inttypes_<wbr>extensions.h<br>
> and that the best of all the duplicated definitions be moved there.<br>
> That centralizes them and them everyone uses the same ones.<br>
><br>
</span>It would be good to consolidate these. I'd suggest it comes in through<br>
#include <rtems/inttypes.h><br>
without the _extensions bit is unnecessary if this is part of the<br>
"RTEMS" headers.<br>
<br>
I think there are some problems with _ in file names for some platforms?<br>
<span class=""><br>
> I suspect that many of the remaining printf format warnings can then<br>
> be resolved using these helpers or by adding more.<br>
><br>
</span>Yes, and the rtems/inttypes.h should ideally pull in "Standard"<br>
inttypes.h and then extends them.<br>
<br>
This would be my preference.<br>
<div class="HOEnZb"><div class="h5"><br></div></div></blockquote><div><br></div><div>Fine by me. I was toying with the same name and include idea.</div><div><br></div><div>If we had been in a conference room, it would have taken 30 seconds</div><div>to agree. :)</div><div><br></div><div>--joel</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">
> This idea needs a review and approval by at least one other<br>
> developer. Especially the file name.<br>
><br>
> --joel<br>
><br>
><br>
> On Thu, Apr 6, 2017 at 4:10 PM, Cillian O'Donnell <<a href="mailto:cpodonnell8@gmail.com">cpodonnell8@gmail.com</a>><br>
> wrote:<br>
>><br>
>> 2 of the warnings cropped up on further testing of other BSPs. Sorry,<br>
>> 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*<br>
>> 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]<br>
>> 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]<br>
>> 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*<br>
>> 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<br>
>> cache=[%d,%d] dist=%d\n",<br>
>> -              fd, (int) offset + buffer_offset, (int) buffer_offset,<br>
>> (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<br>
>> read=%d cache=[%d,%llu] dist=%llu\n",<br>
>> +              fd, offset + buffer_offset, (unsigned long) buffer_offset,<br>
>> (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>
>> --<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>
><br>
><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>
</div></div></blockquote></div><br></div></div>