diff options
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/compilers/c.py | 11 | ||||
-rw-r--r-- | mesonbuild/mesonlib.py | 6 |
2 files changed, 10 insertions, 7 deletions
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index 3b58a07..fb2f8c5 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -89,13 +89,16 @@ class ClangCCompiler(ClangCompiler, CCompiler): opts = CCompiler.get_options(self) c_stds = ['c89', 'c99', 'c11'] g_stds = ['gnu89', 'gnu99', 'gnu11'] - if self.compiler_type is CompilerType.CLANG_OSX: - v = '>=10.0.0' - else: - v = '>=7.0.0' + # https://releases.llvm.org/6.0.0/tools/clang/docs/ReleaseNotes.html + # https://en.wikipedia.org/wiki/Xcode#Latest_versions + v = '>=10.0.0' if self.compiler_type is CompilerType.CLANG_OSX else '>=6.0.0' if version_compare(self.version, v): c_stds += ['c17'] g_stds += ['gnu17'] + v = '>=11.0.0' if self.compiler_type is CompilerType.CLANG_OSX else '>=8.0.0' + if version_compare(self.version, v): + c_stds += ['c18'] + g_stds += ['gnu18'] opts.update({'c_std': coredata.UserComboOption('C language standard to use', ['none'] + c_stds + g_stds, 'none')}) diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py index d052a2b..485a0e1 100644 --- a/mesonbuild/mesonlib.py +++ b/mesonbuild/mesonlib.py @@ -574,7 +574,7 @@ class Version: # otherwise, the version with a suffix remaining is greater return comparator(len(self._v), len(other._v)) -def _version_extract_cmpop(vstr2): +def _version_extract_cmpop(vstr2: str) -> tuple: if vstr2.startswith('>='): cmpop = operator.ge vstr2 = vstr2[2:] @@ -601,7 +601,7 @@ def _version_extract_cmpop(vstr2): return (cmpop, vstr2) -def version_compare(vstr1, vstr2): +def version_compare(vstr1: str, vstr2: str) -> bool: (cmpop, vstr2) = _version_extract_cmpop(vstr2) return cmpop(Version(vstr1), Version(vstr2)) @@ -619,7 +619,7 @@ def version_compare_many(vstr1, conditions): # determine if the minimum version satisfying the condition |condition| exceeds # the minimum version for a feature |minimum| -def version_compare_condition_with_min(condition, minimum): +def version_compare_condition_with_min(condition, minimum) -> bool: if condition.startswith('>='): cmpop = operator.le condition = condition[2:] |