mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 16:18:19 +00:00
Minor fixes in POP3 analyzer based on flycheck warnings
This also adds an implementation of unreachable() to use for default cases where it shouldn't ever actually cause the default.
This commit is contained in:
parent
34ee136a3c
commit
bde2dec685
3 changed files with 22 additions and 5 deletions
15
src/util.h
15
src/util.h
|
@ -661,5 +661,20 @@ inline std::vector<std::wstring_view> split(const wchar_t* s, const wchar_t* del
|
|||
return split(std::wstring_view(s), std::wstring_view(delim));
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of std::unreachable. Once C++23 is supported this can be replaced with
|
||||
* an alias. This implementation is taken from cppreference.
|
||||
*/
|
||||
[[noreturn]] inline void unreachable() {
|
||||
// Uses compiler specific extensions if possible. Even if no extension is used,
|
||||
// undefined behavior is still raised by an empty function body and the noreturn
|
||||
// attribute.
|
||||
#if defined(_MSC_VER) && ! defined(__clang__) // MSVC
|
||||
__assume(false);
|
||||
#else // GCC, Clang
|
||||
__builtin_unreachable();
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace util
|
||||
} // namespace zeek
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue