Re: [COMMITTERS] pgsql: Remove dead assignment - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [COMMITTERS] pgsql: Remove dead assignment
Date
Msg-id 15768.1332789342@sss.pgh.pa.us
Whole thread Raw
Responses Re: [COMMITTERS] pgsql: Remove dead assignment  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> writes:
> Remove dead assignment
> found by Coverity
   init_sequence(seq_relid, &elm, &seq_rel);
-   seq = read_info(elm, seq_rel, &buf);
+   read_info(elm, seq_rel, &buf);


I have to object to this patch.  In the blind service of eliminating
warnings from some tool or other, you will introduce warnings from
other tools?  It's traditional for lint to complain about code that
sometimes ignores the return value of a function, for instance.
I also do not think it does anything for readability for this call
of read_info() to be unexpectedly unlike all the others.

I think we should institute a project policy that we will ignore "dead
assignment" coverity warnings.  I have not seen one of those changes
yet that seemed to me like a good idea.  Any optimizing compiler is
perfectly capable of figuring out that an assignment is dead and
eliminating it, so there is no code size advantage from doing this
manually; and even the gcc boys have not (yet?) decided they should
warn about dead assignments.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Stefan Kaltenbrunner
Date:
Subject: Re: Re: [COMMITTERS] pgsql: Replace empty locale name with implied value in CREATE DATABASE
Next
From: Dimitri Fontaine
Date:
Subject: Re: Command Triggers, v16