summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2019-06-07 16:50:53 +0200
committerChristoph Reiter <reiter.christoph@gmail.com>2019-06-13 20:55:07 +0200
commitab596da7991dc5b91b047fc741c9da23ae051e1a (patch)
treea927d826b603fadde866e2abb88e542ec965db5a
parentdea99de09f273a54244af1f3250f6699cfede637 (diff)
downloadpygobject-ab596da7991dc5b91b047fc741c9da23ae051e1a.tar.gz
build: don't use -Wdeclaration-after-statement with Python 3
The headers of Python 3.8 trigger the warning and PEP7 states that Python is depending on this now. As far as I remember this was mostly added to keep the code compatible with ancient py2 MSVC, so only use it with Python 2.
-rw-r--r--meson.build7
-rwxr-xr-xsetup.py6
2 files changed, 11 insertions, 2 deletions
diff --git a/meson.build b/meson.build
index 1beda259..2064d254 100644
--- a/meson.build
+++ b/meson.build
@@ -72,7 +72,6 @@ else
'-Wall',
'-Warray-bounds',
'-Wcast-align',
- '-Wdeclaration-after-statement',
'-Wduplicated-branches',
'-Wextra',
'-Wformat=2',
@@ -104,6 +103,12 @@ else
'-Wwrite-strings',
]
+ if python.language_version().split('.')[0] == '2'
+ main_c_args += [
+ '-Wdeclaration-after-statement',
+ ]
+ endif
+
main_c_args += [
'-Wno-incompatible-pointer-types-discards-qualifiers',
'-Wno-missing-field-initializers',
diff --git a/setup.py b/setup.py
index 47cc1050..b9172131 100755
--- a/setup.py
+++ b/setup.py
@@ -975,7 +975,6 @@ def add_ext_compiler_flags(ext, compiler, _cache={}):
"-Wall",
"-Warray-bounds",
"-Wcast-align",
- "-Wdeclaration-after-statement",
"-Wduplicated-branches",
"-Wextra",
"-Wformat=2",
@@ -1007,6 +1006,11 @@ def add_ext_compiler_flags(ext, compiler, _cache={}):
"-Wwrite-strings",
]
+ if sys.version_info[0] == 2:
+ args += [
+ "-Wdeclaration-after-statement",
+ ]
+
args += [
"-Wno-incompatible-pointer-types-discards-qualifiers",
"-Wno-missing-field-initializers",