Skip to content
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

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

dcbaker
Copy link
Member

@dcbaker dcbaker commented Sep 6, 2024

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

@dcbaker
Copy link
Member Author

dcbaker commented Sep 6, 2024

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.

mesonbuild/compilers/c.py Dismissed Show dismissed Hide dismissed
mesonbuild/compilers/c.py Dismissed Show dismissed Hide dismissed
mesonbuild/compilers/c.py Fixed Show fixed Hide fixed
mesonbuild/compilers/cpp.py Fixed Show fixed Hide fixed
mesonbuild/compilers/cpp.py Dismissed Show dismissed Hide dismissed
mesonbuild/compilers/objc.py Dismissed Show dismissed Hide dismissed
mesonbuild/compilers/objc.py Dismissed Show dismissed Hide dismissed
mesonbuild/compilers/objcpp.py Dismissed Show dismissed Hide dismissed
mesonbuild/compilers/objcpp.py Dismissed Show dismissed Hide dismissed
@bruchar1
Copy link
Member

bruchar1 commented Sep 6, 2024

Should there be a test for that, to ensure every compiler supports the same syntax for std option?

@dcbaker
Copy link
Member Author

dcbaker commented Sep 12, 2024

It was worth writing the tests, I found some issues that weren't being caught by our existing tests.

mesonbuild/compilers/cpp.py Outdated Show resolved Hide resolved
unittests/allplatformstests.py Show resolved Hide resolved
@dcbaker
Copy link
Member Author

dcbaker commented Sep 25, 2024

Also in the latest version, use mixins for the Apple version overrides

mesonbuild/compilers/c.py Dismissed Show dismissed Hide dismissed
mesonbuild/compilers/cpp.py Dismissed Show dismissed Hide dismissed
mesonbuild/compilers/cpp.py Dismissed Show dismissed Hide dismissed
mesonbuild/compilers/objc.py Dismissed Show dismissed Hide dismissed
mesonbuild/compilers/objcpp.py Dismissed Show dismissed Hide dismissed
@bgilbert
Copy link
Contributor

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 c_std=gnuXX,cXX. (I tripped over this in glib, and CI caught it only because this PR hasn't shipped.)

@dcbaker dcbaker force-pushed the submit/fix-objc-standards branch 2 times, most recently from b05ecce to acb45fe Compare September 25, 2024 19:32
@dcbaker
Copy link
Member Author

dcbaker commented Sep 25, 2024

@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.

@dcbaker dcbaker force-pushed the submit/fix-objc-standards branch 2 times, most recently from e4810f9 to bed8bee Compare September 26, 2024 15:51
mesonbuild/compilers/c.py Dismissed Show dismissed Hide dismissed
mesonbuild/compilers/c.py Dismissed Show dismissed Hide dismissed
mesonbuild/compilers/c.py Dismissed Show dismissed Hide dismissed
mesonbuild/compilers/c.py Dismissed Show dismissed Hide dismissed
mesonbuild/compilers/c.py Dismissed Show dismissed Hide dismissed
mesonbuild/compilers/mixins/clang.py Dismissed Show dismissed Hide dismissed
mesonbuild/compilers/mixins/clang.py Dismissed Show dismissed Hide dismissed
mesonbuild/compilers/mixins/gnu.py Dismissed Show dismissed Hide dismissed
mesonbuild/compilers/mixins/gnu.py Dismissed Show dismissed Hide dismissed
mesonbuild/compilers/mixins/gnu.py Dismissed Show dismissed Hide dismissed
@dcbaker dcbaker force-pushed the submit/fix-objc-standards branch 3 times, most recently from fd40f7b to ad9ca0d Compare November 18, 2024 22:22
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.
mesonbuild/compilers/c.py Dismissed Show dismissed Hide dismissed
mesonbuild/compilers/c.py Dismissed Show dismissed Hide dismissed
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 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

c_std supports list but objc_std doesn't
4 participants