Skip to content

Commit 60ab2b9

Browse files
author
Davi Arnaut
committed
WL#5498: Remove dead and unused source code
Remove unused macros or macro which are always defined.
1 parent 72fbf95 commit 60ab2b9

25 files changed

Lines changed: 52 additions & 382 deletions

client/mysqltest.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8513,7 +8513,7 @@ void free_replace_column()
85138513
typedef struct st_pointer_array { /* when using array-strings */
85148514
TYPELIB typelib; /* Pointer to strings */
85158515
uchar *str; /* Strings is here */
8516-
int7 *flag; /* Flag about each var. */
8516+
uint8 *flag; /* Flag about each var. */
85178517
uint array_allocs,max_count,length,max_length;
85188518
} POINTER_ARRAY;
85198519

@@ -9644,7 +9644,7 @@ int insert_pointer_name(reg1 POINTER_ARRAY *pa,char * name)
96449644
}
96459645
pa->max_count=(PC_MALLOC-MALLOC_OVERHEAD)/(sizeof(uchar*)+
96469646
sizeof(*pa->flag));
9647-
pa->flag= (int7*) (pa->typelib.type_names+pa->max_count);
9647+
pa->flag= (uint8*) (pa->typelib.type_names+pa->max_count);
96489648
pa->length=0;
96499649
pa->max_length=PS_MALLOC-MALLOC_OVERHEAD;
96509650
pa->array_allocs=1;
@@ -9680,7 +9680,7 @@ int insert_pointer_name(reg1 POINTER_ARRAY *pa,char * name)
96809680
pa->typelib.type_names=new_array;
96819681
old_count=pa->max_count;
96829682
pa->max_count=len/(sizeof(uchar*) + sizeof(*pa->flag));
9683-
pa->flag= (int7*) (pa->typelib.type_names+pa->max_count);
9683+
pa->flag= (uint8*) (pa->typelib.type_names+pa->max_count);
96849684
memcpy((uchar*) pa->flag,(char *) (pa->typelib.type_names+old_count),
96859685
old_count*sizeof(*pa->flag));
96869686
}

extra/replace.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
typedef struct st_pointer_array { /* when using array-strings */
5252
TYPELIB typelib; /* Pointer to strings */
5353
uchar *str; /* Strings is here */
54-
int7 *flag; /* Flag about each var. */
54+
uint8 *flag; /* Flag about each var. */
5555
uint array_allocs,max_count,length,max_length;
5656
} POINTER_ARRAY;
5757

@@ -266,7 +266,7 @@ static int insert_pointer_name(reg1 POINTER_ARRAY *pa,char * name)
266266
}
267267
pa->max_count=(PC_MALLOC-MALLOC_OVERHEAD)/(sizeof(uchar*)+
268268
sizeof(*pa->flag));
269-
pa->flag= (int7*) (pa->typelib.type_names+pa->max_count);
269+
pa->flag= (uint8*) (pa->typelib.type_names+pa->max_count);
270270
pa->length=0;
271271
pa->max_length=PS_MALLOC-MALLOC_OVERHEAD;
272272
pa->array_allocs=1;
@@ -303,7 +303,7 @@ static int insert_pointer_name(reg1 POINTER_ARRAY *pa,char * name)
303303
pa->typelib.type_names=new_array;
304304
old_count=pa->max_count;
305305
pa->max_count=len/(sizeof(uchar*) + sizeof(*pa->flag));
306-
pa->flag= (int7*) (pa->typelib.type_names+pa->max_count);
306+
pa->flag= (uint8*) (pa->typelib.type_names+pa->max_count);
307307
memcpy((uchar*) pa->flag,(char *) (pa->typelib.type_names+old_count),
308308
old_count*sizeof(*pa->flag));
309309
}

include/my_attribute.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@
2121
#ifndef _my_attribute_h
2222
#define _my_attribute_h
2323

24+
#if defined(__GNUC__)
25+
# ifndef GCC_VERSION
26+
# define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
27+
# endif
28+
#endif
29+
2430
/*
2531
Disable __attribute__() on gcc < 2.7, g++ < 3.4, and non-gcc compilers.
2632
Some forms of __attribute__ are actually supported in earlier versions of

include/my_global.h

Lines changed: 3 additions & 173 deletions
Original file line numberDiff line numberDiff line change
@@ -86,24 +86,12 @@
8686
#define IF_WIN(A,B) B
8787
#endif
8888

89-
#ifndef DBUG_OFF
90-
#define IF_DBUG(A,B) A
91-
#else
92-
#define IF_DBUG(A,B) B
93-
#endif
94-
9589
#ifdef HAVE_purify
9690
#define IF_PURIFY(A,B) A
9791
#else
9892
#define IF_PURIFY(A,B) B
9993
#endif
10094

101-
#ifdef DISABLE_GRANT_OPTIONS
102-
#define IF_DISABLE_GRANT_OPTIONS(A,B) A
103-
#else
104-
#define IF_DISABLE_GRANT_OPTIONS(A,B) B
105-
#endif
106-
10795
#ifndef EMBEDDED_LIBRARY
10896
#ifdef WITH_NDB_BINLOG
10997
#define HAVE_NDB_BINLOG 1
@@ -210,78 +198,6 @@
210198
#define likely(x) __builtin_expect((x),1)
211199
#define unlikely(x) __builtin_expect((x),0)
212200

213-
214-
/*
215-
The macros below are useful in optimising places where it has been
216-
discovered that cache misses stall the process and where a prefetch
217-
of the cache line can improve matters. This is available in GCC 3.1.1
218-
and later versions.
219-
PREFETCH_READ says that addr is going to be used for reading and that
220-
it is to be kept in caches if possible for a while
221-
PREFETCH_WRITE also says that the item to be cached is likely to be
222-
updated.
223-
The *LOCALITY scripts are also available for experimentation purposes
224-
mostly and should only be used if they are verified to improve matters.
225-
For more input see GCC manual (available in GCC 3.1.1 and later)
226-
*/
227-
228-
#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR > 10)
229-
#define PREFETCH_READ(addr) __builtin_prefetch(addr, 0, 3)
230-
#define PREFETCH_WRITE(addr) \
231-
__builtin_prefetch(addr, 1, 3)
232-
#define PREFETCH_READ_LOCALITY(addr, locality) \
233-
__builtin_prefetch(addr, 0, locality)
234-
#define PREFETCH_WRITE_LOCALITY(addr, locality) \
235-
__builtin_prefetch(addr, 1, locality)
236-
#else
237-
#define PREFETCH_READ(addr)
238-
#define PREFETCH_READ_LOCALITY(addr, locality)
239-
#define PREFETCH_WRITE(addr)
240-
#define PREFETCH_WRITE_LOCALITY(addr, locality)
241-
#endif
242-
243-
/*
244-
The following macro is used to ensure that code often used in most
245-
SQL statements and definitely for parts of the SQL processing are
246-
kept in a code segment by itself. This has the advantage that the
247-
risk of common code being overlapping in caches of the CPU is less.
248-
This can be a cause of big performance problems.
249-
Routines should be put in this category with care and when they are
250-
put there one should also strive to make as much of the error handling
251-
as possible (or uncommon code of the routine) to execute in a
252-
separate method to avoid moving to much code to this code segment.
253-
254-
It is very easy to use, simply add HOT_METHOD at the end of the
255-
function declaration.
256-
For more input see GCC manual (available in GCC 2.95 and later)
257-
*/
258-
259-
#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR > 94)
260-
#define HOT_METHOD \
261-
__attribute__ ((section ("hot_code_section")))
262-
#else
263-
#define HOT_METHOD
264-
#endif
265-
266-
/*
267-
The following macro is used to ensure that popular global variables
268-
are located next to each other to avoid that they contend for the
269-
same cache lines.
270-
271-
It is very easy to use, simply add HOT_DATA at the end of the declaration
272-
of the variable, the variable must be initialised because of the way
273-
that linker works so a declaration using HOT_DATA should look like:
274-
uint global_hot_data HOT_DATA = 0;
275-
For more input see GCC manual (available in GCC 2.95 and later)
276-
*/
277-
278-
#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR > 94)
279-
#define HOT_DATA \
280-
__attribute__ ((section ("hot_data_section")))
281-
#else
282-
#define HOT_DATA
283-
#endif
284-
285201
/*
286202
now let's figure out if inline functions are supported
287203
autoconf defines 'inline' to be empty, if not
@@ -298,22 +214,6 @@
298214
/* helper macro for "instantiating" inline functions */
299215
#define STATIC_INLINE static inline
300216

301-
/*
302-
The following macros are used to control inlining a bit more than
303-
usual. These macros are used to ensure that inlining always or
304-
never occurs (independent of compilation mode).
305-
For more input see GCC manual (available in GCC 3.1.1 and later)
306-
*/
307-
308-
#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR > 10)
309-
#define ALWAYS_INLINE __attribute__ ((always_inline))
310-
#define NEVER_INLINE __attribute__ ((noinline))
311-
#else
312-
#define ALWAYS_INLINE
313-
#define NEVER_INLINE
314-
#endif
315-
316-
317217
/* Fix problem with S_ISLNK() on Linux */
318218
#if defined(TARGET_OS_LINUX) || defined(__GLIBC__)
319219
#undef _GNU_SOURCE
@@ -557,14 +457,6 @@ C_MODE_END
557457
extern "C" int madvise(void *addr, size_t len, int behav);
558458
#endif
559459

560-
/* We can not live without the following defines */
561-
562-
#define USE_MYFUNC 1 /* Must use syscall indirection */
563-
#define MASTER 1 /* Compile without unireg */
564-
#define ENGLISH 1 /* Messages in English */
565-
#define POSIX_MISTAKE 1 /* regexp: Fix stupid spec error */
566-
#define USE_REGEX 1 /* We want the use the regex library */
567-
568460
#define QUOTE_ARG(x) #x /* Quote argument (before cpp) */
569461
#define STRINGIFY_ARG(x) QUOTE_ARG(x) /* Quote argument, after cpp */
570462

@@ -606,21 +498,13 @@ extern "C" int madvise(void *addr, size_t len, int behav);
606498
#define UNINIT_VAR(x) x= x
607499
#endif
608500

609-
/* Define some useful general macros */
610-
#if !defined(max)
611-
#define max(a, b) ((a) > (b) ? (a) : (b))
612-
#define min(a, b) ((a) < (b) ? (a) : (b))
613-
#endif
614-
615501
#if !defined(HAVE_UINT)
616502
#undef HAVE_UINT
617503
#define HAVE_UINT
618504
typedef unsigned int uint;
619505
typedef unsigned short ushort;
620506
#endif
621507

622-
#define CMP_NUM(a,b) (((a) < (b)) ? -1 : ((a) == (b)) ? 0 : 1)
623-
#define sgn(a) (((a) < 0) ? -1 : ((a) > 0) ? 1 : 0)
624508
#define swap_variables(t, a, b) { t dummy; dummy= a; a= b; b= dummy; }
625509
#define test(a) ((a) ? 1 : 0)
626510
#define set_if_bigger(a,b) do { if ((a) < (b)) (a)=(b); } while(0)
@@ -634,18 +518,6 @@ typedef unsigned short ushort;
634518
#define FALSE (0) /* Logical false */
635519
#endif
636520

637-
#if defined(__GNUC__)
638-
#define function_volatile volatile
639-
#define my_reinterpret_cast(A) reinterpret_cast<A>
640-
#define my_const_cast(A) const_cast<A>
641-
# ifndef GCC_VERSION
642-
# define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
643-
# endif
644-
#elif !defined(my_reinterpret_cast)
645-
#define my_reinterpret_cast(A) (A)
646-
#define my_const_cast(A) (A)
647-
#endif
648-
649521
#include <my_compiler.h>
650522

651523
/*
@@ -672,9 +544,6 @@ C_MODE_END
672544
# endif
673545
#endif
674546

675-
#define MIN_ARRAY_SIZE 0 /* Zero or One. Gcc allows zero*/
676-
#define ASCII_BITS_USED 8 /* Bit char used */
677-
678547
/* Some types that is different between systems */
679548

680549
typedef int File; /* File descriptor */
@@ -751,14 +620,7 @@ typedef SOCKET_SIZE_TYPE size_socket;
751620
#endif /* __WIN__ */
752621

753622

754-
/* #define USE_RECORD_LOCK */
755-
756-
/* Unsigned types supported by the compiler */
757-
#define UNSINT8 /* unsigned int8 (char) */
758-
#define UNSINT16 /* unsigned int16 */
759-
#define UNSINT32 /* unsigned int32 */
760-
761-
/* General constants */
623+
/* General constants */
762624
#define FN_LEN 256 /* Max file name len */
763625
#define FN_HEADLEN 253 /* Max length of filepart of file name */
764626
#define FN_EXTLEN 20 /* Max length of extension (part of FN_LEN) */
@@ -819,10 +681,6 @@ typedef SOCKET_SIZE_TYPE size_socket;
819681
#define OS_FILE_LIMIT UINT_MAX
820682
#endif
821683

822-
/* #define EXT_IN_LIBNAME */
823-
/* #define FN_NO_CASE_SENSE */
824-
/* #define FN_UPPER_CASE TRUE */
825-
826684
/*
827685
Io buffer size; Must be a power of 2 and a multiple of 512. May be
828686
smaller what the disk page size. This influences the speed of the
@@ -847,7 +705,6 @@ typedef SOCKET_SIZE_TYPE size_socket;
847705

848706
/* Some things that this system doesn't have */
849707

850-
#define NO_HASH /* Not needed anymore */
851708
#ifdef _WIN32
852709
#define NO_DIR_LIBRARY /* Not standard dir-library */
853710
#endif
@@ -894,7 +751,6 @@ inline unsigned long long my_double2ulonglong(double d)
894751
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
895752
#endif
896753
#define ulong_to_double(X) ((double) (ulong) (X))
897-
#define SET_STACK_SIZE(X) /* Not needed on real machines */
898754

899755
#ifndef STACK_DIRECTION
900756
#error "please add -DSTACK_DIRECTION=1 or -1 to your CPPFLAGS"
@@ -1010,9 +866,6 @@ typedef long long my_ptrdiff_t;
1010866
#define MY_ALIGN(A,L) (((A) + (L) - 1) & ~((L) - 1))
1011867
#define ALIGN_SIZE(A) MY_ALIGN((A),sizeof(double))
1012868
/* Size to make adressable obj. */
1013-
#define ALIGN_PTR(A, t) ((t*) MY_ALIGN((A),sizeof(t)))
1014-
/* Offset of field f in structure t */
1015-
#define OFFSET(t, f) ((size_t)(char *)&((t *)0)->f)
1016869
#define ADD_TO_PTR(ptr,size,type) (type) ((uchar*) (ptr)+size)
1017870
#define PTR_BYTE_DIFF(A,B) (my_ptrdiff_t) ((uchar*) (A) - (uchar*) (B))
1018871

@@ -1163,14 +1016,10 @@ typedef ulong nesting_map; /* Used for flags of nesting constructs */
11631016
#define SOCKET_EMFILE EMFILE
11641017
#endif
11651018

1166-
typedef uint8 int7; /* Most effective integer 0 <= x <= 127 */
1167-
typedef short int15; /* Most effective integer 0 <= x <= 32767 */
11681019
typedef int myf; /* Type of MyFlags in my_funcs */
11691020
typedef char my_bool; /* Small bool */
1170-
/* Macros for converting *constants* to the right type */
1171-
#define INT8(v) (int8) (v)
1172-
#define INT16(v) (int16) (v)
1173-
#define INT32(v) (int32) (v)
1021+
1022+
/* Macros for converting *constants* to the right type */
11741023
#define MYF(v) (myf) (v)
11751024

11761025
#ifndef LL
@@ -1214,23 +1063,9 @@ typedef char my_bool; /* Small bool */
12141063

12151064
#include <my_dbug.h>
12161065

1217-
/*
1218-
Sometimes we want to make sure that the variable is not put into
1219-
a register in debugging mode so we can see its value in the core
1220-
*/
1221-
1222-
#ifndef DBUG_OFF
1223-
#define dbug_volatile volatile
1224-
#else
1225-
#define dbug_volatile
1226-
#endif
1227-
12281066
/* Some helper macros */
12291067
#define YESNO(X) ((X) ? "yes" : "no")
12301068

1231-
/* Defines for time function */
1232-
#define SCALE_SEC 100
1233-
#define SCALE_USEC 10000
12341069
#define MY_HOW_OFTEN_TO_ALARM 2 /* How often we want info on screen */
12351070
#define MY_HOW_OFTEN_TO_WRITE 1000 /* How often we want info on screen */
12361071

@@ -1561,11 +1396,6 @@ do { doubleget_union _tmp; \
15611396
#endif
15621397
#endif
15631398

1564-
/* FreeBSD 2.2.2 does not define RTLD_NOW) */
1565-
#ifndef RTLD_NOW
1566-
#define RTLD_NOW 1
1567-
#endif
1568-
15691399
#ifndef HAVE_DLERROR
15701400
#define dlerror() ""
15711401
#endif

0 commit comments

Comments
 (0)