summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDavi Arnaut <davi.arnaut@oracle.com>2010-07-23 17:18:36 -0300
committerDavi Arnaut <davi.arnaut@oracle.com>2010-07-23 17:18:36 -0300
commitecd4a294a5d0ef4f0191993352bb0c1290e3c132 (patch)
treee39190b7222d99ca43735545cd66a9090e96e4ee /include
parente001970cc7ca527ea7e81647d2fe4b6b5afd4478 (diff)
downloadmariadb-git-ecd4a294a5d0ef4f0191993352bb0c1290e3c132.tar.gz
WL#5498: Remove dead and unused source code
Remove wrappers around inline -- static inline is used without wrappers throughout the source code. We rely on the compiler or linker to eliminate unused static functions.
Diffstat (limited to 'include')
-rw-r--r--include/my_atomic.h31
-rw-r--r--include/my_bit.h21
-rw-r--r--include/my_global.h20
3 files changed, 11 insertions, 61 deletions
diff --git a/include/my_atomic.h b/include/my_atomic.h
index a2f454ac319..c2d514012d9 100644
--- a/include/my_atomic.h
+++ b/include/my_atomic.h
@@ -155,10 +155,8 @@ make_transparent_unions(ptr)
#define U_set set
#endif /* __GCC__ transparent_union magic */
-#ifdef HAVE_INLINE
-
#define make_atomic_cas(S) \
-STATIC_INLINE int my_atomic_cas ## S(Uv_ ## S U_a, \
+static inline int my_atomic_cas ## S(Uv_ ## S U_a, \
Uv_ ## S U_cmp, U_ ## S U_set) \
{ \
int8 ret; \
@@ -167,7 +165,7 @@ STATIC_INLINE int my_atomic_cas ## S(Uv_ ## S U_a, \
}
#define make_atomic_add(S) \
-STATIC_INLINE int ## S my_atomic_add ## S( \
+static inline int ## S my_atomic_add ## S( \
Uv_ ## S U_a, U_ ## S U_v) \
{ \
make_atomic_add_body(S); \
@@ -175,7 +173,7 @@ STATIC_INLINE int ## S my_atomic_add ## S( \
}
#define make_atomic_fas(S) \
-STATIC_INLINE int ## S my_atomic_fas ## S( \
+static inline int ## S my_atomic_fas ## S( \
Uv_ ## S U_a, U_ ## S U_v) \
{ \
make_atomic_fas_body(S); \
@@ -183,7 +181,7 @@ STATIC_INLINE int ## S my_atomic_fas ## S( \
}
#define make_atomic_load(S) \
-STATIC_INLINE int ## S my_atomic_load ## S(Uv_ ## S U_a) \
+static inline int ## S my_atomic_load ## S(Uv_ ## S U_a) \
{ \
int ## S ret; \
make_atomic_load_body(S); \
@@ -191,31 +189,12 @@ STATIC_INLINE int ## S my_atomic_load ## S(Uv_ ## S U_a) \
}
#define make_atomic_store(S) \
-STATIC_INLINE void my_atomic_store ## S( \
+static inline void my_atomic_store ## S( \
Uv_ ## S U_a, U_ ## S U_v) \
{ \
make_atomic_store_body(S); \
}
-#else /* no inline functions */
-
-#define make_atomic_add(S) \
-extern int ## S my_atomic_add ## S(Uv_ ## S U_a, U_ ## S U_v);
-
-#define make_atomic_fas(S) \
-extern int ## S my_atomic_fas ## S(Uv_ ## S U_a, U_ ## S U_v);
-
-#define make_atomic_cas(S) \
-extern int my_atomic_cas ## S(Uv_ ## S U_a, Uv_ ## S U_cmp, U_ ## S U_set);
-
-#define make_atomic_load(S) \
-extern int ## S my_atomic_load ## S(Uv_ ## S U_a);
-
-#define make_atomic_store(S) \
-extern void my_atomic_store ## S(Uv_ ## S U_a, U_ ## S U_v);
-
-#endif /* HAVE_INLINE */
-
#ifdef MY_ATOMIC_HAS_8_16
make_atomic_cas(8)
make_atomic_cas(16)
diff --git a/include/my_bit.h b/include/my_bit.h
index 5cbf4f8b83e..b396b84b0d8 100644
--- a/include/my_bit.h
+++ b/include/my_bit.h
@@ -6,7 +6,6 @@
*/
C_MODE_START
-#ifdef HAVE_INLINE
extern const char _my_bits_nbits[256];
extern const uchar _my_bits_reverse_table[256];
@@ -16,14 +15,14 @@ extern const uchar _my_bits_reverse_table[256];
This can be used to divide a number with value by doing a shift instead
*/
-STATIC_INLINE uint my_bit_log2(ulong value)
+static inline uint my_bit_log2(ulong value)
{
uint bit;
for (bit=0 ; value > 1 ; value>>=1, bit++) ;
return bit;
}
-STATIC_INLINE uint my_count_bits(ulonglong v)
+static inline uint my_count_bits(ulonglong v)
{
#if SIZEOF_LONG_LONG > 4
/* The following code is a bit faster on 16 bit machines than if we would
@@ -45,7 +44,7 @@ STATIC_INLINE uint my_count_bits(ulonglong v)
#endif
}
-STATIC_INLINE uint my_count_bits_ushort(ushort v)
+static inline uint my_count_bits_ushort(ushort v)
{
return _my_bits_nbits[v];
}
@@ -70,7 +69,7 @@ STATIC_INLINE uint my_count_bits_ushort(ushort v)
Comments shows how this works with 01100000000000000000000000001011
*/
-STATIC_INLINE uint32 my_round_up_to_next_power(uint32 v)
+static inline uint32 my_round_up_to_next_power(uint32 v)
{
v--; /* 01100000000000000000000000001010 */
v|= v >> 1; /* 01110000000000000000000000001111 */
@@ -81,7 +80,7 @@ STATIC_INLINE uint32 my_round_up_to_next_power(uint32 v)
return v+1; /* 10000000000000000000000000000000 */
}
-STATIC_INLINE uint32 my_clear_highest_bit(uint32 v)
+static inline uint32 my_clear_highest_bit(uint32 v)
{
uint32 w=v >> 1;
w|= w >> 1;
@@ -92,7 +91,7 @@ STATIC_INLINE uint32 my_clear_highest_bit(uint32 v)
return v & w;
}
-STATIC_INLINE uint32 my_reverse_bits(uint32 key)
+static inline uint32 my_reverse_bits(uint32 key)
{
return
(_my_bits_reverse_table[ key & 255] << 24) |
@@ -101,14 +100,6 @@ STATIC_INLINE uint32 my_reverse_bits(uint32 key)
_my_bits_reverse_table[(key>>24) ];
}
-#else /* HAVE_INLINE */
-extern uint my_bit_log2(ulong value);
-extern uint32 my_round_up_to_next_power(uint32 v);
-uint32 my_clear_highest_bit(uint32 v);
-uint32 my_reverse_bits(uint32 key);
-extern uint my_count_bits(ulonglong v);
-extern uint my_count_bits_ushort(ushort v);
-#endif /* HAVE_INLINE */
C_MODE_END
#endif /* MY_BIT_INCLUDED */
diff --git a/include/my_global.h b/include/my_global.h
index 3cadd1b89e5..1c615cc5ca2 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -198,22 +198,6 @@
#define likely(x) __builtin_expect((x),1)
#define unlikely(x) __builtin_expect((x),0)
-/*
- now let's figure out if inline functions are supported
- autoconf defines 'inline' to be empty, if not
-*/
-#define inline_test_1(X) X ## 1
-#define inline_test_2(X) inline_test_1(X)
-#if inline_test_2(inline) != 1
-#define HAVE_INLINE
-#else
-#warning No "inline" support in C, all "static inline" functions will be instantiated in every .o file!!!
-#endif
-#undef inline_test_2
-#undef inline_test_1
-/* helper macro for "instantiating" inline functions */
-#define STATIC_INLINE static inline
-
/* Fix problem with S_ISLNK() on Linux */
#if defined(TARGET_OS_LINUX) || defined(__GLIBC__)
#undef _GNU_SOURCE
@@ -323,10 +307,6 @@ C_MODE_END
#undef HAVE_PREAD
#undef HAVE_PWRITE
#endif
-#if defined(HAVE_BROKEN_INLINE) && !defined(__cplusplus)
-#undef inline
-#define inline
-#endif
#ifdef UNDEF_HAVE_GETHOSTBYNAME_R /* For OSF4.x */
#undef HAVE_GETHOSTBYNAME_R