Commit ecd4a294 authored by Davi Arnaut's avatar Davi Arnaut

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.
parent e001970c
...@@ -1210,7 +1210,6 @@ case $SYSTEM_TYPE in ...@@ -1210,7 +1210,6 @@ case $SYSTEM_TYPE in
# Fixes for HPUX 11.0 compiler # Fixes for HPUX 11.0 compiler
if test "$ac_cv_prog_gcc" = "no" if test "$ac_cv_prog_gcc" = "no"
then then
CFLAGS="$CFLAGS -DHAVE_BROKEN_INLINE"
# set working flags first in line, letting override it (i. e. for debug): # set working flags first in line, letting override it (i. e. for debug):
CXXFLAGS="+O2 $CXXFLAGS" CXXFLAGS="+O2 $CXXFLAGS"
MAX_C_OPTIMIZE="" MAX_C_OPTIMIZE=""
...@@ -1997,6 +1996,9 @@ fi ...@@ -1997,6 +1996,9 @@ fi
dnl Checks for typedefs, structures, and compiler characteristics. dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST AC_C_CONST
AC_C_INLINE AC_C_INLINE
AS_IF([test "x$ac_cv_c_inline" = "xno"],
[AC_MSG_WARN([The C compiler does not support inline. Beware that unused
functions might not be eliminated the object files.])])
AC_TYPE_OFF_T AC_TYPE_OFF_T
AC_STRUCT_ST_RDEV AC_STRUCT_ST_RDEV
AC_HEADER_TIME AC_HEADER_TIME
......
...@@ -155,10 +155,8 @@ make_transparent_unions(ptr) ...@@ -155,10 +155,8 @@ make_transparent_unions(ptr)
#define U_set set #define U_set set
#endif /* __GCC__ transparent_union magic */ #endif /* __GCC__ transparent_union magic */
#ifdef HAVE_INLINE
#define make_atomic_cas(S) \ #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) \ Uv_ ## S U_cmp, U_ ## S U_set) \
{ \ { \
int8 ret; \ int8 ret; \
...@@ -167,7 +165,7 @@ STATIC_INLINE int my_atomic_cas ## S(Uv_ ## S U_a, \ ...@@ -167,7 +165,7 @@ STATIC_INLINE int my_atomic_cas ## S(Uv_ ## S U_a, \
} }
#define make_atomic_add(S) \ #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) \ Uv_ ## S U_a, U_ ## S U_v) \
{ \ { \
make_atomic_add_body(S); \ make_atomic_add_body(S); \
...@@ -175,7 +173,7 @@ STATIC_INLINE int ## S my_atomic_add ## S( \ ...@@ -175,7 +173,7 @@ STATIC_INLINE int ## S my_atomic_add ## S( \
} }
#define make_atomic_fas(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) \ Uv_ ## S U_a, U_ ## S U_v) \
{ \ { \
make_atomic_fas_body(S); \ make_atomic_fas_body(S); \
...@@ -183,7 +181,7 @@ STATIC_INLINE int ## S my_atomic_fas ## S( \ ...@@ -183,7 +181,7 @@ STATIC_INLINE int ## S my_atomic_fas ## S( \
} }
#define make_atomic_load(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; \ int ## S ret; \
make_atomic_load_body(S); \ make_atomic_load_body(S); \
...@@ -191,31 +189,12 @@ STATIC_INLINE int ## S my_atomic_load ## S(Uv_ ## S U_a) \ ...@@ -191,31 +189,12 @@ STATIC_INLINE int ## S my_atomic_load ## S(Uv_ ## S U_a) \
} }
#define make_atomic_store(S) \ #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) \ Uv_ ## S U_a, U_ ## S U_v) \
{ \ { \
make_atomic_store_body(S); \ 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 #ifdef MY_ATOMIC_HAS_8_16
make_atomic_cas(8) make_atomic_cas(8)
make_atomic_cas(16) make_atomic_cas(16)
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
*/ */
C_MODE_START C_MODE_START
#ifdef HAVE_INLINE
extern const char _my_bits_nbits[256]; extern const char _my_bits_nbits[256];
extern const uchar _my_bits_reverse_table[256]; extern const uchar _my_bits_reverse_table[256];
...@@ -16,14 +15,14 @@ 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 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; uint bit;
for (bit=0 ; value > 1 ; value>>=1, bit++) ; for (bit=0 ; value > 1 ; value>>=1, bit++) ;
return bit; return bit;
} }
STATIC_INLINE uint my_count_bits(ulonglong v) static inline uint my_count_bits(ulonglong v)
{ {
#if SIZEOF_LONG_LONG > 4 #if SIZEOF_LONG_LONG > 4
/* The following code is a bit faster on 16 bit machines than if we would /* 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) ...@@ -45,7 +44,7 @@ STATIC_INLINE uint my_count_bits(ulonglong v)
#endif #endif
} }
STATIC_INLINE uint my_count_bits_ushort(ushort v) static inline uint my_count_bits_ushort(ushort v)
{ {
return _my_bits_nbits[v]; return _my_bits_nbits[v];
} }
...@@ -70,7 +69,7 @@ STATIC_INLINE uint my_count_bits_ushort(ushort v) ...@@ -70,7 +69,7 @@ STATIC_INLINE uint my_count_bits_ushort(ushort v)
Comments shows how this works with 01100000000000000000000000001011 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--; /* 01100000000000000000000000001010 */
v|= v >> 1; /* 01110000000000000000000000001111 */ v|= v >> 1; /* 01110000000000000000000000001111 */
...@@ -81,7 +80,7 @@ STATIC_INLINE uint32 my_round_up_to_next_power(uint32 v) ...@@ -81,7 +80,7 @@ STATIC_INLINE uint32 my_round_up_to_next_power(uint32 v)
return v+1; /* 10000000000000000000000000000000 */ 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; uint32 w=v >> 1;
w|= w >> 1; w|= w >> 1;
...@@ -92,7 +91,7 @@ STATIC_INLINE uint32 my_clear_highest_bit(uint32 v) ...@@ -92,7 +91,7 @@ STATIC_INLINE uint32 my_clear_highest_bit(uint32 v)
return v & w; return v & w;
} }
STATIC_INLINE uint32 my_reverse_bits(uint32 key) static inline uint32 my_reverse_bits(uint32 key)
{ {
return return
(_my_bits_reverse_table[ key & 255] << 24) | (_my_bits_reverse_table[ key & 255] << 24) |
...@@ -101,14 +100,6 @@ STATIC_INLINE uint32 my_reverse_bits(uint32 key) ...@@ -101,14 +100,6 @@ STATIC_INLINE uint32 my_reverse_bits(uint32 key)
_my_bits_reverse_table[(key>>24) ]; _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 C_MODE_END
#endif /* MY_BIT_INCLUDED */ #endif /* MY_BIT_INCLUDED */
...@@ -198,22 +198,6 @@ ...@@ -198,22 +198,6 @@
#define likely(x) __builtin_expect((x),1) #define likely(x) __builtin_expect((x),1)
#define unlikely(x) __builtin_expect((x),0) #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 */ /* Fix problem with S_ISLNK() on Linux */
#if defined(TARGET_OS_LINUX) || defined(__GLIBC__) #if defined(TARGET_OS_LINUX) || defined(__GLIBC__)
#undef _GNU_SOURCE #undef _GNU_SOURCE
...@@ -323,10 +307,6 @@ C_MODE_END ...@@ -323,10 +307,6 @@ C_MODE_END
#undef HAVE_PREAD #undef HAVE_PREAD
#undef HAVE_PWRITE #undef HAVE_PWRITE
#endif #endif
#if defined(HAVE_BROKEN_INLINE) && !defined(__cplusplus)
#undef inline
#define inline
#endif
#ifdef UNDEF_HAVE_GETHOSTBYNAME_R /* For OSF4.x */ #ifdef UNDEF_HAVE_GETHOSTBYNAME_R /* For OSF4.x */
#undef HAVE_GETHOSTBYNAME_R #undef HAVE_GETHOSTBYNAME_R
......
...@@ -16,13 +16,6 @@ ...@@ -16,13 +16,6 @@
#include <my_global.h> #include <my_global.h>
#include <my_sys.h> #include <my_sys.h>
#ifndef HAVE_INLINE
/* the following will cause all inline functions to be instantiated */
#define HAVE_INLINE
#undef STATIC_INLINE
#define STATIC_INLINE extern
#endif
#include <my_atomic.h> #include <my_atomic.h>
/* /*
......
...@@ -15,13 +15,6 @@ ...@@ -15,13 +15,6 @@
#include <my_global.h> #include <my_global.h>
#ifndef HAVE_INLINE
/* the following will cause all inline functions to be instantiated */
#define HAVE_INLINE
#undef STATIC_INLINE
#define STATIC_INLINE extern
#endif
#include <my_bit.h> #include <my_bit.h>
const char _my_bits_nbits[256] = { const char _my_bits_nbits[256] = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment