Unused variable in postgres_fdw/deparse.c

Started by Kyotaro HORIGUCHIabout 9 years ago5 messages
#1Kyotaro HORIGUCHI
horiguchi.kyotaro@lab.ntt.co.jp
1 attachment(s)

Hello, compiler complains about unused variable during build
postgres_fdw without assertions (!--enable-cassert).

deparse.c: In function ‘deparseFromExpr’:
deparse.c:1029:14: warning: unused variable ‘foreignrel’ [-Wunused-variable]
RelOptInfo *foreignrel = context->foreignrel;
^~~~~~~~~~

The attched patch removes it and moves into the assertion below it.

regards,

Attachments:

postgre_fdw_delete_unused_var.patchtext/x-patch; charset=us-asciiDownload
diff --git a/contrib/postgres_fdw/deparse.c b/contrib/postgres_fdw/deparse.c
index 8da8c11..450693a 100644
--- a/contrib/postgres_fdw/deparse.c
+++ b/contrib/postgres_fdw/deparse.c
@@ -1026,11 +1026,10 @@ static void
 deparseFromExpr(List *quals, deparse_expr_cxt *context)
 {
 	StringInfo	buf = context->buf;
-	RelOptInfo *foreignrel = context->foreignrel;
 	RelOptInfo *scanrel = context->scanrel;
 
 	/* For upper relations, scanrel must be either a joinrel or a baserel */
-	Assert(foreignrel->reloptkind != RELOPT_UPPER_REL ||
+	Assert(context->foreignrel->reloptkind != RELOPT_UPPER_REL ||
 		   scanrel->reloptkind == RELOPT_JOINREL ||
 		   scanrel->reloptkind == RELOPT_BASEREL);
 
#2Ashutosh Bapat
ashutosh.bapat@enterprisedb.com
In reply to: Kyotaro HORIGUCHI (#1)
Re: Unused variable in postgres_fdw/deparse.c

On Wed, Oct 26, 2016 at 6:19 AM, Kyotaro HORIGUCHI
<horiguchi.kyotaro@lab.ntt.co.jp> wrote:

Hello, compiler complains about unused variable during build
postgres_fdw without assertions (!--enable-cassert).

deparse.c: In function ‘deparseFromExpr’:
deparse.c:1029:14: warning: unused variable ‘foreignrel’ [-Wunused-variable]
RelOptInfo *foreignrel = context->foreignrel;
^~~~~~~~~~

The attched patch removes it and moves into the assertion below it.

Thanks for the patch and sorry for missing this in the review. I

The patch applies but seems to have a trailing white space.
patch -p1 < /mnt/hgfs/tmp/postgre_fdw_delete_unused_var.patch
(Stripping trailing CRs from patch.)
patching file contrib/postgres_fdw/deparse.c
But that's removed my "patch" command.

It compiles cleanly and make check in contrib/postgres_fdw does not
show any failure.

--
Best Wishes,
Ashutosh Bapat
EnterpriseDB Corporation
The Postgres Database Company

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

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Kyotaro HORIGUCHI (#1)
Re: Unused variable in postgres_fdw/deparse.c

Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp> writes:

Hello, compiler complains about unused variable during build
postgres_fdw without assertions (!--enable-cassert).
The attched patch removes it and moves into the assertion below it.

Pushed, thanks.

regards, tom lane

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

#4Kyotaro HORIGUCHI
horiguchi.kyotaro@lab.ntt.co.jp
In reply to: Ashutosh Bapat (#2)
Re: Unused variable in postgres_fdw/deparse.c

Hi,

At Wed, 26 Oct 2016 11:00:17 +0530, Ashutosh Bapat <ashutosh.bapat@enterprisedb.com> wrote in <CAFjFpRcFoBn0cd1hMueYtkaL+x_KcBD4kJcuvh4jqKtbviCvDw@mail.gmail.com>

On Wed, Oct 26, 2016 at 6:19 AM, Kyotaro HORIGUCHI
<horiguchi.kyotaro@lab.ntt.co.jp> wrote:
Thanks for the patch and sorry for missing this in the review. I

The patch applies but seems to have a trailing white space.

Oops. My 'git commit' has a hook to warn such mistakes but it is
just made by 'git diff'. Automatic measure made me forget to keep
alert:p

patch -p1 < /mnt/hgfs/tmp/postgre_fdw_delete_unused_var.patch
(Stripping trailing CRs from patch.)
patching file contrib/postgres_fdw/deparse.c
But that's removed my "patch" command.

It compiles cleanly and make check in contrib/postgres_fdw does not
show any failure.

Thanks for confirmation.

regards,

--
Kyotaro Horiguchi
NTT Open Source Software Center

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

#5Kyotaro HORIGUCHI
horiguchi.kyotaro@lab.ntt.co.jp
In reply to: Tom Lane (#3)
Re: Unused variable in postgres_fdw/deparse.c

Thank you.

At Wed, 26 Oct 2016 10:20:28 -0400, Tom Lane <tgl@sss.pgh.pa.us> wrote in <17387.1477491628@sss.pgh.pa.us>

Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp> writes:

Hello, compiler complains about unused variable during build
postgres_fdw without assertions (!--enable-cassert).
The attched patch removes it and moves into the assertion below it.

Pushed, thanks.

--
Kyotaro Horiguchi
NTT Open Source Software Center

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