Re: The great alpha compile warning hunt

Riley Williams (rhw@MemAlpha.CX)
Fri, 23 Jul 1999 14:04:14 +0100 (GMT)


Hi Sean.

> I'm busy trying to track down and eliminate a stack of warnings
> from kernel compiles on Alpha. As you know, a lot of these are
> trivial warnings just caused by people making intel assumptions.

> 1) size_t == int

> This causes a lot of "int format, different argument" warnings
> in printk's. While I know that they're not that important, I'd
> like not to see these if possible.

> What's the normal way to fix these sorts of things? Is an
> explicit cast eg:

> diff -ur linux.vanilla/fs/nfs/nfs2xdr.c linux/fs/nfs/nfs2xdr.c
> --- linux.vanilla/fs/nfs/nfs2xdr.c Wed Jul 21 12:05:32 1999
> +++ linux/fs/nfs/nfs2xdr.c Wed Jul 21 10:40:29 1999
> @@ -446,7 +446,7 @@
> "NFS: server %s, readdir reply truncated\n",
> clnt->cl_server);
> printk(KERN_WARNING "NFS: nr=%d, slots=%d, len=%d\n",
> - nr, (end - p), len);
> + nr, (int)(end - p), len);
> clnt->cl_flags |= NFS_CLNTF_BUFSIZE;
> break;

> ...the approved method? I think this is quite ugly, but have
> done it for all the offending printk's in my config.

Something along those lines is the usual answer, but one has to
remember that size_t is not always smaller than int in range...

> 2)Similar problems with long int format being passed an int arg.
> Such as:

> diff -ur linux.vanilla/fs/nfsd/export.c linux/fs/nfsd/export.c
> --- linux.vanilla/fs/nfsd/export.c Tue Dec 29 19:42:25 1998
> +++ linux/fs/nfsd/export.c Wed Jul 21 11:48:09 1999
> @@ -236,7 +236,7 @@
>
> dprintk("exp_export called for %s:%s (%x/%ld fl %x).\n",
> nxp->ex_client, nxp->ex_path,
> - nxp->ex_dev, nxp->ex_ino, nxp->ex_flags);
> + nxp->ex_dev, (long)nxp->ex_ino, nxp->ex_flags);
> dev = to_kdev_t(nxp->ex_dev);
> ino = nxp->ex_ino;

> What do you think? I have patched my kernel to do these casts,
> with (seemingly) no problems. If there's a "right way" to do
> it, I'd like to do it and submit my "warning-squash" patch in
> its entirety.

Normally, one has to check which size of int the various *_t formats
are compatible with on a specific architecture, then use the cast
appropriate to that - I don't know of any other way of getting rid of
those warnings.

That's fairly easy to do in the architecture-specific source files,
but considerably harder in the rest. For that reason, I would normally
recommend just using (long) throughout the latter...

> If I'm wasting my time, do say.

If there are messages which are printing the wrong values due to size
misalignments, they need to be tracked down on ALL architectures in my
humble opinion...

Best wishes from Riley.

+----------------------------------------------------------------------+
| There is something frustrating about the quality and speed of Linux |
| development, ie., the quality is too high and the speed is too high, |
| in other words, I can implement this XXXX feature, but I bet someone |
| else has already done so and is just about to release their patch. |
+----------------------------------------------------------------------+
* ftp://ftp.MemAlpha.cx/pub/rhw/Linux
* http://www.MemAlpha.cx/kernel.versions.html

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/