From 679adc7bf5280dd6f3e7db3c2bba94544fb9da14 Mon Sep 17 00:00:00 2001 From: William Toohey Date: Tue, 16 Nov 2021 14:33:36 +1000 Subject: Support ancient (<3.4.0) gcc versions --- mesonbuild/compilers/c.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index a01938c..9d4a779 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -245,6 +245,7 @@ class GnuCCompiler(GnuCompiler, CCompiler): _C18_VERSION = '>=8.0.0' _C2X_VERSION = '>=9.0.0' + _INVALID_PCH_VERSION = ">=3.4.0" def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', exe_wrapper: T.Optional['ExternalProgram'] = None, @@ -253,7 +254,9 @@ class GnuCCompiler(GnuCompiler, CCompiler): full_version: T.Optional[str] = None): CCompiler.__init__(self, exelist, version, for_machine, is_cross, info, exe_wrapper, linker=linker, full_version=full_version) GnuCompiler.__init__(self, defines) - default_warn_args = ['-Wall', '-Winvalid-pch'] + default_warn_args = ['-Wall'] + if version_compare(self.version, self._INVALID_PCH_VERSION): + default_warn_args += ['-Winvalid-pch'] self.warn_args = {'0': [], '1': default_warn_args, '2': default_warn_args + ['-Wextra'], -- cgit v1.1