Re: [COMMITTERS] pgsql: dblink: Replace some macros by static functions - Mailing list pgsql-committers

From Tom Lane
Subject Re: [COMMITTERS] pgsql: dblink: Replace some macros by static functions
Date
Msg-id 30881.1489435086@sss.pgh.pa.us
Whole thread Raw
In response to Re: [COMMITTERS] pgsql: dblink: Replace some macros by staticfunctions  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Responses Re: pgsql: dblink: Replace some macros by staticfunctions
List pgsql-committers
Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
> On 3/12/17 17:44, David Rowley wrote:
>> Please accept a small patch which fixes a new compiler warning which
>> started as a result of this commit.

> Done.

> Which compiler is that?

Any compiler that didn't support pg_attribute_noreturn() could be expected
to whine about the original coding.

In the same vein, I think this bit in dblink_open is pretty poor coding
practice:

    if (!rconn || !rconn->conn)
        dblink_conn_not_avail(conname);
    else
        conn = rconn->conn;

as it expects both the compiler and the reader to understand that
we will not proceed without "conn" getting a value.  I see that
that was band-aided around by initializing conn to NULL, but that's a
crummy way of suppressing uninitialized-variable warnings, because it
will mask even actual errors.  Far better would be to remove the dummy
initialization and write

    if (!rconn || !rconn->conn)
        dblink_conn_not_avail(conname);
    conn = rconn->conn;


            regards, tom lane


pgsql-committers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: [COMMITTERS] pgsql: Include array size in forward declaration.
Next
From: Michael Meskes
Date:
Subject: [COMMITTERS] pgsql: Ecpg should support COMMIT PREPARED and ROLLBACK PREPARED.