[PATCH] Update:Change format specifiers to fix 4 warnings.

Joel Sherrill joel at rtems.org
Thu Apr 6 21:42:29 UTC 2017


Thanks.

I am rebuilding all my tools so am not in a position to start a test of this
until in the morning.

I am not saying your patch is wrong. But speaking from experience, the
answer to portable warning free printf() formats is often inttypes.h.
Especially
if some have system types or are like uintXX_t.

http://pubs.opengroup.org/onlinepubs/009695399/basedefs/inttypes.h.html

This is a fairly unknown feature of C99.  A pretty good discussion is here:

http://stackoverflow.com/questions/6299323/good-introduction-to-inttypes-h

If you use the right PRI constant and it doesn't clear up warnings on
all architectures, it is a bug in the toolset.

--joel


On Thu, Apr 6, 2017 at 4:10 PM, Cillian O'Donnell <cpodonnell8 at gmail.com>
wrote:

> 2 of the warnings cropped up on further testing of other BSPs. Sorry,
> should of been more careful.
> Also git send-email format.
> ---
>  cpukit/libdl/rtl-obj-cache.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/cpukit/libdl/rtl-obj-cache.c b/cpukit/libdl/rtl-obj-cache.c
> index a4676cf..d3cd953 100644
> --- a/cpukit/libdl/rtl-obj-cache.c
> +++ b/cpukit/libdl/rtl-obj-cache.c
> @@ -78,11 +78,11 @@ rtems_rtl_obj_cache_read (rtems_rtl_obj_cache_t* cache,
>    struct stat sb;
>
>    if (rtems_rtl_trace (RTEMS_RTL_TRACE_CACHE))
> -    printf ("rtl: cache: %2d: fd=%d offset=%d length=%d area=[%d,%d]
> cache=[%d,%d] size=%d\n",
> -            fd, cache->fd, (int) offset, (int) *length,
> -            (int) offset, (int) offset + *length,
> -            (int) cache->offset, (int) cache->offset + cache->level,
> -            (int) cache->file_size);
> +    printf ("rtl: cache: %2d: fd=%d offset=%llu length=%d area=[%d,%llu]
> cache=[%llu,%llu] size=%lu\n",
> +            fd, cache->fd, offset, (int) *length,
> +            (int) offset, offset + *length,
> +            cache->offset, cache->offset + cache->level,
> +            (unsigned long) cache->file_size);
>
>    if (*length > cache->size)
>    {
> @@ -172,10 +172,10 @@ rtems_rtl_obj_cache_read (rtems_rtl_obj_cache_t*
> cache,
>      }
>
>      if (rtems_rtl_trace (RTEMS_RTL_TRACE_CACHE))
> -      printf ("rtl: cache: %2d: seek: offset=%d buffer_offset=%d read=%d
> cache=[%d,%d] dist=%d\n",
> -              fd, (int) offset + buffer_offset, (int) buffer_offset,
> (int) buffer_read,
> -              (int) offset, (int) offset + buffer_read,
> -              (int) (cache->file_size - offset));
> +      printf ("rtl: cache: %2d: seek: offset=%llu buffer_offset=%lu
> read=%d cache=[%d,%llu] dist=%llu\n",
> +              fd, offset + buffer_offset, (unsigned long) buffer_offset,
> (int) buffer_read,
> +              (int) offset, offset + buffer_read,
> +              (cache->file_size - offset));
>
>      if (lseek (fd, offset + buffer_offset, SEEK_SET) < 0)
>      {
> --
> 2.7.4
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20170406/05a3ded8/attachment-0002.html>


More information about the devel mailing list