mirror of
https://github.com/MariaDB/server.git
synced 2026-04-21 07:45:32 +02:00
WL#5498: Remove dead and unused source code
Remove unused macros or macro which are always defined. include/my_global.h: Remove unused macros and move macros which aren't used globally.
This commit is contained in:
parent
7a344b6106
commit
75e2212397
25 changed files with 52 additions and 382 deletions
|
|
@ -21,6 +21,12 @@
|
|||
#ifndef _my_attribute_h
|
||||
#define _my_attribute_h
|
||||
|
||||
#if defined(__GNUC__)
|
||||
# ifndef GCC_VERSION
|
||||
# define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
Disable __attribute__() on gcc < 2.7, g++ < 3.4, and non-gcc compilers.
|
||||
Some forms of __attribute__ are actually supported in earlier versions of
|
||||
|
|
|
|||
|
|
@ -86,24 +86,12 @@
|
|||
#define IF_WIN(A,B) B
|
||||
#endif
|
||||
|
||||
#ifndef DBUG_OFF
|
||||
#define IF_DBUG(A,B) A
|
||||
#else
|
||||
#define IF_DBUG(A,B) B
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_purify
|
||||
#define IF_PURIFY(A,B) A
|
||||
#else
|
||||
#define IF_PURIFY(A,B) B
|
||||
#endif
|
||||
|
||||
#ifdef DISABLE_GRANT_OPTIONS
|
||||
#define IF_DISABLE_GRANT_OPTIONS(A,B) A
|
||||
#else
|
||||
#define IF_DISABLE_GRANT_OPTIONS(A,B) B
|
||||
#endif
|
||||
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
#ifdef WITH_NDB_BINLOG
|
||||
#define HAVE_NDB_BINLOG 1
|
||||
|
|
@ -210,78 +198,6 @@
|
|||
#define likely(x) __builtin_expect((x),1)
|
||||
#define unlikely(x) __builtin_expect((x),0)
|
||||
|
||||
|
||||
/*
|
||||
The macros below are useful in optimising places where it has been
|
||||
discovered that cache misses stall the process and where a prefetch
|
||||
of the cache line can improve matters. This is available in GCC 3.1.1
|
||||
and later versions.
|
||||
PREFETCH_READ says that addr is going to be used for reading and that
|
||||
it is to be kept in caches if possible for a while
|
||||
PREFETCH_WRITE also says that the item to be cached is likely to be
|
||||
updated.
|
||||
The *LOCALITY scripts are also available for experimentation purposes
|
||||
mostly and should only be used if they are verified to improve matters.
|
||||
For more input see GCC manual (available in GCC 3.1.1 and later)
|
||||
*/
|
||||
|
||||
#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR > 10)
|
||||
#define PREFETCH_READ(addr) __builtin_prefetch(addr, 0, 3)
|
||||
#define PREFETCH_WRITE(addr) \
|
||||
__builtin_prefetch(addr, 1, 3)
|
||||
#define PREFETCH_READ_LOCALITY(addr, locality) \
|
||||
__builtin_prefetch(addr, 0, locality)
|
||||
#define PREFETCH_WRITE_LOCALITY(addr, locality) \
|
||||
__builtin_prefetch(addr, 1, locality)
|
||||
#else
|
||||
#define PREFETCH_READ(addr)
|
||||
#define PREFETCH_READ_LOCALITY(addr, locality)
|
||||
#define PREFETCH_WRITE(addr)
|
||||
#define PREFETCH_WRITE_LOCALITY(addr, locality)
|
||||
#endif
|
||||
|
||||
/*
|
||||
The following macro is used to ensure that code often used in most
|
||||
SQL statements and definitely for parts of the SQL processing are
|
||||
kept in a code segment by itself. This has the advantage that the
|
||||
risk of common code being overlapping in caches of the CPU is less.
|
||||
This can be a cause of big performance problems.
|
||||
Routines should be put in this category with care and when they are
|
||||
put there one should also strive to make as much of the error handling
|
||||
as possible (or uncommon code of the routine) to execute in a
|
||||
separate method to avoid moving to much code to this code segment.
|
||||
|
||||
It is very easy to use, simply add HOT_METHOD at the end of the
|
||||
function declaration.
|
||||
For more input see GCC manual (available in GCC 2.95 and later)
|
||||
*/
|
||||
|
||||
#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR > 94)
|
||||
#define HOT_METHOD \
|
||||
__attribute__ ((section ("hot_code_section")))
|
||||
#else
|
||||
#define HOT_METHOD
|
||||
#endif
|
||||
|
||||
/*
|
||||
The following macro is used to ensure that popular global variables
|
||||
are located next to each other to avoid that they contend for the
|
||||
same cache lines.
|
||||
|
||||
It is very easy to use, simply add HOT_DATA at the end of the declaration
|
||||
of the variable, the variable must be initialised because of the way
|
||||
that linker works so a declaration using HOT_DATA should look like:
|
||||
uint global_hot_data HOT_DATA = 0;
|
||||
For more input see GCC manual (available in GCC 2.95 and later)
|
||||
*/
|
||||
|
||||
#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR > 94)
|
||||
#define HOT_DATA \
|
||||
__attribute__ ((section ("hot_data_section")))
|
||||
#else
|
||||
#define HOT_DATA
|
||||
#endif
|
||||
|
||||
/*
|
||||
now let's figure out if inline functions are supported
|
||||
autoconf defines 'inline' to be empty, if not
|
||||
|
|
@ -298,22 +214,6 @@
|
|||
/* helper macro for "instantiating" inline functions */
|
||||
#define STATIC_INLINE static inline
|
||||
|
||||
/*
|
||||
The following macros are used to control inlining a bit more than
|
||||
usual. These macros are used to ensure that inlining always or
|
||||
never occurs (independent of compilation mode).
|
||||
For more input see GCC manual (available in GCC 3.1.1 and later)
|
||||
*/
|
||||
|
||||
#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR > 10)
|
||||
#define ALWAYS_INLINE __attribute__ ((always_inline))
|
||||
#define NEVER_INLINE __attribute__ ((noinline))
|
||||
#else
|
||||
#define ALWAYS_INLINE
|
||||
#define NEVER_INLINE
|
||||
#endif
|
||||
|
||||
|
||||
/* Fix problem with S_ISLNK() on Linux */
|
||||
#if defined(TARGET_OS_LINUX) || defined(__GLIBC__)
|
||||
#undef _GNU_SOURCE
|
||||
|
|
@ -557,14 +457,6 @@ C_MODE_END
|
|||
extern "C" int madvise(void *addr, size_t len, int behav);
|
||||
#endif
|
||||
|
||||
/* We can not live without the following defines */
|
||||
|
||||
#define USE_MYFUNC 1 /* Must use syscall indirection */
|
||||
#define MASTER 1 /* Compile without unireg */
|
||||
#define ENGLISH 1 /* Messages in English */
|
||||
#define POSIX_MISTAKE 1 /* regexp: Fix stupid spec error */
|
||||
#define USE_REGEX 1 /* We want the use the regex library */
|
||||
|
||||
#define QUOTE_ARG(x) #x /* Quote argument (before cpp) */
|
||||
#define STRINGIFY_ARG(x) QUOTE_ARG(x) /* Quote argument, after cpp */
|
||||
|
||||
|
|
@ -606,12 +498,6 @@ extern "C" int madvise(void *addr, size_t len, int behav);
|
|||
#define UNINIT_VAR(x) x= x
|
||||
#endif
|
||||
|
||||
/* Define some useful general macros */
|
||||
#if !defined(max)
|
||||
#define max(a, b) ((a) > (b) ? (a) : (b))
|
||||
#define min(a, b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_UINT)
|
||||
#undef HAVE_UINT
|
||||
#define HAVE_UINT
|
||||
|
|
@ -619,8 +505,6 @@ typedef unsigned int uint;
|
|||
typedef unsigned short ushort;
|
||||
#endif
|
||||
|
||||
#define CMP_NUM(a,b) (((a) < (b)) ? -1 : ((a) == (b)) ? 0 : 1)
|
||||
#define sgn(a) (((a) < 0) ? -1 : ((a) > 0) ? 1 : 0)
|
||||
#define swap_variables(t, a, b) { t dummy; dummy= a; a= b; b= dummy; }
|
||||
#define test(a) ((a) ? 1 : 0)
|
||||
#define set_if_bigger(a,b) do { if ((a) < (b)) (a)=(b); } while(0)
|
||||
|
|
@ -634,18 +518,6 @@ typedef unsigned short ushort;
|
|||
#define FALSE (0) /* Logical false */
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#define function_volatile volatile
|
||||
#define my_reinterpret_cast(A) reinterpret_cast<A>
|
||||
#define my_const_cast(A) const_cast<A>
|
||||
# ifndef GCC_VERSION
|
||||
# define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
|
||||
# endif
|
||||
#elif !defined(my_reinterpret_cast)
|
||||
#define my_reinterpret_cast(A) (A)
|
||||
#define my_const_cast(A) (A)
|
||||
#endif
|
||||
|
||||
#include <my_compiler.h>
|
||||
|
||||
/*
|
||||
|
|
@ -672,9 +544,6 @@ C_MODE_END
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#define MIN_ARRAY_SIZE 0 /* Zero or One. Gcc allows zero*/
|
||||
#define ASCII_BITS_USED 8 /* Bit char used */
|
||||
|
||||
/* Some types that is different between systems */
|
||||
|
||||
typedef int File; /* File descriptor */
|
||||
|
|
@ -751,14 +620,7 @@ typedef SOCKET_SIZE_TYPE size_socket;
|
|||
#endif /* __WIN__ */
|
||||
|
||||
|
||||
/* #define USE_RECORD_LOCK */
|
||||
|
||||
/* Unsigned types supported by the compiler */
|
||||
#define UNSINT8 /* unsigned int8 (char) */
|
||||
#define UNSINT16 /* unsigned int16 */
|
||||
#define UNSINT32 /* unsigned int32 */
|
||||
|
||||
/* General constants */
|
||||
/* General constants */
|
||||
#define FN_LEN 256 /* Max file name len */
|
||||
#define FN_HEADLEN 253 /* Max length of filepart of file name */
|
||||
#define FN_EXTLEN 20 /* Max length of extension (part of FN_LEN) */
|
||||
|
|
@ -819,10 +681,6 @@ typedef SOCKET_SIZE_TYPE size_socket;
|
|||
#define OS_FILE_LIMIT UINT_MAX
|
||||
#endif
|
||||
|
||||
/* #define EXT_IN_LIBNAME */
|
||||
/* #define FN_NO_CASE_SENSE */
|
||||
/* #define FN_UPPER_CASE TRUE */
|
||||
|
||||
/*
|
||||
Io buffer size; Must be a power of 2 and a multiple of 512. May be
|
||||
smaller what the disk page size. This influences the speed of the
|
||||
|
|
@ -847,7 +705,6 @@ typedef SOCKET_SIZE_TYPE size_socket;
|
|||
|
||||
/* Some things that this system doesn't have */
|
||||
|
||||
#define NO_HASH /* Not needed anymore */
|
||||
#ifdef _WIN32
|
||||
#define NO_DIR_LIBRARY /* Not standard dir-library */
|
||||
#endif
|
||||
|
|
@ -894,7 +751,6 @@ inline unsigned long long my_double2ulonglong(double d)
|
|||
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
|
||||
#endif
|
||||
#define ulong_to_double(X) ((double) (ulong) (X))
|
||||
#define SET_STACK_SIZE(X) /* Not needed on real machines */
|
||||
|
||||
#ifndef STACK_DIRECTION
|
||||
#error "please add -DSTACK_DIRECTION=1 or -1 to your CPPFLAGS"
|
||||
|
|
@ -1010,9 +866,6 @@ typedef long long my_ptrdiff_t;
|
|||
#define MY_ALIGN(A,L) (((A) + (L) - 1) & ~((L) - 1))
|
||||
#define ALIGN_SIZE(A) MY_ALIGN((A),sizeof(double))
|
||||
/* Size to make adressable obj. */
|
||||
#define ALIGN_PTR(A, t) ((t*) MY_ALIGN((A),sizeof(t)))
|
||||
/* Offset of field f in structure t */
|
||||
#define OFFSET(t, f) ((size_t)(char *)&((t *)0)->f)
|
||||
#define ADD_TO_PTR(ptr,size,type) (type) ((uchar*) (ptr)+size)
|
||||
#define PTR_BYTE_DIFF(A,B) (my_ptrdiff_t) ((uchar*) (A) - (uchar*) (B))
|
||||
|
||||
|
|
@ -1163,14 +1016,10 @@ typedef ulong nesting_map; /* Used for flags of nesting constructs */
|
|||
#define SOCKET_EMFILE EMFILE
|
||||
#endif
|
||||
|
||||
typedef uint8 int7; /* Most effective integer 0 <= x <= 127 */
|
||||
typedef short int15; /* Most effective integer 0 <= x <= 32767 */
|
||||
typedef int myf; /* Type of MyFlags in my_funcs */
|
||||
typedef char my_bool; /* Small bool */
|
||||
/* Macros for converting *constants* to the right type */
|
||||
#define INT8(v) (int8) (v)
|
||||
#define INT16(v) (int16) (v)
|
||||
#define INT32(v) (int32) (v)
|
||||
|
||||
/* Macros for converting *constants* to the right type */
|
||||
#define MYF(v) (myf) (v)
|
||||
|
||||
#ifndef LL
|
||||
|
|
@ -1214,23 +1063,9 @@ typedef char my_bool; /* Small bool */
|
|||
|
||||
#include <my_dbug.h>
|
||||
|
||||
/*
|
||||
Sometimes we want to make sure that the variable is not put into
|
||||
a register in debugging mode so we can see its value in the core
|
||||
*/
|
||||
|
||||
#ifndef DBUG_OFF
|
||||
#define dbug_volatile volatile
|
||||
#else
|
||||
#define dbug_volatile
|
||||
#endif
|
||||
|
||||
/* Some helper macros */
|
||||
#define YESNO(X) ((X) ? "yes" : "no")
|
||||
|
||||
/* Defines for time function */
|
||||
#define SCALE_SEC 100
|
||||
#define SCALE_USEC 10000
|
||||
#define MY_HOW_OFTEN_TO_ALARM 2 /* How often we want info on screen */
|
||||
#define MY_HOW_OFTEN_TO_WRITE 1000 /* How often we want info on screen */
|
||||
|
||||
|
|
@ -1561,11 +1396,6 @@ do { doubleget_union _tmp; \
|
|||
#endif
|
||||
#endif
|
||||
|
||||
/* FreeBSD 2.2.2 does not define RTLD_NOW) */
|
||||
#ifndef RTLD_NOW
|
||||
#define RTLD_NOW 1
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_DLERROR
|
||||
#define dlerror() ""
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue