[Snowball-discuss] Problems with -Wall flag

Olly Betts olly@survex.com
Wed Feb 25 01:29:01 2004


On Tue, Feb 24, 2004 at 05:54:27PM -0700, Neal Richter wrote:
>   Is this a thank you for the polite input?

I apologise if perhaps overly terse response came across as rude.  That wasn't
my intention at all.

>   10 of the 14 errors reported were not machine generated.

And should obviously be corrected!

>   I made no claim for coding standards for machine-generated code.  In
> general, enforcing any kind of style on this type of code is silly and
> fairly hard.

Sorry, I read your message as saying these warnings were a problem for you
because of the coding standards.

> Correctness is the only real metric, and efficiency is a consideration.
> 
>   Note that the 'unused variable m' error at a minimum results in several
> meaningless machine instructions.  Keeping track of when/if it is used is
> hard, so I have no problem if you want to ignore it.

I'd hope any decent compiler would remove such dead code (and if it can warn
about it, it must know it's dead code!)  GCC does remove such code if you
enable optimisation - identical code is produced for functions foo and bar:

$ cat test.c
void foo(int a, int b) { int m = a - b; }
void bar(int a, int b) { }
$ gcc-2.95 -O -S -Wall test.c
        .file   "test.c"
        .version        "01.01"
gcc2_compiled.:
.text
        .align 4
.globl foo
        .type    foo,@function
foo:
        pushl %ebp
        movl %esp,%ebp
        leave
        ret
.Lfe1:
        .size    foo,.Lfe1-foo
        .align 4
.globl bar
        .type    bar,@function
bar:
        pushl %ebp
        movl %esp,%ebp
        leave
        ret
.Lfe2:
        .size    bar,.Lfe2-bar
        .ident  "GCC: (GNU) 2.95.4 20011002 (Debian prerelease)"

>   Thanks for all your hard work on Snowball.

I'm mostly a user.  Most of the hard work is done by Martin and Richard.

Cheers,
    Olly