13
13
# See the License for the specific language governing permissions and
14
14
# limitations under the License.
15
15
16
- from mesonbuild .compilers .objc import AppleClangObjCCompiler
17
16
import time
18
17
import stat
19
18
import subprocess
79
78
run_configure_inprocess , run_mtest_inprocess
80
79
)
81
80
81
+ if T .TYPE_CHECKING :
82
+ from mesonbuild .compilers import Compiler
83
+
82
84
83
85
URLOPEN_TIMEOUT = 5
84
86
@@ -6273,13 +6275,16 @@ def test_compiler_check_flags_order(self):
6273
6275
Oargs = [arg for arg in cmd if arg .startswith ('-O' )]
6274
6276
self .assertEqual (Oargs , [Oflag , '-O0' ])
6275
6277
6276
- def _test_stds_impl (self , testdir , compiler , p : str ):
6278
+ def _test_stds_impl (self , testdir , compiler : 'Compiler' , p : str ) -> None :
6277
6279
has_cpp17 = (compiler .get_id () not in {'clang' , 'gcc' } or
6278
6280
compiler .get_id () == 'clang' and _clang_at_least (compiler , '>=5.0.0' , '>=9.1' ) or
6279
6281
compiler .get_id () == 'gcc' and version_compare (compiler .version , '>=5.0.0' ))
6280
6282
has_cpp2a_c17 = (compiler .get_id () not in {'clang' , 'gcc' } or
6281
6283
compiler .get_id () == 'clang' and _clang_at_least (compiler , '>=6.0.0' , '>=10.0' ) or
6282
6284
compiler .get_id () == 'gcc' and version_compare (compiler .version , '>=8.0.0' ))
6285
+ has_cpp20 = (compiler .get_id () not in {'clang' , 'gcc' } or
6286
+ compiler .get_id () == 'clang' and _clang_at_least (compiler , '>=10.0.0' , None ) or
6287
+ compiler .get_id () == 'gcc' and version_compare (compiler .version , '>=10.0.0' ))
6283
6288
has_c18 = (compiler .get_id () not in {'clang' , 'gcc' } or
6284
6289
compiler .get_id () == 'clang' and _clang_at_least (compiler , '>=8.0.0' , '>=11.0' ) or
6285
6290
compiler .get_id () == 'gcc' and version_compare (compiler .version , '>=8.0.0' ))
@@ -6294,6 +6299,8 @@ def _test_stds_impl(self, testdir, compiler, p: str):
6294
6299
continue
6295
6300
elif '++2a' in v and not has_cpp2a_c17 : # https://en.cppreference.com/w/cpp/compiler_support
6296
6301
continue
6302
+ elif '++20' in v and not has_cpp20 :
6303
+ continue
6297
6304
# now C
6298
6305
elif '17' in v and not has_cpp2a_c17 :
6299
6306
continue
@@ -9269,7 +9276,7 @@ def ran_in(s):
9269
9276
out = self ._subprojects_cmd (['foreach' , '--types' , 'git' ] + dummy_cmd )
9270
9277
self .assertEqual (ran_in (out ), ['subprojects/sub_git' ])
9271
9278
9272
- def _clang_at_least (compiler , minver : str , apple_minver : str ) -> bool :
9279
+ def _clang_at_least (compiler , minver : str , apple_minver : T . Optional [ str ] ) -> bool :
9273
9280
"""
9274
9281
check that Clang compiler is at least a specified version, whether AppleClang or regular Clang
9275
9282
@@ -9289,6 +9296,8 @@ def _clang_at_least(compiler, minver: str, apple_minver: str) -> bool:
9289
9296
"""
9290
9297
if isinstance (compiler , (mesonbuild .compilers .AppleClangCCompiler ,
9291
9298
mesonbuild .compilers .AppleClangCPPCompiler )):
9299
+ if apple_minver is None :
9300
+ return False
9292
9301
return version_compare (compiler .version , apple_minver )
9293
9302
return version_compare (compiler .version , minver )
9294
9303
0 commit comments