Re: A compiling warning in jsonb_populate_record_valid

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: A compiling warning in jsonb_populate_record_valid
Date: 2024-01-25 06:28:09
Message-ID: CA+HiwqFR-RRMdB=OZjRBAAjzL0LcQKLdtvLyusZP-wHbpbqd6w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Thu, Jan 25, 2024 at 2:59 PM Richard Guo <guofenglinux(at)gmail(dot)com> wrote:
>
> I came across a warning when building master (a044e61f1b) on old GCC
> (4.8.5).
>
> jsonfuncs.c: In function ‘jsonb_populate_record_valid’:
> ../../../../src/include/nodes/miscnodes.h:53:15: warning: the comparison will always evaluate as ‘true’ for the address of ‘escontext’ will never be NULL [-Waddress]
> ((escontext) != NULL && IsA(escontext, ErrorSaveContext) && \
> ^
> jsonfuncs.c:2481:23: note: in expansion of macro ‘SOFT_ERROR_OCCURRED’
> return BoolGetDatum(!SOFT_ERROR_OCCURRED(&escontext));
>
> This was introduced in commit 1edb3b491b, and can be observed on several
> systems in the buildfarm too, such as:
> https://buildfarm.postgresql.org/cgi-bin/show_stage_log.pl?nm=arowana&dt=2024-01-25%2004%3A54%3A38&stg=build

Thanks for the report.

Will apply the attached, which does this:

- return BoolGetDatum(!SOFT_ERROR_OCCURRED(&escontext));
+ return BoolGetDatum(!escontext.error_occurred);

--
Thanks, Amit Langote
EDB: http://www.enterprisedb.com

Attachment Content-Type Size
0001-Silence-compiler-warning-introduced-in-1edb3b491b.patch application/octet-stream 975 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2024-01-25 06:31:44 Re: SQL:2011 application time
Previous Message shveta malik 2024-01-25 06:11:06 Re: Synchronizing slots from primary to standby