mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-10 15:14:44 +00:00
Update likely/unlikely macros to avoid double negation
I believe this should be identical to the previous code and handle the same cases (I'm guessing going by the comment that this came from a C codebase without `bool` types). The problem with the previous code is that it tripped up the `clangd` analyzer into thinking `assert()` expressions can/should be simplified via DeMorgan's to improve readability (because it was seeing the fully expanded macro).
This commit is contained in:
parent
7ee161af8d
commit
063450b8f4
1 changed files with 2 additions and 2 deletions
|
@ -310,8 +310,8 @@ void wcs2string_appending(const wchar_t *in, size_t len, std::string *receiver);
|
|||
bool should_suppress_stderr_for_tests();
|
||||
|
||||
/// Branch prediction hints. Idea borrowed from Linux kernel. Just used for asserts.
|
||||
#define likely(x) __builtin_expect(!!(x), 1)
|
||||
#define unlikely(x) __builtin_expect(!!(x), 0)
|
||||
#define likely(x) __builtin_expect(bool(x), 1)
|
||||
#define unlikely(x) __builtin_expect(bool(x), 0)
|
||||
|
||||
void assert_is_main_thread(const char *who);
|
||||
#define ASSERT_IS_MAIN_THREAD_TRAMPOLINE(x) assert_is_main_thread(x)
|
||||
|
|
Loading…
Reference in a new issue