pgsql: Allocate JsonLexContexts on the heap to avoid warnings

From: Daniel Gustafsson <dgustafsson(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Allocate JsonLexContexts on the heap to avoid warnings
Date: 2025-04-23 09:25:38
Message-ID: E1u7WMM-001NxG-1Q@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Allocate JsonLexContexts on the heap to avoid warnings

The stack allocated JsonLexContexts, in combination with codepaths
using goto, were causing warnings when compiling with LTO enabled
as the optimizer is unable to figure out that is safe. Rather than
contort the code with workarounds for this simply heap allocate the
structs instead as these are not in any performance critical paths.

Author: Daniel Gustafsson <daniel(at)yesql(dot)se>
Reported-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Reviewed-by: Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com>
Reviewed-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Discussion: https://postgr.es/m/2074634.1744839761@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/994a100b37ad8c2fb8282a9fce91a16b4c832277

Modified Files
--------------
src/interfaces/libpq/fe-auth-oauth.c | 12 +++++------
.../test_json_parser_incremental.c | 23 +++++++++++++---------
2 files changed, 20 insertions(+), 15 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Christoph Berg 2025-04-23 09:39:32 extension_control_path and "directory"
Previous Message Michael Paquier 2025-04-23 06:34:30 pgsql: psql: Rework TAP routine psql_fails_like() to define WAL sender