fix if's that are followed by semicolons

Michael Stefaniuc mstefani at
Tue Sep 20 04:05:53 CDT 2005

Mike McCormack wrote:
> Erik de Castro Lopo wrote:
>> Gcc-4.0 catches this:
>>     erikd at miles > cat test.c     int main (void)
>>     {
>>         if (0)  ;
>>         return 0 ;
>>     }
>>     erikd at miles > gcc-4.0 -W -Wall test.c -o /dev/null
>>     test.c: In function 'main':
>>     test.c:3: warning: empty body in an if-statement
> Yes, but only if you use -W -Wall, which wine unfortunately doesn't :/
Properly documented (in the janitorial part on the wiki) this is good 
enough. No need to write an extra tool/script to catch those if 
problems. I once wrote a script for smatch to look for such cases but 
i'm not sure i finished it or at least it's not part of the standard 
smatch scripts I run.

> bash-3.00$ cat > t.c
> int boo(int arg) {
>    if (arg);
>    return 0;
> }
> bash-3.00$ /usr/local/gcc-4.0.1/bin/gcc -c -Wall t.c
> bash-3.00$ /usr/local/gcc-4.0.1/bin/gcc -c -W -Wall t.c
> t.c: In function 'boo':
> t.c:2: warning: empty body in an if-statement

Michael Stefaniuc               Tel.: +49-711-96437-199
Sr. Network Engineer            Fax.: +49-711-96437-111
Red Hat GmbH                    Email: mstefani at
Hauptstaetterstr. 58  
D-70178 Stuttgart

More information about the wine-devel mailing list