Re: [COMMITTERS] pgsql: Remove dead assignment

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [COMMITTERS] pgsql: Remove dead assignment
Date: 2012-03-26 19:15:42
Message-ID: 15768.1332789342@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Peter Eisentraut <peter_e(at)gmx(dot)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

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2012-03-26 19:29:19 Re: [COMMITTERS] pgsql: Remove dead assignment
Previous Message Stefan Kaltenbrunner 2012-03-26 19:06:29 Re: Re: [COMMITTERS] pgsql: Replace empty locale name with implied value in CREATE DATABASE

Browse pgsql-hackers by date

  From Date Subject
Next Message Dimitri Fontaine 2012-03-26 19:24:46 Re: Command Triggers, v16
Previous Message Stefan Kaltenbrunner 2012-03-26 19:06:29 Re: Re: [COMMITTERS] pgsql: Replace empty locale name with implied value in CREATE DATABASE