]> granicus.if.org Git - icinga2/commitdiff
Quality: Prefer BOOST_{,UN}LIKELY gcc optimizer macros over our own 7300/head
authorMichael Friedrich <michael.friedrich@icinga.com>
Tue, 9 Jul 2019 11:20:53 +0000 (13:20 +0200)
committerMichael Friedrich <michael.friedrich@icinga.com>
Tue, 9 Jul 2019 11:20:53 +0000 (13:20 +0200)
Our macro collides with Boost::DateTime and the gregorian classes
and I don't see any reason why we shouldn't use Boost::Config
being already there.

lib/base/i2-base.hpp
lib/config/vmops.hpp

index 6bb75633828d532267673d2b9e6e25e4a076dbb4..58aac48030b1e0ef1e731f99e14ec03ce01adaee 100644 (file)
 #      pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 #endif
 
-#if defined(__GNUC__)
-#      define likely(x) __builtin_expect(!!(x), 1)
-#      define unlikely(x) __builtin_expect(!!(x), 0)
-#else
-#      define likely(x) (x)
-#      define unlikely(x) (x)
-#endif
-
 #define BOOST_BIND_NO_PLACEHOLDERS
 
 #include <functional>
index 72d820dfb033a960ce88d0e4405ed7eb2df22873..8bd456d405bdf8695ba384ba395e294d4af3a5a7 100644 (file)
@@ -235,10 +235,10 @@ public:
 
        static inline Value GetField(const Value& context, const String& field, bool sandboxed = false, const DebugInfo& debugInfo = DebugInfo())
        {
-               if (unlikely(context.IsEmpty() && !context.IsString()))
+               if (BOOST_UNLIKELY(context.IsEmpty() && !context.IsString()))
                        return Empty;
 
-               if (unlikely(!context.IsObject()))
+               if (BOOST_UNLIKELY(!context.IsObject()))
                        return GetPrototypeField(context, field, true, debugInfo);
 
                Object::Ptr object = context;