pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Rowley <david.rowley@2ndquadrant.com>
To: Andres Freund <andres@anarazel.de>
Cc: pgsql-committers <pgsql-committers@postgresql.org>
Subject: Re: pgsql: Use new overflow aware integer operations.
Date: Sun, 17 Dec 2017 00:57:59 +1300
Message-ID: <CAKJS1f__gtRPYioPNEyQRCxwPM3EPS-++HMNEGR434JvRqCj1A@mail.gmail.com> (raw)
In-Reply-To: <E1eOvQF-00075s-D1@gemulon.postgresql.org>
References: <E1eOvQF-00075s-D1@gemulon.postgresql.org>

On 13 December 2017 at 14:01, Andres Freund <andres@anarazel.de> wrote:
> Use new overflow aware integer operations.

Thanks for making this happen.

I notice it's caused a small warning in compilers that don't
understand about elog(ERROR) and ereport(ERROR) not returning.

This can be seen on bowerbird's compile log [1]:

  c:\prog\bf\root\head\pgsql.build\src\backend\utils\adt\int8.c(131):
warning C4715: 'scanint8' : not all control paths return a value
[c:\prog\bf\root\HEAD\pgsql.build\postgres.vcxproj]

The attached just shuffles things around to get rid of the warning.
This way seems better than to add another "return false" at the end as
this way saves a couple of lines of code rather than adding one.

[1] https://buildfarm.postgresql.org/cgi-bin/show_stage_log.pl?nm=bowerbird&dt=2017-12-15%2018%3A21%...

-- 
 David Rowley                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

Attachments:

scanint8_warning_fix.patch (application/octet-stream, 752B) download diff --git a/src/backend/utils/adt/int8.c b/src/backend/utils/adt/int8.c index a8e2200..709cf7c 100644 --- a/src/backend/utils/adt/int8.c +++ b/src/backend/utils/adt/int8.c @@ -113,21 +113,19 @@ scanint8(const char *str, bool errorOK, int64 *result) return true; out_of_range: - if (errorOK) - return false; - else + if (!errorOK) ereport(ERROR, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), errmsg("value \"%s\" is out of range for type %s", str, "bigint"))); + return false; invalid_syntax: - if (errorOK) - return false; - else + if (!errorOK) ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), errmsg("invalid input syntax for integer: \"%s\"", str))); + return false; } /* int8in()

view thread (15+ messages)  latest in thread

Message-ID: <CAKJS1f__gtRPYioPNEyQRCxwPM3EPS-++HMNEGR434JvRqCj1A@mail.gmail.com>
Permalink:  ../CAKJS1f__gtRPYioPNEyQRCxwPM3EPS-++HMNEGR434JvRqCj1A@mail.gmail.com/
Also on:    postgresql.org/message-id/CAKJS1f__gtRPYioPNEyQRCxwPM3EPS-++HMNEGR434JvRqCj1A@mail.gmail.com

 ·  · 

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: david.rowley@2ndquadrant.com, andres@anarazel.de
  Subject: Re: pgsql: Use new overflow aware integer operations.
  In-Reply-To: <CAKJS1f__gtRPYioPNEyQRCxwPM3EPS-++HMNEGR434JvRqCj1A@mail.gmail.com>
  References: <E1eOvQF-00075s-D1@gemulon.postgresql.org> <CAKJS1f__gtRPYioPNEyQRCxwPM3EPS-++HMNEGR434JvRqCj1A@mail.gmail.com>

* 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