-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support lists for ObjC and ObjC++ standards #13642
base: master
Are you sure you want to change the base?
Conversation
I have tested this with Clang and with GCC, but only far enough with GCC to get to the point it fails because my GCC build doesn't have ObjC[++] support. |
|
||
|
||
class ClangCCompiler(_ClangCStds, ClangCompiler, CCompiler): | ||
class ClangCCompiler(ClangCStds, ClangCompiler, CCompiler): |
Check warning
Code scanning / CodeQL
Conflicting attributes in base classes
@@ -268,11 +235,8 @@ | |||
return [] | |||
|
|||
|
|||
class GnuCCompiler(GnuCompiler, CCompiler): | |||
class GnuCCompiler(GnuCStds, GnuCompiler, CCompiler): |
Check warning
Code scanning / CodeQL
Conflicting attributes in base classes
@@ -423,7 +413,7 @@ | |||
return [] | |||
|
|||
|
|||
class GnuCPPCompiler(_StdCPPLibMixin, GnuCompiler, CPPCompiler): | |||
class GnuCPPCompiler(_StdCPPLibMixin, GnuCPPStds, GnuCompiler, CPPCompiler): |
Check warning
Code scanning / CodeQL
Conflicting attributes in base classes
|
||
class GnuObjCCompiler(GnuCompiler, ObjCCompiler): | ||
class GnuObjCCompiler(GnuCStds, GnuCompiler, ObjCCompiler): |
Check warning
Code scanning / CodeQL
Conflicting attributes in base classes
|
||
class ClangObjCCompiler(ClangCompiler, ObjCCompiler): | ||
class ClangObjCCompiler(ClangCStds, ClangCompiler, ObjCCompiler): |
Check warning
Code scanning / CodeQL
Conflicting attributes in base classes
|
||
class GnuObjCPPCompiler(GnuCompiler, ObjCPPCompiler): | ||
|
||
class GnuObjCPPCompiler(GnuCPPStds, GnuCompiler, ObjCPPCompiler): |
Check warning
Code scanning / CodeQL
Conflicting attributes in base classes
|
||
class ClangObjCPPCompiler(ClangCompiler, ObjCPPCompiler): | ||
|
||
class ClangObjCPPCompiler(ClangCPPStds, ClangCompiler, ObjCPPCompiler): |
Check warning
Code scanning / CodeQL
Conflicting attributes in base classes
cce0240
to
f8d86c3
Compare
Should there be a test for that, to ensure every compiler supports the same syntax for |
f8d86c3
to
5a1175a
Compare
It was worth writing the tests, I found some issues that weren't being caught by our existing tests. |
5a1175a
to
76b2563
Compare
Also in the latest version, use mixins for the Apple version overrides |
76b2563
to
d4bcdc8
Compare
@@ -188,18 +156,14 @@ | |||
id = 'armltdclang' | |||
|
|||
|
|||
class AppleClangCCompiler(AppleCompilerMixin, ClangCCompiler): | |||
class AppleClangCCompiler(AppleCompilerMixin, AppleCStdsMixin, ClangCCompiler): |
Check warning
Code scanning / CodeQL
Conflicting attributes in base classes
|
||
_CPP23_VERSION = '>=12.0.0' | ||
_CPP26_VERSION = '>=17.0.0' | ||
class ClangCPPCompiler(_StdCPPLibMixin, ClangCPPStds, ClangCompiler, CPPCompiler): |
Check warning
Code scanning / CodeQL
Conflicting attributes in base classes
# TODO: We don't know which XCode version will include LLVM 17 yet, so | ||
# use something absurd. | ||
_CPP26_VERSION = '>=99.0.0' | ||
class AppleClangCPPCompiler(AppleCompilerMixin, AppleCPPStdsMixin, ClangCPPCompiler): |
Check warning
Code scanning / CodeQL
Conflicting attributes in base classes
if std != 'none': | ||
args.append('-std=' + std) | ||
return args | ||
|
||
class AppleClangObjCCompiler(ClangObjCCompiler): | ||
class AppleClangObjCCompiler(AppleCStdsMixin, ClangObjCCompiler): |
Check warning
Code scanning / CodeQL
Conflicting attributes in base classes
if std != 'none': | ||
args.append('-std=' + std) | ||
return args | ||
|
||
|
||
class AppleClangObjCPPCompiler(ClangObjCPPCompiler): | ||
class AppleClangObjCPPCompiler(AppleCPPStdsMixin, ClangObjCPPCompiler): |
Check warning
Code scanning / CodeQL
Conflicting attributes in base classes
xref #13713: it'd be good to produce a future-feature warning if ObjC is used with a list of standards. Otherwise projects might be surprised e.g. if they use Objective C on macOS, don't CI on macOS with older Meson, and switch to |
b05ecce
to
acb45fe
Compare
@bgilbert given that this series is already up to 13 patches and is fixing tons of issues with ObjC, I'd prefer to handle that separately, but I assigned that to myself and I'll have a look it at. |
e4810f9
to
bed8bee
Compare
bed8bee
to
7b81d1c
Compare
@@ -10,18 +11,18 @@ | |||
from .. import mlog | |||
from ..mesonlib import MesonException, version_compare | |||
from .c_function_attributes import C_FUNC_ATTRIBUTES | |||
from .mixins.apple import AppleCompilerMixin | |||
from .mixins.apple import AppleCompilerMixin, AppleCStdsMixin |
Check failure
Code scanning / CodeQL
Module-level cyclic import
@@ -10,18 +11,18 @@ | |||
from .. import mlog | |||
from ..mesonlib import MesonException, version_compare | |||
from .c_function_attributes import C_FUNC_ATTRIBUTES | |||
from .mixins.apple import AppleCompilerMixin | |||
from .mixins.apple import AppleCompilerMixin, AppleCStdsMixin |
Check failure
Code scanning / CodeQL
Module-level cyclic import
from .mixins.clike import CLikeCompiler | ||
from .mixins.ccrx import CcrxCompiler | ||
from .mixins.xc16 import Xc16Compiler | ||
from .mixins.compcert import CompCertCompiler | ||
from .mixins.ti import TICompiler | ||
from .mixins.arm import ArmCompiler, ArmclangCompiler | ||
from .mixins.visualstudio import MSVCCompiler, ClangClCompiler | ||
from .mixins.gnu import GnuCompiler | ||
from .mixins.gnu import GnuCompiler, GnuCStds |
Check failure
Code scanning / CodeQL
Module-level cyclic import
from .mixins.clike import CLikeCompiler | ||
from .mixins.ccrx import CcrxCompiler | ||
from .mixins.xc16 import Xc16Compiler | ||
from .mixins.compcert import CompCertCompiler | ||
from .mixins.ti import TICompiler | ||
from .mixins.arm import ArmCompiler, ArmclangCompiler | ||
from .mixins.visualstudio import MSVCCompiler, ClangClCompiler | ||
from .mixins.gnu import GnuCompiler | ||
from .mixins.gnu import GnuCompiler, GnuCStds |
Check failure
Code scanning / CodeQL
Module-level cyclic import
from .mixins.gnu import gnu_common_warning_args, gnu_c_warning_args | ||
from .mixins.intel import IntelGnuLikeCompiler, IntelVisualStudioLikeCompiler | ||
from .mixins.clang import ClangCompiler | ||
from .mixins.clang import ClangCompiler, ClangCStds |
Check failure
Code scanning / CodeQL
Module-level cyclic import
from ...linkers.linkers import AppleDynamicLinker, ClangClDynamicLinker, LLVMDynamicLinker, GnuGoldDynamicLinker, \ | ||
MoldDynamicLinker, MSVCDynamicLinker | ||
from ...options import OptionKey | ||
from ..compilers import CompileCheckMode | ||
from .gnu import GnuLikeCompiler | ||
|
||
if T.TYPE_CHECKING: | ||
from ...coredata import MutableKeyedOptionDictType |
Check failure
Code scanning / CodeQL
Module-level cyclic import
from ...environment import Environment | ||
from ...dependencies import Dependency # noqa: F401 | ||
from ..compilers import Compiler |
Check failure
Code scanning / CodeQL
Module-level cyclic import
@@ -16,11 +16,12 @@ | |||
|
|||
from ... import mesonlib | |||
from ... import mlog | |||
from ...options import OptionKey | |||
from ...options import OptionKey, UserStdOption |
Check failure
Code scanning / CodeQL
Module-level cyclic import
@@ -16,11 +16,12 @@ | |||
|
|||
from ... import mesonlib | |||
from ... import mlog | |||
from ...options import OptionKey | |||
from ...options import OptionKey, UserStdOption |
Check failure
Code scanning / CodeQL
Module-level cyclic import
from mesonbuild.compilers.compilers import CompileCheckMode | ||
|
||
if T.TYPE_CHECKING: | ||
from ..._typing import ImmutableListProtocol | ||
from ...coredata import MutableKeyedOptionDictType |
Check failure
Code scanning / CodeQL
Module-level cyclic import
ad9ca0d
to
92b11f7
Compare
from .mixins.clike import CLikeCompiler | ||
from .mixins.ccrx import CcrxCompiler | ||
from .mixins.xc16 import Xc16Compiler | ||
from .mixins.compcert import CompCertCompiler | ||
from .mixins.ti import TICompiler | ||
from .mixins.arm import ArmCompiler, ArmclangCompiler | ||
from .mixins.visualstudio import MSVCCompiler, ClangClCompiler | ||
from .mixins.gnu import GnuCompiler | ||
from .mixins.gnu import GnuCompiler, GnuCStds |
Check failure
Code scanning / CodeQL
Module-level cyclic import
from .mixins.clike import CLikeCompiler | ||
from .mixins.ccrx import CcrxCompiler | ||
from .mixins.xc16 import Xc16Compiler | ||
from .mixins.compcert import CompCertCompiler | ||
from .mixins.ti import TICompiler | ||
from .mixins.arm import ArmCompiler, ArmclangCompiler | ||
from .mixins.visualstudio import MSVCCompiler, ClangClCompiler | ||
from .mixins.gnu import GnuCompiler | ||
from .mixins.gnu import GnuCompiler, GnuCStds |
Check failure
Code scanning / CodeQL
Module-level cyclic import
92b11f7
to
9899199
Compare
9899199
to
8a18d07
Compare
d04431f
to
d2156bc
Compare
d2156bc
to
68828c4
Compare
When used as a class decorator VSCode can no longer see that BasePlatformTest is a TestCase. I hate having to adapt the code to the tools, but it's really annoying to not have completion and syntax highlighting.
We'll want to use this for ObjC as well, so we'll make it public and put it in a public place.
This means that the two compilers will update together, and that ObjC has the list behavior that C does.
…mpiler We'll want to use this for the ObjC++ compiler too.
So we can re-use it for the ObjC code
So we can re-use it in the ObjC++ standards
To avoid duplication between C and ObjC
Check clang-cl as well as cl, and clang as well as gcc.
This tests ObjC and ObjC++ both with and without C enabled. I did this because I ran into issues where ObjC only worked when C was enabled, and then a later bug where C was disabled, due to the fact that C and ObjC both use `c_std` and not `objc_std`.
Since this is optional, we should not accept that GCC is a valid ObjC or G++ is a valid ObjC++ Compiler unless we've tested that they can actually do a basic compile. This requires fixing a number of tests that have broken assumptions. In some cases I've split tests where issues with one language would hide the other. It would be great if we had a competent test framework that allowed subtests to skip, unfortunately we have python's unittest instead. Because of that we can't avoid extra tests by use of subtests.
68828c4
to
1eaab02
Compare
Also, share the implementations between the C and ObjC, and C++ and OjbC++ instance of both Clang and GNU compilers, so that we update once, and only once for each compiler.
Mostly this just ends up moving code around.
Fixes: #13639