Silence compiler warnings with Python 3.9

Started by Peter Eisentrautover 6 years ago2 messageshackers
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

won't retrysuccessCI history

You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:

docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t42017
psql -h localhost -U postgres

Built from patchset v1 (message #1), July 28, 2026 at 02:56 AM.

Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:

git clone --branch t42017_1 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t42017_1 && git checkout t42017_1

Patchset v1 (message #1) is on t42017_1

Jump to latest
#1Peter Eisentraut
peter_e@gmx.net

Starting with Python 3.9, the Python headers contain inline functions
that fall afoul of our -Wdeclaration-after-statement coding style. In
order to silence those warnings, I've added some GCC-specific
contortions to disable that warning for Python.h only. Clang doesn't
appear to warn about this at all; maybe it recognizes that this is an
external header file. We could also write a configure check for this if
we want to be more flexible.

(Attempts to convince upstream to change the coding style were
unsuccessful (https://bugs.python.org/issue39615).)

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachments:

t42017_1
0001-Silence-compiler-warnings-with-Python-3.9.patchtext/plain; charset=UTF-8; name=0001-Silence-compiler-warnings-with-Python-3.9.patch; x-mac-creator=0; x-mac-type=0Download+19-1
#2Peter Eisentraut
peter_e@gmx.net
In reply to: Peter Eisentraut (#1)
Re: Silence compiler warnings with Python 3.9

On 2020-03-02 14:22, Peter Eisentraut wrote:

Starting with Python 3.9, the Python headers contain inline functions
that fall afoul of our -Wdeclaration-after-statement coding style. In
order to silence those warnings, I've added some GCC-specific
contortions to disable that warning for Python.h only. Clang doesn't
appear to warn about this at all; maybe it recognizes that this is an
external header file. We could also write a configure check for this if
we want to be more flexible.

(Attempts to convince upstream to change the coding style were
unsuccessful (https://bugs.python.org/issue39615).)

My fix in cpython was accepted after all and the issue is no longer
present in the latest alpha (3.9.0a5), so this can be considered closed.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services