From: Martin Mares Date: Sun, 6 May 2018 08:55:53 +0000 (+0200) Subject: Compatibility with GCC < 4.0 is not needed any longer X-Git-Tag: v6.5.10~8 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=c331aaf4fac9e19240a55a829a2eb3d430f72ae6;p=libucw.git Compatibility with GCC < 4.0 is not needed any longer --- diff --git a/ucw/bitops.h b/ucw/bitops.h index 0991de34..21f40c47 100644 --- a/ucw/bitops.h +++ b/ucw/bitops.h @@ -45,26 +45,9 @@ static inline uint bit_ffs(uint w) /* Count the number of bits set */ -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) - static inline uint bit_count(uint w) { return __builtin_popcount(w); } -#else - -static inline uint bit_count(uint w) -{ - uint n = 0; - while (w) - { - w &= w - 1; - n++; - } - return n; -} - -#endif - #endif diff --git a/ucw/lib.h b/ucw/lib.h index 5df7d6e1..5ce751e9 100644 --- a/ucw/lib.h +++ b/ucw/lib.h @@ -1,7 +1,7 @@ /* * The UCW Library -- Miscellaneous Functions * - * (c) 1997--2014 Martin Mares + * (c) 1997--2018 Martin Mares * (c) 2005--2014 Tomas Valla * (c) 2006 Robert Spalek * (c) 2007 Pavel Charvat @@ -99,21 +99,10 @@ #define FORMAT_CHECK(x,y,z) __attribute__((format(x,y,z))) /** Checking of printf-like format strings **/ #define likely(x) __builtin_expect((x),1) /** Use `if (likely(@x))` if @x is almost always true **/ #define unlikely(x) __builtin_expect((x),0) /** Use `if (unlikely(@x))` to hint that @x is almost always false **/ - -#if __GNUC__ >= 4 || __GNUC__ == 3 && __GNUC_MINOR__ >= 3 #define ALWAYS_INLINE inline __attribute__((always_inline)) /** Forcibly inline **/ #define NO_INLINE __attribute__((noinline)) /** Forcibly uninline **/ -#else -#define ALWAYS_INLINE inline -#endif - -#if __GNUC__ >= 4 #define LIKE_MALLOC __attribute__((malloc)) /** Function returns a "new" pointer **/ #define SENTINEL_CHECK __attribute__((sentinel)) /** The last argument must be NULL **/ -#else -#define LIKE_MALLOC -#define SENTINEL_CHECK -#endif #else #error This program requires the GNU C compiler.