Posix Tests Compiler Warnings

Joel Sherrill joel.sherrill at OARcorp.com
Wed Aug 21 16:45:36 UTC 2013


On 8/21/2013 7:59 AM, Gedare Bloom wrote:
> Hi,
>
> The documentation you pointed to is the Linux kernel doc, which are
> not entirely relevant for RTEMS. Is there a POSIX standard that
> governs this issue?
Well... the basic types are covered by inttypes.h which is POSIX and
the link I posted covers.  That file is in newlib.

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

inttypes.h itself is (more than likely) correct.

As an aside, inttypes.h prototypes four methods. newlib does not
have implementations of them.  I started a discussion on adding them
and this is the thread:

http://sourceware.org/ml/newlib/2013/msg00626.html

Corinna Vinschenproposed a rather elegant solution which would provide
them as aliases for existing routines. Then the documentation for each
would have to be added.

If you are working in this area, this is a good thing to touch on.
> This looks like mostly converting pointer types to long unsigned int?
> Some of the changes seem like they should not be necessary, like:
> -    printf(  "...st_blksize %" PRIxblksize_t "\n", statbuf.st_blksize );
> -    printf(  "...st_blocks  %" PRIxblkcnt_t "\n", statbuf.st_blocks );
> +    printf(  "...st_blksize %" PRIxblksize_t "\n", (long unsigned
> int)statbuf.st_blksize );
> +    printf(  "...st_blocks  %" PRIxblkcnt_t "\n", (long unsigned
> int)statbuf.st_blocks );
These are NOT covered by the POSIX inttypes.h. I see one of them
defined in ./testsuites/psxtests/include/pmacros.h. So they are
test support and logically extend the type specific print specifiers
in inttypes.h.  Apparently some of them are wrong.

If you eliminate the warning on sparc or powerpc, then that will
likely cover most targets. But if the underlying type varies based
on target architecture, then you will have to check it on the
varying architectures.

Should be a series of one-line fixes which don't reflect the mental
power required to solve. :)
> Here the printf already should accommodate the size of the type of the
> blksize_t and blkcnt_t. This is how I usually see this issue of
> variably-sized types being printed. I don't know the right answer.
>
> -Gedare
>
> On Wed, Aug 21, 2013 at 12:33 AM, Rempel, Cynthia
> <cynt6007 at vandals.uidaho.edu> wrote:
>> Hi,
>>
>> Reducing the number of unnecessary compiler warnings makes it easier to find (and fix) real compiler warnings...
>>
>> The fix is in accordance with:
>>
>> https://www.kernel.org/doc/Documentation/printk-formats.txt
>> If <type> is dependent on a config option for its size (e.g., sector_t,
>> blkcnt_t) or is architecture-dependent for its size (e.g., tcflag_t), use a
>> format specifier of its largest possible type and explicitly cast to it.
>>
>> This patch reduces the number of posix tests compiler warnings, by recasting arguments in printf statements...
>>
>> Thanks,
>> Cynthia Rempel
>> _______________________________________________
>> rtems-devel mailing list
>> rtems-devel at rtems.org
>> http://www.rtems.org/mailman/listinfo/rtems-devel
>>
> _______________________________________________
> rtems-devel mailing list
> rtems-devel at rtems.org
> http://www.rtems.org/mailman/listinfo/rtems-devel


-- 
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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20130821/0a303840/attachment-0001.html>


More information about the devel mailing list