[patch] 1.11.0.svn: compiler warnings when building for i386 arch

Denys Vlasenko vda.linux at googlemail.com
Mon May 12 14:38:38 UTC 2008


On Friday 09 May 2008 23:42, Cristian Ionescu-Idbohrn wrote:
> > > BTW: do you pass additional -Wsomething to the build?
> > > It makes sense to add it permanently to build system,
> > > this will prevent people from introducing these warnings again.
> >
> > This comes from -Wall (see attached).

When the tree will build cleanly with -Wall, we should add it to CFLAGS.

> Catched a few more (attached).  Please review.

-               rr = getsockopt(netfd, IPPROTO_IP, IP_OPTIONS, optbuf, &x);
+               rr = getsockopt(netfd, IPPROTO_IP, IP_OPTIONS, optbuf, (socklen_t *)&x);

This is wrong. You need to change x from int to socklen_t instead.

-               io_hdr.cmdp = (char*)sg_commands[i];
+               io_hdr.cmdp = (unsigned char *)sg_commands[i];

Since type of cmdp ptr is buried in some header file, I typically
just cast to (void*) - it is compatible with any pointer.

> Some still lurcking around.  The big chunk are the
> get_terminal_width_height related along whith these two:
> 
> archival/libunarchive/get_header_tar.c: In function 'get_header_tar':
> archival/libunarchive/get_header_tar.c:148: warning: comparison is always
> false due to limited range of data type

Which line is it? In my tree, line 148 is this one:

#if ENABLE_FEATURE_TAR_GZIP
                if (tar.name[0] == 0x1f && tar.name[1] == 0x8b) { /* gzip */
                        get_header_ptr = get_header_tar_gz;
                } else <============================ LINE 148
#endif


Patch is applied with minor corrections, thanks.
--
vda



More information about the busybox mailing list