[BusyBox 0001171]: warning: empty body in an if-statement

bugs at busybox.net bugs at busybox.net
Thu Jan 25 23:59:47 UTC 2007


A NOTE has been added to this issue. 
====================================================================== 
http://busybox.net/bugs/view.php?id=1171 
====================================================================== 
Reported By:                andreasz
Assigned To:                BusyBox
====================================================================== 
Project:                    BusyBox
Issue ID:                   1171
Category:                   Kernel Module Support
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     feedback
====================================================================== 
Date Submitted:             01-23-2007 05:04 PST
Last Modified:              01-25-2007 15:59 PST
====================================================================== 
Summary:                    warning: empty body in an if-statement
Description: 
i tryed to precompile the Busybox for Mipsel. The precompiled abourt at :

  CC      applets/applets.o
cc1: warnings being treated as errors
applets/applets.c: In function 'run_applet_by_name':
applets/applets.c:474: warning: empty body in an if-statement
make[2]: *** [applets/applets.o] Fehler 1
make[1]: *** [applets] Fehler 2
make[1]: Leaving directory
`/home/bofh/ds-0.2.9_26-13/source/ref-8mb_26/busybox-1.4.0'
make: *** [source/ref-8mb_26/busybox-1.4.0/busybox] Fehler 2


====================================================================== 

---------------------------------------------------------------------- 
 andreasz - 01-23-07 05:05  
---------------------------------------------------------------------- 
sorry wrong Category, its my first Report 

---------------------------------------------------------------------- 
 vda - 01-23-07 12:38  
---------------------------------------------------------------------- 
Find this place:

#else
#define parse_config_file()
#endif /* CONFIG_FEATURE_SUID_CONFIG */

and add "((void)0)":

#else
#define parse_config_file() ((void)0)
#endif /* CONFIG_FEATURE_SUID_CONFIG */

Does this work? 

---------------------------------------------------------------------- 
 andreasz - 01-24-07 04:35  
---------------------------------------------------------------------- 
Hello, ist works thank you but now a new error or must i report it as a new
?:

 CC      archival/tar.o
cc1: warnings being treated as errors
archival/tar.c: In function 'writeFileToTarball':
archival/tar.c:379: warning: unused parameter 'depth'
make[2]: *** [archival/tar.o] Fehler 1
make[1]: *** [archival] Fehler 2
make[1]: Leaving directory
`/home/bofh/ds-0.2.9_26-13/source/ref-8mb_26/busybox-1.4.0'
make: *** [source/ref-8mb_26/busybox-1.4.0/busybox] Fehler 2 

---------------------------------------------------------------------- 
 vda - 01-24-07 12:33  
---------------------------------------------------------------------- 
Add ATTRIBUTE_UNUSED here:

static int writeFileToTarball(const char *fileName, struct stat *statbuf,
                        void *userData, int depth ATTRIBUTE_UNUSED)

Pity, my gcc doesn't emit this warning... 

---------------------------------------------------------------------- 
 andreasz - 01-25-07 13:23  
---------------------------------------------------------------------- 
it works, thank you 

---------------------------------------------------------------------- 
 bernhardf - 01-25-07 15:59  
---------------------------------------------------------------------- 
vda,
Re: Pity, my gcc doesn't emit this warning... 

Try make EXTRA_CFLAGS="-Wunused -W"
This will warn about empty bodies.

One common thing can be caught with -Wnested-externs

Another related thing:
With gcc-4.3 (trunk), i noticed:
archival/libunarchive/get_header_tar.c: In function 'get_header_tar':
archival/libunarchive/get_header_tar.c:140: warning: array subscript is
above array bounds
archival/libunarchive/get_header_tar.c:155: warning: array subscript is
above array bounds
archival/libunarchive/get_header_tar.c:158: warning: array subscript is
above array bounds

util-linux/fsck_minix.c: In function 'map_block2':
util-linux/fsck_minix.c:500: warning: array subscript is above array
bounds


What bothers me much, much more, is that current svn is entering more and
more into lala land.
Please override that *wrong* -std=gnu99 by explicitely requesting c99:

 make EXTRA_CFLAGS="-Wunused -std=c99"

We currently don't even compile with a C99 compiler (gcc-4.1 in that case)
anymore:
  CC      libbb/xatonum.o
In file included from libbb/xatonum.c:10:
include/libbb.h:297: warning: declaration does not declare anything
  CC      libbb/xconnect.o
In file included from libbb/xconnect.c:10:
include/libbb.h:297: warning: declaration does not declare anything
libbb/xconnect.c: In function 'get_nport':
libbb/xconnect.c:88: error: 'len_and_sockaddr' has no member named 'sa'
libbb/xconnect.c:89: error: 'len_and_sockaddr' has no member named 'sin6'
libbb/xconnect.c:92: error: 'len_and_sockaddr' has no member named 'sa'
libbb/xconnect.c:93: error: 'len_and_sockaddr' has no member named 'sin'
libbb/xconnect.c: In function 'set_nport':
libbb/xconnect.c:102: error: 'len_and_sockaddr' has no member named 'sa'
libbb/xconnect.c:103: error: 'len_and_sockaddr' has no member named
'sin6'
libbb/xconnect.c:107: error: 'len_and_sockaddr' has no member named 'sa'
libbb/xconnect.c:108: error: 'len_and_sockaddr' has no member named 'sin'
libbb/xconnect.c: In function 'str2sockaddr':
libbb/xconnect.c:165: error: 'len_and_sockaddr' has no member named 'sa'
libbb/xconnect.c:167: error: 'len_and_sockaddr' has no member named 'sa'
libbb/xconnect.c: In function 'xsocket_stream':
libbb/xconnect.c:210: error: 'len_and_sockaddr' has no member named 'sa'
libbb/xconnect.c:212: error: 'len_and_sockaddr' has no member named 'sa'
libbb/xconnect.c: In function 'create_and_bind_stream_or_die':
libbb/xconnect.c:228: error: 'len_and_sockaddr' has no member named 'sa'
libbb/xconnect.c:234: error: 'len_and_sockaddr' has no member named 'sa'
libbb/xconnect.c: In function 'create_and_connect_stream_or_die':
libbb/xconnect.c:248: error: 'len_and_sockaddr' has no member named 'sa'
libbb/xconnect.c:250: error: 'len_and_sockaddr' has no member named 'sa'
libbb/xconnect.c: In function 'xconnect_stream':
libbb/xconnect.c:257: error: 'len_and_sockaddr' has no member named 'sa'
libbb/xconnect.c:258: error: 'len_and_sockaddr' has no member named 'sa'
make[1]: *** [libbb/xconnect.o] Error 1
make: *** [libbb] Error 2

I'm not arguing that we have to strictly adhere to C89, but a pure C99
compiler should be able to cope with busybox, IMNSHO

cheers, 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
01-23-07 05:04  andreasz       New Issue                                    
01-23-07 05:04  andreasz       Status                   new => assigned     
01-23-07 05:04  andreasz       Assigned To               => BusyBox         
01-23-07 05:05  andreasz       Note Added: 0002036                          
01-23-07 12:38  vda            Note Added: 0002037                          
01-23-07 12:38  vda            Status                   assigned => feedback
01-24-07 04:35  andreasz       Note Added: 0002039                          
01-24-07 12:33  vda            Note Added: 0002040                          
01-25-07 13:23  andreasz       Note Added: 0002045                          
01-25-07 15:59  bernhardf      Note Added: 0002046                          
======================================================================




More information about the busybox-cvs mailing list