[RFC] Fix various compiler warning

Hans-Christian Egtvedt hans-christian.egtvedt at atmel.com
Tue Nov 4 06:59:16 UTC 2008


On Mon, 3 Nov 2008 17:35:47 -0500
Rob Landley <rob at landley.net> wrote:

> On Monday 03 November 2008 10:12:00 Hans-Christian Egtvedt wrote:
> > When working on latest trunk today I noticed some compiler warnings
> > here and there. Should I just fix them as indicated in patch below?
> 
> I'd hold off until after 0.9.30, which should be in the next day or
> two. (Bernhard wants to clear up the "why is ldd executing programs"
> thing, apparently _dl_exit(0) isn't triggering which is just
> _weird_.  I'm unaware of any other pending TODO items for the
> release...)  Random cleanups right before a release have more
> potential to introduce typos than benefit when so little testing time
> is left...
> 

Ah, good catch, I'll just hold then.

> That said, the patch doesn't look like it would hurt anything.  Your
> first one is just renaming a local variable, total nonissue.  The
> second one is checking a #define that's never #defined anyway.  (I
> did a find on the entire directory, that #if and the corresponding
> #endif is the only file in the whole of uclibc where that symbol
> occurs.  There's no config entry for it, no header contains it, etc.
> 

There are more defines to be cleaned up I think, places where #if is
used when I think it should really have been #ifdef.

> Then again I've never been quite clear on what symbol versioning
> does.  I know we're not link time compatable with glibc anyway, so I
> don't understand what that code is _for_...
> 
> Besides, these aren't the only warnings.  Check the build logs I
> posted on http://uclibc.org/~landley/fwl and you'll see tons.  From
> armv4l:
> 

The libm is also full off:

libm/s_trunc.c: In function 'trunc':
libm/s_trunc.c:29: warning: declaration of 'j0' shadows a global declaration
./include/bits/mathcalls.h:284: warning: shadowed declaration is here

Which does not sound very good in my ears...

> libc/sysdeps/linux/arm/posix_fadvise.c: In function
> '__libc_posix_fadvise': libc/sysdeps/linux/arm/posix_fadvise.c:20:
> warning: right shift count >= width of type
> libc/sysdeps/linux/arm/posix_fadvise.c:20: warning: right shift count
> >= width of type
> In file included from libc/misc/time/wcsftime.c:8:
> libc/misc/time/time.c:2436:2: warning: #warning wcsftime a  CC 
> libc/misc/ttyent/getttyent.os
> lways fails
> In file included from libc/misc/wctype/wctrans.c:8:
> libc/misc/wctype/_wctype.c: In function 'wctrans':
> libc/misc/wctype/_wctype.c:916: warning: pointer targets in
> assignment differ in signedness
> libc/misc/wctype/_wctype.c:919: warning: pointer targets in passing
> argument 2 of 'strcmp' differ in signedness
> In file included from libc/misc/wctype/towctrans.c:8:
> libc/misc/wctype/_wctype.c:740:2: warning: #warning _tolower is
> undefined! libc/misc/wctype/_wctype.c:744:2: warning: #warning
> _toupper is undefined! In file included from
> libc/misc/wctype/wctype.c:8: libc/misc/wctype/_wctype.c: In function
> 'wctype': libc/misc/wctype/_wctype.c:516: warning: pointer targets in
> passing argument 2 of 'strcmp' differ in signedness
> libc/stdio/popen.c:146:2: warning: #warning is pclose correct wrt the
> new mutex semantics?
> libc/stdio/_stdio.c:195:2: warning: #warning check
> libc/stdio/__fpending.c:22:2: warning: #warning Note: Unlike the
> glibc version, this __fpending returns bytes in buffer for wide
> streams too! In file included from libc/stdio/_vfprintf_internal.c:9:
> libc/stdio/_vfprintf.c: In function '_do_one_spec':
> libc/stdio/_vfprintf.c:1819: warning: pointer targets in passing
> argument 1 of '__stdio_fwrite' differ in signedness
> libc/stdio/_vfprintf.c:1829: warning: pointer targets in passing
> argument 1 of '__stdio_fwrite' differ in signedness
> libc/stdio/_scanf.c: In function 'vfscanf':
> libc/stdio/_scanf.c:1194: warning: 'invert' may be used uninitialized
> in this function
> 
> There are tons more, I just got tired of copying them.
> 

mmm, perhaps after 0.9.30 there should be a good cleanup of compiler warnings.
Although not critical, I just prefer to see my favorite library compile clean.

> Plus the big long bit where it calls rm on a bunch of headers for
> three screens full.  (An entire shell script seems to get echoed to
> stdout right in the middle of the build...)
> 

Should be silenced until V or VERBOSE is defined, is most likely as easy
as adding $(Q) in front of the execution of the shell script.

> Oh, and install spits out lots of gunk like:
> 
> install
> -d /home/landley/firmware/firmware/build/cross-compiler-armv4l//include
> top_builddir=./ \ ./extra/scripts/install_headers.sh 
> include /home/landley/firmware/firmware/build/cross-compiler-armv4l//include
> 
> Screens and screens of it, and if you're doing a "make -j 3 install"
> as your build that stuff gets interlaced with the other output...
> 

Same as above, add $(Q) in front to silence standard build and install.

-- 
Best regards,
Hans-Christian Egtvedt



More information about the uClibc mailing list