-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
AK: Add an OptionalBase helper, and allow specializing Optional with dedicated empty values #25894
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
base: master
Are you sure you want to change the base?
Conversation
Ah wait the CI containers dont ship gcc-14? |
3f18ba3
to
5654981
Compare
5654981
to
13f16f2
Compare
@@ -4,6 +4,7 @@ set -e | |||
|
|||
script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P) | |||
|
|||
# shellcheck source=/dev/null |
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.
IIRC these don't fail in CI, but only in the pre-commit check, because we only pass the changed scripts to shellcheck
, which doesn't include shell_include.sh
.
So most (if not all) # shellcheck source=/dev/null
we already have in master might be unnecessary.
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.
Well it failed CI without the one in this exact file you point out....
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.
Weird, I have no idea why it fails here then.
I'm 99% sure that the build-image-raspberry-pi.sh
one only failed in the pre-commit hook.
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 wonder if we should pass -x
in lint-shell-scripts.sh
then. That should make these comments unnecessary.
That flag seems to do the same thing as setting external-sources=true
in .shellcheckrc
.
The man page says that option can be safely enabled for normal development: https://github.com/koalaman/shellcheck/blob/master/shellcheck.1.md#directives
You don't need to do that in this PR though.
Whoops, this breaks jakt builds |
Also Something in the NNRP code still seems off, will continue to test |
b40676b
to
fd5a34f
Compare
fd5a34f
to
4d8dcfe
Compare
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions! |
4d8dcfe
to
8b91b67
Compare
71f4a18
to
068a3ed
Compare
068a3ed
to
a5d9c77
Compare
else if constexpr (IsCallableWithArguments<decltype(Traits<T>::special_optional_empty_value), T>) | ||
return Traits<T>::special_optional_empty_value(); |
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.
Is this branch ever used? We seem to always define special_optional_empty_value(Badge<Optional<T>>)
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.
Yes, not using this version yet, as all special values are currently "illegal" values, so all APIs are currently Badge
d
left it in as it might come usefull
Note the immediate value branch is also currently unused
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.
left it in as it might come usefull
I think that we usually don't add unused code. So we should probably remove these two branches.
a5d9c77
to
7a240b0
Compare
ef12c4b
to
6c59b6b
Compare
Jakt stuff should be good on master, just drop the last commit and rebase. |
6c59b6b
to
1b4acb9
Compare
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions! |
This also makes the monadic helpers a bit stricter with their value types, hence the drive-by changes.
Not sure why it wasn't in there in the first place...
This will be needed in the next commit, as Optional then starts to call into Traits, and the affected Types initialize their own Optional so a Traits specialization needs to already be declared.
The new Optional implementation is chosen when a `Traits<T>::special_optional_empty_value` exists, this can be an immediate value or a function optionally taking a Badge<Optional<T>>. You can also define a custom specialization of `Traits<T>::optional_has_value`, as otherwise the default goes through the `==`/`!=` operators, which may not be defined.
1b4acb9
to
f297f61
Compare
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 can't really comment on the Optional
changes. That is too much C++ metapogramming for me. But here are some more general comments from me.
|
||
sudo add-apt-repository ppa:ubuntu-toolchain-r/test | ||
|
||
sudo apt-get update | ||
sudo apt-get install ccache clang-18 clang++-18 clang-format-18 lld-18 gcc-13 g++-13 libstdc++-13-dev ninja-build unzip qt6-base-dev qt6-tools-dev-tools libqt6svg6-dev qt6-multimedia-dev libgl1-mesa-dev libpulse-dev libssl-dev libegl1-mesa-dev libclang-18-dev | ||
|
||
sudo apt-get remove clang-{13,14,15} clang++-{13,14,15} libclang-{13,14,15}-dev llvm-{13,14,15} | ||
sudo apt-get remove clang-{14,15} clang++-{14,15} libclang-{14,15}-dev llvm-{14,15} |
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.
Should we remove other clang versions that are now in the repos as well?
clang-14 to clang-18 seem to be in the repos.
I think that also means we don't really need the ubuntu-toolchain PPA or LLVM toolchain repo?
.github/actions/setup/action.yml
Outdated
# cmake libgmp-dev npm shellcheck | ||
# Packages below aren't. | ||
|
||
set -e | ||
|
||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - | ||
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main' | ||
sudo add-apt-repository 'deb http://apt.llvm.org/noble/ llvm-toolchain-noble-18 main' | ||
|
||
sudo add-apt-repository ppa:ubuntu-toolchain-r/test | ||
|
||
sudo apt-get update | ||
sudo apt-get install ccache clang-18 clang++-18 clang-format-18 lld-18 gcc-13 g++-13 libstdc++-13-dev ninja-build unzip qt6-base-dev qt6-tools-dev-tools libqt6svg6-dev qt6-multimedia-dev libgl1-mesa-dev libpulse-dev libssl-dev libegl1-mesa-dev libclang-18-dev |
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.
Ninja, unzip, gcc-{13,14}, g++-{13,14}, libssl-dev, and all llvm stuff seems to be preinstalled now:
https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md
@@ -29,15 +29,15 @@ runs: | |||
sudo add-apt-repository ppa:ubuntu-toolchain-r/test | |||
|
|||
sudo apt-get update | |||
sudo apt-get install ccache clang-18 clang++-18 clang-format-18 lld-18 gcc-13 g++-13 libstdc++-13-dev ninja-build unzip qt6-base-dev qt6-tools-dev-tools libqt6svg6-dev qt6-multimedia-dev libgl1-mesa-dev libpulse-dev libssl-dev libegl1-mesa-dev libclang-18-dev | |||
sudo apt-get install ccache clang-18 clang++-18 clang-format-18 lld-18 gcc-14 g++-14 libstdc++-13-dev ninja-build unzip qt6-base-dev qt6-tools-dev-tools libqt6svg6-dev qt6-multimedia-dev libgl1-mesa-dev libpulse-dev libssl-dev libegl1-mesa-dev libclang-18-dev |
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 you want libstdc++-14
here if we want to keep installing gcc packages explicitly.
@@ -69,7 +69,7 @@ runs: | |||
|
|||
sudo apt-get update | |||
sudo apt-get remove clang-{14,15} clang++-{14,15} libclang-{14,15}-dev llvm-{14,15} | |||
sudo apt-get install clang-format-18 ccache e2fsprogs gcc-13 g++-13 libstdc++-13-dev libmpfr-dev libmpc-dev ninja-build optipng qemu-utils qemu-system-i386 unzip generate-ninja libegl1-mesa-dev | |||
sudo apt-get install clang-format-18 ccache e2fsprogs gcc-14 g++-14 libstdc++-13-dev libmpfr-dev libmpc-dev ninja-build optipng qemu-utils qemu-system-i386 unzip generate-ninja libegl1-mesa-dev |
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.
Same here
#### GCC 14 or Clang 18+ | ||
|
||
A host compiler that supports C++23 features is required for building host tools, the newer the better. Tested versions include gcc-13 and Clang 17 through 19. | ||
A host compiler that supports C++23 features is required for building host tools, the newer the better. Tested versions include gcc-14 and Clang 18 through 19. |
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.
GCC 15 and Clang 20 as well.
find_newest_compiler clang clang-18 /opt/homebrew/opt/llvm/bin/clang | ||
if is_supported_compiler "$HOST_COMPILER"; then | ||
export CC="${HOST_COMPILER}" | ||
export CXX="${HOST_COMPILER/clang/clang++}" | ||
return | ||
fi | ||
|
||
find_newest_compiler egcc gcc gcc-13 gcc-14 /usr/local/bin/gcc-{13,14} /opt/homebrew/bin/gcc-{13,14} | ||
find_newest_compiler egcc gcc gcc-14 /usr/local/bin/gcc-14 /opt/homebrew/bin/gcc-14 |
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.
What about Clang 19/20 and GCC 15?
@@ -25,13 +25,13 @@ sudo add-apt-repository ppa:canonical-server/server-backports | |||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - | |||
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main' | |||
apt update | |||
apt install git build-essential make cmake clang-format-16 gcc-13 g++-13 libstdc++-13-dev libgmp-dev ccache libmpfr-dev libmpc-dev ninja-build e2fsprogs qemu-utils qemu-system-i386 wabt | |||
apt install git build-essential make cmake clang-format-16 gcc-14 g++-14 libstdc++-13-dev libgmp-dev ccache libmpfr-dev libmpc-dev ninja-build e2fsprogs qemu-utils qemu-system-i386 wabt |
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.
Also this libstdc++-13-dev here.
@@ -25,13 +25,13 @@ sudo add-apt-repository ppa:canonical-server/server-backports | |||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - | |||
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main' | |||
apt update | |||
apt install git build-essential make cmake clang-format-16 gcc-13 g++-13 libstdc++-13-dev libgmp-dev ccache libmpfr-dev libmpc-dev ninja-build e2fsprogs qemu-utils qemu-system-i386 wabt | |||
apt install git build-essential make cmake clang-format-16 gcc-14 g++-14 libstdc++-13-dev libgmp-dev ccache libmpfr-dev libmpc-dev ninja-build e2fsprogs qemu-utils qemu-system-i386 wabt | |||
``` | |||
|
|||
### Force usage of GCC 13 |
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.
GCC 14
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.
You also need to update
- "brew install gcc@13" in BuildInstructionsMacOS.md
- "a suitable C++ compiler (g++ >= 13, clang >= 14, Apple Clang >= 14.3) via the CMAKE_CXX_COMPILER and" in BuildInstructionsLadybird.md
- "Toolchain/Local/x86_64/x86_64-pc-serenity/include/c++/13.1.0" in QtCreatorConfiguration.md
- "If you have Xcode version 14.2 or older, also install a newer host compiler from homebrew. Xcode 14.3 is known to work." in BuildInstructionsMacOS.md
- "Xcode 14 versions before 14.3 might crash while building ladybird. Xcode 14.3 or clang from homebrew may be required to successfully build ladybird." in BuildInstructionsLadybird.md
class MACAddress; | ||
template<> | ||
struct Traits<MACAddress>; |
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.
These forward declarations seem unrelated.
I think you meant to add them in the next commit?
CC: @LucasChollet
CC: @nico to cross check if apple-clang really supports this or if wikipedia is weird
CC: Whoever knows if the CI changes are correct
Based on LadybirdBrowser/ladybird#2032
But still need to cherry-pick and adapt the String changes
Depends on #25891 for the GCC version bump