Re: jsonapi: scary new warnings with LTO enabled - Mailing list pgsql-hackers

From Jacob Champion
Subject Re: jsonapi: scary new warnings with LTO enabled
Date
Msg-id CAOYmi+n7eShndhpJAZ-6+9h012nZfmuQbnj-p-L=ZnX96-PGVA@mail.gmail.com
Whole thread Raw
In response to Re: jsonapi: scary new warnings with LTO enabled  (Daniel Gustafsson <daniel@yesql.se>)
List pgsql-hackers
On Mon, Apr 21, 2025 at 11:46 AM Daniel Gustafsson <daniel@yesql.se> wrote:
> We do, but with the current coding we call setJsonLexContextOwnsTokens
> immediately after creation which derefences the pointer without checkinf for
> allocation failure.

Right. (The flag does nothing on the OOM sentinel.)

> This means we dereference the pointer before we can check
> for an OOM return from pg_parse_json which even if safe seems to violate code
> readability no?

Personally, I'm fine with can't-fail APIs, as long as they're
documented as such. (I think the deferred error API was probably
chosen so that src/common JSON clients could be written without a lot
of pain?)

--Jacob



pgsql-hackers by date:

Previous
From: Devrim Gündüz
Date:
Subject: Re: [PoC] Federated Authn/z with OAUTHBEARER
Next
From: Noboru Saito
Date:
Subject: Re: [PATCH] Documentation: Fix minor grammatical and formatting issues