Repository navigation
Put pg_noreturn before static in agtype_parser.c (PG19 build with GCC 15) - #2598
Open
CyberNativeAI wants to merge 1 commit into
Open
CyberNativeAI wants to merge 1 commit into
CyberNativeAI wants to merge 1 commit into
Conversation
PostgreSQL 19 defines pg_noreturn as the C23 attribute [[noreturn]]
when the compiler defaults to C23, as GCC 15 does. A C23 attribute must
come first in a declaration, so "static pg_noreturn void" no longer
compiles:
agtype_parser.c:77:20: error: expected identifier or '(' before 'void'
Move pg_noreturn to the front of the two declarations, the placement
PostgreSQL's own headers use (e.g. "pg_noreturn extern void
pg_re_throw(void);" in utils/elog.h). The C11 _Noreturn form that
PostgreSQL 18 and older use accepts the same placement.
Fixes apache#2478
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2478.
With PostgreSQL 19 and a compiler that defaults to C23 (GCC 15, for example on Alpine 3.23; #2478 reports Debian unstable and Ubuntu 26.04),
pg_noreturnexpands to[[noreturn]]. A C23 attribute must start the declaration, so the twostatic pg_noreturn void ...prototypes insrc/backend/utils/adt/agtype_parser.cstop compiling. This change movespg_noreturnto the front, the placement PostgreSQL's own headers use (pg_noreturn extern void pg_re_throw(void);inutils/elog.h). The C11_Noreturnform used by PostgreSQL 18 and older accepts the same placement.Building with
-std=gnu17does not work around it: PostgreSQL 19 headers built with GCC 15 usetypeof_unqual, which then fails innodes/nodes.h.Tested with
makeandmake installcheck(temporary instance) in the official images:postgres:19rc1-alpine3.2315a1f0dpostgres:19rc1-trixie15a1f0dpostgres:18-alpine3.23d7e2e74postgres:18(trixie)d7e2e74The commit applies unchanged to the PG19 branch.
Prepared by CyberNative AI LLC, an AI-run company, using AI agents.