Posix Tests Compiler Warnings
joel.sherrill at OARcorp.com
Wed Aug 21 16:45:36 UTC 2013
On 8/21/2013 7:59 AM, Gedare Bloom wrote:
> 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.
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:
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
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.
> On Wed, Aug 21, 2013 at 12:33 AM, Rempel, Cynthia
> <cynt6007 at vandals.uidaho.edu> wrote:
>> Reducing the number of unnecessary compiler warnings makes it easier to find (and fix) real compiler warnings...
>> The fix is in accordance with:
>> 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...
>> Cynthia Rempel
>> rtems-devel mailing list
>> rtems-devel at rtems.org
> rtems-devel mailing list
> rtems-devel at rtems.org
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...
More information about the devel