Tags: ilvokhin/folly
Tags
cut xplat shim rule folly:turnsequencer Reviewed By: dtolnay Differential Revision: D77836125 fbshipit-source-id: ea63bacf1f74f63862996006051d0c190b65f25d
move xplat build rules: folly/functional/ Reviewed By: dmm-fb Differential Revision: D77344445 fbshipit-source-id: 7b4185f2b45e75af03c5ffc4d4d69ac02c60a04b
apply autodeps Reviewed By: dtolnay Differential Revision: D77518003 fbshipit-source-id: 073cd2811e887d6814485ecfbf3822a460b557a0
cut suppressions of unreachable-code around co_yield Summary: There is a bug in some versions of clang which may incorrectly mark some cases of co_yield as non-returning, and therefore code following them as unreachable. This bug is fixed in recent versions of clang, though. Differential Revision: D76867701 fbshipit-source-id: 7b16a3e0e8e6b9a454b835cc2432380dea4f6dac
fix violations of implicit-int-conversion in MicroLock Reviewed By: ot Differential Revision: D76691047 fbshipit-source-id: 95ccd43d11ff5a23347e9b4f75b16a5a46ef47ad
Macros for improved switch-case diagnostics
Summary:
C++ switch-case statements enable writing conditional statements that are
checked for exhaustiveness by the compiler. However, C++ compilers don't
enforce exhaustiveness very well. These macros enable you to explicitly opt
into truly exhaustive switch-cases, that are useful for scenarios where you
may want to deal with enums that are inputs, rather than internal invariants.
Historically, we have encountered one too many instances of SEVs caused by
improper handling of enums, so these macros are used to enable stronger, and
more explicit guarantees when writing switch-cases.
For example:
enum class logposition_t {
sealed = -1,
nonexistent = -2,
};
void foo(logposition_t logpos) {
FOLLY_EXHAUSTIVE_SWITCH(logpos, {
case logposition_t::sealed:
// handle sealed case
case logposition_t::nonexistent:
// handle nonexistent case
default:
// handle non-exceptional value
})
}
For the above, if you miss handling any case, or if you miss the default
case, the compiler will complain.
When you switch on the value of a concretely defined enum with a very large
set of values, and only need to address a sane subset of the values, you
write a flexible switch. Additionally, when you switch on the a non-enum
value (like an int), you write a flexible switch.
enum class Color {
// every color in a 64 color palette named as an enum value
};
bool isRedColor(Color c) {
FLEXIBLE_SWITCH(c, {
case Color::Red:
case Color::LightRed:
case Color::DarkRed:
return true;
default:
return false;
})
}
The above is the less common pattern for switch statements.
Reviewed By: NSProgrammer
Differential Revision: D75843990
fbshipit-source-id: ca8768b094079b331b80b6ade3c6270cbae58126
Updating hashes Summary: GitHub commits: facebook/fb303@92a9d91 facebook/fbthrift@ce9edbc facebook@82bfe10 facebook/mvfst@b480456 facebook/proxygen@398a35e facebook/wangle@a81e6cf facebookexperimental/edencommon@d48684e facebookexperimental/rust-shed@7a8899e facebookincubator/fizz@9d59cc8 facebookincubator/llm_orchestrator@faef8a4 facebookresearch/mochi@e04ccda Reviewed By: sdwilsh fbshipit-source-id: 5de757e4245c3a924b2cb9692956fe279ad41009
Fix CQS signal facebook-unused-include-check in fbcode/folly [A] [A] Reviewed By: dtolnay Differential Revision: D75339649 fbshipit-source-id: 40ff16c9c15888472ce9a77b6fff78e467d1dcdc
Default inline size for small_sorted_vector_map/set Summary: folly::small_vector itself has a default inline size of 1. Mirror this on small_sorted_vector_map/set. Reviewed By: ilvokhin Differential Revision: D74859557 fbshipit-source-id: d2072e0baef80118d5dfc08e5652883d0ad5cb0c
some function trait aliases and variables Reviewed By: Orvid Differential Revision: D74496242 fbshipit-source-id: 88ac4378cfd672acca36a12433ff7cbbcd15f2f0
PreviousNext