Skip to content

Commit 66c2ada

Browse files
ivanallenlihuiba
authored andcommitted
[fix alibaba#909] fix compile error
`likely' and `unlikey' is also defined in dpdk or other project. Declaration conflict occur when photonlibs and dpdk are compiled together. Signed-off-by: ivanallen <ivan_allen@163.com>
1 parent e164ee3 commit 66c2ada

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

common/utility.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,13 @@ class OwnedPtr : OwnedPtr_Base
286286
}
287287
*/
288288

289+
#ifndef likely
289290
constexpr bool likely(bool expr) { return __builtin_expect(expr, true); }
291+
#endif /* likely */
292+
293+
#ifndef unlikely
290294
constexpr bool unlikely(bool expr) { return __builtin_expect(expr, false); }
295+
#endif /* unlikely */
291296

292297
int version_compare(std::string_view a, std::string_view b, int& result);
293298
int kernel_version_compare(std::string_view dst, int& result);

0 commit comments

Comments
 (0)