pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Eisentraut <peter_e@gmx.net>
Cc: pgsql-hackers@postgresql.org
Subject: Re: [COMMITTERS] pgsql: Remove dead assignment
Date: Mon, 26 Mar 2012 15:15:42 -0400
Message-ID: <15768.1332789342@sss.pgh.pa.us> (raw)
In-Reply-To: <E1SCEd4-0006qd-Qd@gemulon.postgresql.org>
References: <E1SCEd4-0006qd-Qd@gemulon.postgresql.org>

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



view thread (6+ messages)  latest in thread

Message-ID: <15768.1332789342@sss.pgh.pa.us>
Permalink:  ../15768.1332789342@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/15768.1332789342@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, peter_e@gmx.net, pgsql-hackers@postgresql.org
  Subject: Re: [COMMITTERS] pgsql: Remove dead assignment
  In-Reply-To: <15768.1332789342@sss.pgh.pa.us>
  References: <E1SCEd4-0006qd-Qd@gemulon.postgresql.org> <15768.1332789342@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox