pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
postgresql-10.0/src/bin/psql/mainloop.c:465: suspicious condition ?
4+ messages / 2 participants
[nested] [flat]

Commits from this thread:
  2017-10-06 3620569fec  #ifdef out some dead code in psql/mainloop.c.
* postgresql-10.0/src/bin/psql/mainloop.c:465: suspicious condition ?
@ 2017-10-06 07:21  David Binderman <dcb314@hotmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: David Binderman @ 2017-10-06 07:21 UTC (permalink / raw)
  To: pgsql-bugs

Hello there,

postgresql-10.0/src/bin/psql/mainloop.c:461] -> [postgresql-10.0/src/bin/psql/mainloop.c:465]: (warning) Opposite inner 'if' condition leads to a dead code block.

Source code is

    if (query_buf->len > 0 && !pset.cur_cmd_interactive &&
        successResult == EXIT_SUCCESS)
    {
        /* save query in history */
        if (pset.cur_cmd_interactive)
            pg_send_history(history_buf);

It looks like function pg_send_history can never be executed.

Regards

David Binderman

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: postgresql-10.0/src/bin/psql/mainloop.c:465: suspicious condition ?
@ 2017-10-06 15:07  Tom Lane <tgl@sss.pgh.pa.us>
  parent: David Binderman <dcb314@hotmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Tom Lane @ 2017-10-06 15:07 UTC (permalink / raw)
  To: David Binderman <dcb314@hotmail.com>; +Cc: pgsql-bugs

David Binderman <dcb314@hotmail.com> writes:
> postgresql-10.0/src/bin/psql/mainloop.c:461] -> [postgresql-10.0/src/bin/psql/mainloop.c:465]: (warning) Opposite inner 'if' condition leads to a dead code block.

Huh ... that code's been like that since 2006.  Odd that nothing's
noticed the dead-ness before.  What tool were you using?

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: postgresql-10.0/src/bin/psql/mainloop.c:465: suspicious condition ?
@ 2017-10-06 15:10  David Binderman <dcb314@hotmail.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 4+ messages in thread

From: David Binderman @ 2017-10-06 15:10 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs


Hello there,

>Huh ... that code's been like that since 2006.  Odd that nothing's
>noticed the dead-ness before.  What tool were you using?

cppcheck, available from sourceforge.

Regards

David Binderman
    

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: postgresql-10.0/src/bin/psql/mainloop.c:465: suspicious condition ?
@ 2017-10-06 15:37  Tom Lane <tgl@sss.pgh.pa.us>
  parent: David Binderman <dcb314@hotmail.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2017-10-06 15:37 UTC (permalink / raw)
  To: David Binderman <dcb314@hotmail.com>; +Cc: pgsql-bugs

David Binderman <dcb314@hotmail.com> writes:
>> Huh ... that code's been like that since 2006.  Odd that nothing's
>> noticed the dead-ness before.  What tool were you using?

> cppcheck, available from sourceforge.

Thanks.  I've corrected this in HEAD, but it seems not worth
back-patching since it's really just cosmetic.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2017-10-06 15:37 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-10-06 07:21 postgresql-10.0/src/bin/psql/mainloop.c:465: suspicious condition ? David Binderman <dcb314@hotmail.com>
2017-10-06 15:07 ` Tom Lane <tgl@sss.pgh.pa.us>
2017-10-06 15:10   ` David Binderman <dcb314@hotmail.com>
2017-10-06 15:37     ` Tom Lane <tgl@sss.pgh.pa.us>

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