[OpenBIOS] Removing warnings

Blue Swirl blauwirbel at gmail.com
Sun Jan 11 15:21:56 CET 2009


On 1/11/09, Laurent Vivier <laurent at lvivier.info> wrote:
>
>  Le 11 janv. 09 à 14:40, Blue Swirl a écrit :
>
>
> > On 1/11/09, Laurent Vivier <laurent at lvivier.info> wrote:
> >
> > > Hi,
> > >
> > > I don't like to have warnings in build.log, but sometime I don't
> remember
> > > to check the logs.
> > >
> > > I'm wondering if it is acceptable to add "-Werror" in CCFLAGS ?
> > >
> >
> > There are still some strange warnings on amd64 build:
> >
> > kernel/bootstrap.c: In function 'segv_handler':
> > kernel/bootstrap.c:799: warning: format '%llx' expects type 'long long
> > unsigned int', but argument 4 has type 'cell'
> > kernel/bootstrap.c:799: warning: format '%llx' expects type 'long long
> > unsigned int', but argument 5 has type 'ucell'
> > kernel/bootstrap.c:799: warning: format '%llx' expects type 'long long
> > unsigned int', but argument 6 has type 'long unsigned int'
> > kernel/bootstrap.c:801: warning: format '%llx' expects type 'long long
> > unsigned int', but argument 4 has type 'ucell'
> > kernel/bootstrap.c: In function 'exception':
> > kernel/bootstrap.c:839: warning: format '%lld' expects type 'long long
> > int', but argument 2 has type 'cell'
> >
> > kernel/dict.c: In function 'dump_header':
> > kernel/dict.c:122: warning: format '%0llx' expects type 'long long
> > unsigned int', but argument 2 has type 'ucell'
> >
> > kernel/stack.c: In function 'printdstack':
> > kernel/stack.c:28: warning: format '%llx' expects type 'long long
> > unsigned int', but argument 2 has type 'long int'
> >
> > kernel/stack.c: In function 'printrstack':
> > kernel/stack.c:39: warning: format '%llx' expects type 'long long
> > unsigned int', but argument 2 has type 'long int'
> >
> > kernel/dict.c: In function 'dump_header':
> > kernel/dict.c:122: warning: format '%0llx' expects type 'long long
> > unsigned int', but argument 2 has type 'ucell'
> >
> > This is because FMT_CELL does not match what is needed to print
> > uint64_t (defined by host headers for bootstrap and by our headers for
> > target compile). It's a bit tricky to get it right, I thought I fixed
> > it already.
> >
>
>  The reason is:
>
>  $ gdb obj-amd64/host/kernel/bootstrap.o
>  GNU gdb 6.8-debian
>  Copyright (C) 2008 Free Software Foundation, Inc.
>  License GPLv3+: GNU GPL version 3 or later
> <http://gnu.org/licenses/gpl.html>
>  This is free software: you are free to change and redistribute it.
>  There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
>  and "show warranty" for details.
>  This GDB was configured as "x86_64-linux-gnu"...
>  (gdb) whatis dicthead
>  type = cell
>  (gdb) whatis ucell
>  type = uint64_t
>  (gdb) whatis uint64_t
>  type = long unsigned int
>
>  FMT_CELL_x must be "lx" not "llx"

For cross-compiled part or native 64 bit build, yes. But then there is
the host bootstrap which uses stdint.h, which can define uint64_t
other ways. Host compiler can be 32-bit and then we'd need long long
instead of long.

Maybe we should use PRIx64 (like Qemu), defined in by system headers
for bootstrap and by cross.h for cross-compiled part?

Or could we avoid using system stdint.h completely?


More information about the OpenBIOS mailing list