Tags: facebook/folly
Tags
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
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 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
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
Remove comments about madvise and CPUThreadPoolExecutor Summary: CPUThreadPoolExecutor does not madvise-away the stacks of idle threads. Reviewed By: Gownta Differential Revision: D73703935 fbshipit-source-id: c1e777fa6641912a43644d5b853f32aeaa086204
PreviousNext