-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Everywhere: Move to C++26 (and remove an OSS-Fuzz workaround) #26524
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
Conversation
d15644c to
d00e1bf
Compare
| set(CMAKE_CXX_STANDARD 23) | ||
|
|
||
| # FIXME: Remove this once CMake knows that AppleClang understands -std=c++26. | ||
| if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per Discord, this might work:
# FIXME: Remove this once CMake knows that AppleClang understands -std=c++26,
# see https://gitlab.kitware.com/cmake/cmake/-/issues/27486
if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX23_STANDARD_COMPILE_OPTION "")
set(CMAKE_CXX_FLAGS "-std=c++26")
else()
set(CMAKE_CXX_STANDARD 26)
endif()
2805a57 to
40deb02
Compare
main.mm used to not do this as it didn't include AK headers. We're about to put another workaround in CocoaWrapper.h that's needed here too though. No behavior change.
No behavior change.
No behavior change.
QD/ColorSyncDeprecated.h, normally pulled in by Cocoa.h, contains
many enums triggering
"invalid arithmetic between different enumeration types"
in C++26. Omit it from the build by hackily defining its include
guard macro.
Carbon.h also pulls in QD/ColorSyncDeprecated.h, and other than in the previous commit we can't just hack it out, since that breaks other things in Carbon.h. But we only need Carbon.h for two enums in HIToolbox/Events.h, so locally define those enums directly. No behavior change.
| if: ${{ inputs.os == 'macOS' }} | ||
| shell: bash | ||
| run: | | ||
| sudo xcode-select -s /Applications/Xcode_26.1.app/Contents/Developer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
previously (and in ladybird) we've used this action to do this: https://github.com/maxim-lobanov/setup-xcode.
No real impact to use the manual way vs an action, other than a slightly 'prettier' yaml. though now that ladybird uses custom runners and blacksmith, idk if that action is still used :thonk:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd rather use a simple one-liner here than depending on some external action.
This will be necessary for moving to C++26.
This will be necessary for moving to C++26.
This will be necessary for moving to C++26.
Building OSS-Fuzz locally showed that this workaround doesn't seem to be necessary anymore.
Now that OSS-Fuzz is on LLVM 22 and the newest Apple Clang version accepts
-std=c++26, we can set ourCMAKE_CXX_STANDARDto C++26 and start using some of the fancy new features.