Fix a lot of compiler warnings found by -Wunused

This commit is contained in:
Monty 2018-04-26 16:33:05 +03:00
parent 0bdc15d86e
commit 2ccd6716fc
34 changed files with 60 additions and 68 deletions

View File

@ -2904,7 +2904,7 @@ static Exit_status dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
stdin in binary mode. Errors on setting this mode result in
halting the function and printing an error message to stderr.
*/
#if defined (__WIN__) || (_WIN64)
#if defined (__WIN__) || defined(_WIN64)
if (_setmode(fileno(stdin), O_BINARY) == -1)
{
error("Could not set binary mode on stdin.");

View File

@ -433,11 +433,11 @@
#cmakedefine strtoll @strtoll@
#cmakedefine strtoull @strtoull@
#cmakedefine vsnprintf @vsnprintf@
#if (_MSC_VER > 1800)
#if defined(_MSC_VER) && (_MSC_VER > 1800)
#define tzname _tzname
#define P_tmpdir "C:\\TEMP"
#endif
#if (_MSC_VER > 1310)
#if defined(_MSC_VER) && (_MSC_VER > 1310)
# define HAVE_SETENV
#define setenv(a,b,c) _putenv_s(a,b)
#endif

View File

@ -57,7 +57,7 @@ typedef uint8_t byte;
#if __GNUC__ >= 4 && defined(__x86_64__) && defined(HAVE_CLMUL_INSTRUCTION)
#if _GCRY_GCC_VERSION >= 40400 /* 4.4 */
#if defined(_GCRY_GCC_VERSION) && _GCRY_GCC_VERSION >= 40400 /* 4.4 */
/* Prevent compiler from issuing SSE instructions between asm blocks. */
# pragma GCC target("no-sse")
#endif

View File

@ -647,7 +647,7 @@ typedef ulong ha_rows;
#define HA_POS_ERROR (~ (ha_rows) 0)
#define HA_OFFSET_ERROR (~ (my_off_t) 0)
#if SYSTEM_SIZEOF_OFF_T == 4
#if SIZEOF_OFF_T == 4
#define MAX_FILE_SIZE INT_MAX32
#else
#define MAX_FILE_SIZE LONGLONG_MAX

View File

@ -76,7 +76,7 @@ typedef struct my_stat
#else
#if(_MSC_VER)
#if defined(_MSC_VER)
#define MY_STAT struct _stati64 /* 64 bit file size */
#else
#define MY_STAT struct stat /* Original struct has what we need */

View File

@ -710,7 +710,7 @@ typedef SOCKET_SIZE_TYPE size_socket;
#define closesocket(A) close(A)
#endif
#if (_MSC_VER)
#if defined(_MSC_VER)
#if !defined(_WIN64)
inline double my_ulonglong2double(unsigned long long value)
{
@ -1166,7 +1166,7 @@ typedef struct { const char *dli_fname, dli_fbase; } Dl_info;
/* Provide __func__ macro definition for platforms that miss it. */
#if !defined (__func__)
#if __STDC_VERSION__ < 199901L
#if defined(__STDC_VERSION__) && __STDC_VERSION__ < 199901L
# if __GNUC__ >= 2
# define __func__ __FUNCTION__
# else
@ -1258,7 +1258,7 @@ static inline double rint(double x)
CMake using getconf
*/
#if !defined(CPU_LEVEL1_DCACHE_LINESIZE) || CPU_LEVEL1_DCACHE_LINESIZE == 0
#if CPU_LEVEL1_DCACHE_LINESIZE == 0
#if defined(CPU_LEVEL1_DCACHE_LINESIZE) && CPU_LEVEL1_DCACHE_LINESIZE == 0
#undef CPU_LEVEL1_DCACHE_LINESIZE
#endif

View File

@ -3180,17 +3180,10 @@ public:
Field *result_field;
Item_null_result(THD *thd): Item_null(thd), result_field(0) {}
bool is_result_field() { return result_field != 0; }
#if MARIADB_VERSION_ID < 100300
enum_field_types field_type() const
{
return result_field->type();
}
#else
const Type_handler *type_handler() const
{
return result_field->type_handler();
}
#endif
void save_in_result_field(bool no_conversions)
{
save_in_field(result_field, no_conversions);

View File

@ -2666,7 +2666,7 @@ bool MYSQL_LOG::open(
#ifdef EMBEDDED_LIBRARY
"embedded library\n",
my_progname, server_version, MYSQL_COMPILATION_COMMENT
#elif _WIN32
#elif defined(_WIN32)
"started with:\nTCP Port: %d, Named Pipe: %s\n",
my_progname, server_version, MYSQL_COMPILATION_COMMENT,
mysqld_port, mysqld_unix_port

View File

@ -14516,7 +14516,7 @@ void Incident_log_event::pack_info(Protocol *protocol)
#endif /* MYSQL_CLIENT */
#if WITH_WSREP && !defined(MYSQL_CLIENT)
#if defined(WITH_WSREP) && !defined(MYSQL_CLIENT)
/*
read the first event from (*buf). The size of the (*buf) is (*buf_len).
At the end (*buf) is shitfed to point to the following event or NULL and

View File

@ -8998,7 +8998,7 @@ static int mysql_init_variables(void)
#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
have_ssl=SHOW_OPTION_YES;
#if HAVE_YASSL
#if defined(HAVE_YASSL)
have_openssl= SHOW_OPTION_NO;
#else
have_openssl= SHOW_OPTION_YES;

View File

@ -135,7 +135,7 @@ static void step_down_to(SEL_ARG_RANGE_SEQ *arg, SEL_ARG *key_tree)
TRUE No more ranges in the sequence
*/
#if (_MSC_FULL_VER == 160030319)
#if defined(_MSC_FULL_VER) && (_MSC_FULL_VER == 160030319)
/*
Workaround Visual Studio 2010 RTM compiler backend bug, the function enters
infinite loop.
@ -315,7 +315,7 @@ walk_up_n_right:
return 0;
}
#if (_MSC_FULL_VER == 160030319)
#if defined(_MSC_FULL_VER) && (_MSC_FULL_VER == 160030319)
/* VS2010 compiler bug workaround */
#pragma optimize("g", on)
#endif

View File

@ -173,7 +173,7 @@ struct LEX_TYPE
#define LEX_YYSTYPE void *
#else
#include "lex_symbol.h"
#if MYSQL_LEX
#ifdef MYSQL_LEX
#include "item_func.h" /* Cast_target used in sql_yacc.h */
#include "sql_get_diagnostics.h" /* Types used in sql_yacc.h */
#include "sp_pcontext.h"

View File

@ -75,18 +75,14 @@ enum btr_op_t {
BTR_DELMARK_OP /*!< Mark a record for deletion */
};
/** Modification types for the B-tree operation. */
/** Modification types for the B-tree operation.
Note that the order must be DELETE, BOTH, INSERT !!
*/
enum btr_intention_t {
BTR_INTENTION_DELETE,
BTR_INTENTION_BOTH,
BTR_INTENTION_INSERT
};
#if BTR_INTENTION_DELETE > BTR_INTENTION_BOTH
#error "BTR_INTENTION_DELETE > BTR_INTENTION_BOTH"
#endif
#if BTR_INTENTION_BOTH > BTR_INTENTION_INSERT
#error "BTR_INTENTION_BOTH > BTR_INTENTION_INSERT"
#endif
/** For the index->lock scalability improvement, only possibility of clear
performance regression observed was caused by grown huge history list length.
@ -209,6 +205,7 @@ btr_rec_free_externally_stored_fields(
/*==================== B-TREE SEARCH =========================*/
/**
#if MTR_MEMO_PAGE_S_FIX != RW_S_LATCH
#error "MTR_MEMO_PAGE_S_FIX != RW_S_LATCH"
#endif
@ -218,6 +215,7 @@ btr_rec_free_externally_stored_fields(
#if MTR_MEMO_PAGE_SX_FIX != RW_SX_LATCH
#error "MTR_MEMO_PAGE_SX_FIX != RW_SX_LATCH"
#endif
*/
/** Latches the leaf page or pages requested.
@param[in] block leaf page where the search converged

View File

@ -100,7 +100,7 @@ fil_compress_page(
int comp_level = int(level);
ulint header_len = FIL_PAGE_DATA + FIL_PAGE_COMPRESSED_SIZE;
ulint write_size = 0;
#if HAVE_LZO
#if defined(HAVE_LZO)
lzo_uint write_size_lzo = write_size;
#endif
/* Cache to avoid change during function execution */
@ -122,12 +122,12 @@ fil_compress_page(
/* Both snappy and lzo compression methods require that
output buffer used for compression is bigger than input
buffer. Increase the allocated buffer size accordingly. */
#if HAVE_SNAPPY
#if defined(HAVE_SNAPPY)
if (comp_method == PAGE_SNAPPY_ALGORITHM) {
size = snappy_max_compressed_length(size);
}
#endif
#if HAVE_LZO
#if defined(HAVE_LZO)
if (comp_method == PAGE_LZO_ALGORITHM) {
size += LZO1X_1_15_MEM_COMPRESS;
}

View File

@ -304,7 +304,7 @@ rtr_pcur_getnext_from_path(
rtr_info->thr);
}
new_split = true;
#if UNIV_GIS_DEBUG
#if defined(UNIV_GIS_DEBUG)
fprintf(stderr,
"GIS_DIAG: Splitted page found: %d, %ld\n",
static_cast<int>(need_parent), next_page_no);

View File

@ -866,8 +866,8 @@ struct dict_index_t{
in a clustered index record, if the fields
before it are known to be of a fixed size,
0 otherwise */
#if (1<<MAX_KEY_LENGTH_BITS) < MAX_KEY_LENGTH
# error (1<<MAX_KEY_LENGTH_BITS) < MAX_KEY_LENGTH
#if (1<<MAX_KEY_LENGTH_BITS) < HA_MAX_KEY_LENGTH
# error (1<<MAX_KEY_LENGTH_BITS) < HA_MAX_KEY_LENGTH
#endif
unsigned n_user_defined_cols:10;
/*!< number of columns the user defined to

View File

@ -28,6 +28,7 @@ Created 1/8/1996 Heikki Tuuri
#define dict0types_h
#include <ut0mutex.h>
#include <rem0types.h>
struct dict_sys_t;
struct dict_col_t;

View File

@ -2536,7 +2536,7 @@ page_validate(
data_size += rec_offs_size(offsets);
#if UNIV_GIS_DEBUG
#if defined(UNIV_GIS_DEBUG)
/* For spatial index, print the mbr info.*/
if (index->type & DICT_SPATIAL) {
rec_print_mbr_rec(stderr, rec, offsets);

View File

@ -644,7 +644,7 @@ grn_ctx_free_lifo(grn_ctx *ctx, void *ptr,
}
}
#if USE_DYNAMIC_MALLOC_CHANGE
#if defined(USE_DYNAMIC_MALLOC_CHANGE)
grn_malloc_func
grn_ctx_get_malloc(grn_ctx *ctx)
{

View File

@ -259,7 +259,7 @@ typedef pthread_key_t grn_thread_key;
# define THREAD_SETSPECIFIC(key, value) pthread_setspecific(key, value)
# define THREAD_GETSPECIFIC(key) pthread_getspecific(key)
#if USE_UYIELD
#if defined(USE_UYIELD)
extern int grn_uyield_count;
#define GRN_TEST_YIELD() do {\
if (((++grn_uyield_count) & (0x20 - 1)) == 0) {\

View File

@ -30,7 +30,7 @@
#define be16toh _byteswap_ushort
#endif
#if __APPLE__
#if defined(__APPLE__)
#include <libkern/OSByteOrder.h>
#define htobe64(x) OSSwapHostToBigInt64(x)
#define be64toh(x) OSSwapBigToHostInt64(x)

View File

@ -49,7 +49,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
#include "ft/serialize/block_allocator.h"
#include "ft/serialize/rbtree_mhs.h"
#if TOKU_DEBUG_PARANOID
#ifdef TOKU_DEBUG_PARANOID
#define VALIDATE() Validate()
#else
#define VALIDATE()

View File

@ -39,7 +39,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
#include "malloc_utils.hpp"
#if !HAVE_BITS_FUNCTEXCEPT_H
#if !defined(HAVE_BITS_FUNCTEXCEPT_H)
namespace std {

View File

@ -47,7 +47,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
#include <cassert>
#include <cstdlib>
#if HAVE_BITS_FUNCTEXCEPT_H
#ifdef HAVE_BITS_FUNCTEXCEPT_H
# include <bits/functexcept.h>

View File

@ -182,7 +182,7 @@ toku_memory_footprint(void * p, size_t touched)
void *
toku_malloc(size_t size) {
#if __APPLE__
#if defined(__APPLE__)
if (size == 0) {
return nullptr;
}
@ -209,7 +209,7 @@ toku_malloc(size_t size) {
}
void *toku_malloc_aligned(size_t alignment, size_t size) {
#if __APPLE__
#if defined(__APPLE__)
if (size == 0) {
return nullptr;
}
@ -245,7 +245,7 @@ toku_calloc(size_t nmemb, size_t size) {
void *
toku_realloc(void *p, size_t size) {
#if __APPLE__
#if defined(__APPLE__)
if (size == 0) {
if (p != nullptr) {
toku_free(p);
@ -276,7 +276,7 @@ toku_realloc(void *p, size_t size) {
}
void *toku_realloc_aligned(size_t alignment, void *p, size_t size) {
#if __APPLE__
#if defined(__APPLE__)
if (size == 0) {
if (p != nullptr) {
toku_free(p);
@ -345,7 +345,7 @@ toku_free(void *p) {
void *
toku_xmalloc(size_t size) {
#if __APPLE__
#if defined(__APPLE__)
if (size == 0) {
return nullptr;
}
@ -375,7 +375,7 @@ void* toku_xmalloc_aligned(size_t alignment, size_t size)
// Fail with a resource_assert if the allocation fails (don't return an error code).
// Requires: alignment is a power of two.
{
#if __APPLE__
#if defined(__APPLE__)
if (size == 0) {
return nullptr;
}
@ -409,7 +409,7 @@ toku_xcalloc(size_t nmemb, size_t size) {
void *
toku_xrealloc(void *v, size_t size) {
#if __APPLE__
#if defined(__APPLE__)
if (size == 0) {
if (v != nullptr) {
toku_free(v);

View File

@ -126,7 +126,7 @@ void db_env_do_backtrace(FILE *outf);
#define resource_assert_zero(a) assert_zero(a) // indicates resource must be available, otherwise unrecoverable
#define resource_assert_equals(a, b) assert_equals(a, b) // indicates resource must be available, otherwise unrecoverable
#if TOKU_DEBUG_PARANOID
#if defined(TOKU_DEBUG_PARANOID)
#define paranoid_invariant(a) assert(a)
#define paranoid_invariant_null(a) assert_null(a)
#define paranoid_invariant_notnull(a) assert(a)

View File

@ -71,7 +71,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
#include <sys/stat.h>
#include <stdio.h>
#if __FreeBSD__
#if defined(__FreeBSD__)
#include <stdarg.h>
#endif

View File

@ -94,7 +94,7 @@ namespace toku {
}
void destroy() {
#if TOKU_SCOPED_MALLOC_DEBUG
#ifdef TOKU_SCOPED_MALLOC_DEBUG
printf("%s %p %p\n", __FUNCTION__, this, m_stack);
#endif
if (m_stack != NULL) {

View File

@ -941,7 +941,7 @@ public:
public:
#endif
#if TOKU_INCLUDE_ALTER_55
#if defined(TOKU_INCLUDE_ALTER_55)
public:
// Returns true of the 5.6 inplace alter table interface is used.
bool try_hot_alter_table();
@ -1037,7 +1037,7 @@ private:
#if TOKU_INCLUDE_WRITE_FRM_DATA
int write_frm_data(const uchar *frm_data, size_t frm_len);
#endif
#if TOKU_INCLUDE_UPSERT
#if defined(TOKU_INCLUDE_UPSERT)
private:
int fast_update(THD *thd, List<Item> &update_fields, List<Item> &update_values, Item *conds);
bool check_fast_update(THD *thd, List<Item> &update_fields, List<Item> &update_values, Item *conds);

View File

@ -23,7 +23,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
#if TOKU_INCLUDE_ALTER_55
#if defined(TOKU_INCLUDE_ALTER_55)
#include "ha_tokudb_alter_common.cc"

View File

@ -23,7 +23,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
#if TOKU_INCLUDE_UPSERT
#if defined(TOKU_INCLUDE_UPSERT)
// Point updates and upserts

View File

@ -62,7 +62,7 @@ static bool tokudb_show_status(
THD* thd,
stat_print_fn* print,
enum ha_stat_type);
#if TOKU_INCLUDE_HANDLERTON_HANDLE_FATAL_SIGNAL
#if defined(TOKU_INCLUDE_HANDLERTON_HANDLE_FATAL_SIGNAL)
static void tokudb_handle_fatal_signal(handlerton* hton, THD* thd, int sig);
#endif
static int tokudb_close_connection(handlerton* hton, THD* thd);
@ -393,7 +393,7 @@ static int tokudb_init_func(void *p) {
tokudb_hton->panic = tokudb_end;
tokudb_hton->flush_logs = tokudb_flush_logs;
tokudb_hton->show_status = tokudb_show_status;
#if TOKU_INCLUDE_HANDLERTON_HANDLE_FATAL_SIGNAL
#if defined(TOKU_INCLUDE_HANDLERTON_HANDLE_FATAL_SIGNAL)
tokudb_hton->handle_fatal_signal = tokudb_handle_fatal_signal;
#endif
@ -1517,7 +1517,7 @@ static bool tokudb_show_status(
return false;
}
#if TOKU_INCLUDE_HANDLERTON_HANDLE_FATAL_SIGNAL
#if defined(TOKU_INCLUDE_HANDLERTON_HANDLE_FATAL_SIGNAL)
static void tokudb_handle_fatal_signal(
TOKUDB_UNUSED(handlerton* hton),
TOKUDB_UNUSD(THD* thd),
@ -1599,7 +1599,7 @@ struct st_mysql_storage_engine tokudb_storage_engine = {
MYSQL_HANDLERTON_INTERFACE_VERSION
};
#if TOKU_INCLUDE_LOCK_TIMEOUT_QUERY_STRING
#if defined(TOKU_INCLUDE_LOCK_TIMEOUT_QUERY_STRING)
struct tokudb_search_txn_extra {
bool match_found;
uint64_t match_txn_id;
@ -1768,7 +1768,7 @@ static void tokudb_lock_timeout_callback(
mysql_thread_id,
(int)qs->length,
qs->str);
#if TOKU_INCLUDE_LOCK_TIMEOUT_QUERY_STRING
#if defined(TOKU_INCLUDE_LOCK_TIMEOUT_QUERY_STRING)
uint64_t blocking_thread_id = 0;
if (tokudb_txn_id_to_client_id(
thd,

View File

@ -74,7 +74,7 @@ my_bool dir_per_db = FALSE;
char* version = (char*) TOKUDB_VERSION_STR;
// file system reserve as a percentage of total disk space
#if TOKU_INCLUDE_HANDLERTON_HANDLE_FATAL_SIGNAL
#if defined(TOKU_INCLUDE_HANDLERTON_HANDLE_FATAL_SIGNAL)
char* gdb_path = NULL;
my_bool gdb_on_fatal = FALSE;
#endif
@ -411,7 +411,7 @@ static MYSQL_SYSVAR_BOOL(dir_per_db, dir_per_db,
0, "TokuDB store ft files in db directories",
NULL, tokudb_dir_per_db_update, FALSE);
#if TOKU_INCLUDE_HANDLERTON_HANDLE_FATAL_SIGNAL
#if defined(TOKU_INCLUDE_HANDLERTON_HANDLE_FATAL_SIGNAL)
static MYSQL_SYSVAR_STR(
gdb_path,
gdb_path,
@ -894,7 +894,7 @@ static MYSQL_THDVAR_ULONGLONG(
~0ULL,
1);
#if TOKU_INCLUDE_UPSERT
#if defined(TOKU_INCLUDE_UPSERT)
static MYSQL_THDVAR_BOOL(
disable_slow_update,
PLUGIN_VAR_THDLOCAL,
@ -951,7 +951,7 @@ st_mysql_sys_var* system_variables[] = {
MYSQL_SYSVAR(version),
MYSQL_SYSVAR(write_status_frequency),
MYSQL_SYSVAR(dir_per_db),
#if TOKU_INCLUDE_HANDLERTON_HANDLE_FATAL_SIGNAL
#if defined(TOKU_INCLUDE_HANDLERTON_HANDLE_FATAL_SIGNAL)
MYSQL_SYSVAR(gdb_path),
MYSQL_SYSVAR(gdb_on_fatal),
#endif
@ -997,7 +997,7 @@ st_mysql_sys_var* system_variables[] = {
MYSQL_SYSVAR(rpl_unique_checks),
MYSQL_SYSVAR(rpl_unique_checks_delay),
#if TOKU_INCLUDE_UPSERT
#if defined(TOKU_INCLUDE_UPSERT)
MYSQL_SYSVAR(disable_slow_update),
MYSQL_SYSVAR(disable_slow_upsert),
#endif
@ -1055,7 +1055,7 @@ my_bool disable_prefetching(THD* thd) {
my_bool disable_slow_alter(THD* thd) {
return (THDVAR(thd, disable_slow_alter) != 0);
}
#if TOKU_INCLUDE_UPSERT
#if defined(TOKU_INCLUDE_UPSERT)
my_bool disable_slow_update(THD* thd) {
return (THDVAR(thd, disable_slow_update) != 0);
}

View File

@ -104,7 +104,7 @@ extern uint write_status_frequency;
extern my_bool dir_per_db;
extern char* version;
#if TOKU_INCLUDE_HANDLERTON_HANDLE_FATAL_SIGNAL
#if defined(TOKU_INCLUDE_HANDLERTON_HANDLE_FATAL_SIGNAL)
extern char* gdb_path;
extern my_bool gdb_on_fatal;
#endif