We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0b10bce commit 5bb4cc8Copy full SHA for 5bb4cc8
1 file changed
src/uid/uid.cpp
@@ -18,6 +18,12 @@
18
19
#include "uid.h"
20
21
+#if __has_attribute(unlikely)
22
+#define UNLIKELY [[unlikely]]
23
+#else
24
+#define UNLIKELY
25
+#endif
26
+
27
28
extern "C" {
29
std::string::size_type c_get_uid(char* result, const std::string::size_type buffer_size) {
@@ -27,7 +33,7 @@ std::string::size_type c_get_uid(char* result, const std::string::size_type buff
33
34
std::string::size_type str2char(std::string_view s, char* result, const std::string::size_type buffer_size)
35
{
30
- if(s.length() >= buffer_size) [[unlikely]]
36
+ if(s.length() >= buffer_size) UNLIKELY
31
37
32
38
std::cerr << "ERROR: " << s << " " << std::make_error_code(std::errc::result_out_of_range) << "\n";
39
return 0;
0 commit comments