summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2018-04-26 16:33:05 +0300
committerMonty <monty@mariadb.org>2018-04-26 17:35:12 +0300
commit2ccd6716fc730b3ff5e1bc2f8dc08ac561db3cb4 (patch)
tree9ad948abd204d9389d8dd45cbd8bfd373f2a861c
parent0bdc15d86ea94df6ed7ac07e69309d7b9b7281b2 (diff)
downloadmariadb-git-2ccd6716fc730b3ff5e1bc2f8dc08ac561db3cb4.tar.gz
Fix a lot of compiler warnings found by -Wunused
-rw-r--r--client/mysqlbinlog.cc2
-rw-r--r--config.h.cmake4
-rw-r--r--extra/mariabackup/crc/crc-intel-pclmul.c2
-rw-r--r--include/my_base.h2
-rw-r--r--include/my_dir.h2
-rw-r--r--include/my_global.h6
-rw-r--r--sql/item.h7
-rw-r--r--sql/log.cc2
-rw-r--r--sql/log_event.cc2
-rw-r--r--sql/mysqld.cc2
-rw-r--r--sql/opt_range_mrr.cc4
-rw-r--r--sql/sql_lex.h2
-rw-r--r--storage/innobase/btr/btr0cur.cc12
-rw-r--r--storage/innobase/fil/fil0pagecompress.cc6
-rw-r--r--storage/innobase/gis/gis0sea.cc2
-rw-r--r--storage/innobase/include/dict0mem.h4
-rw-r--r--storage/innobase/include/dict0types.h1
-rw-r--r--storage/innobase/page/page0page.cc2
-rw-r--r--storage/mroonga/vendor/groonga/lib/alloc.c2
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn.h2
-rw-r--r--storage/rocksdb/rdb_buff.h2
-rw-r--r--storage/tokudb/PerconaFT/ft/serialize/block_allocator.cc2
-rw-r--r--storage/tokudb/PerconaFT/ftcxx/malloc_utils.cpp2
-rw-r--r--storage/tokudb/PerconaFT/ftcxx/malloc_utils.hpp2
-rw-r--r--storage/tokudb/PerconaFT/portability/memory.cc14
-rw-r--r--storage/tokudb/PerconaFT/portability/toku_assert.h2
-rw-r--r--storage/tokudb/PerconaFT/portability/toku_portability.h2
-rw-r--r--storage/tokudb/PerconaFT/util/scoped_malloc.cc2
-rw-r--r--storage/tokudb/ha_tokudb.h4
-rw-r--r--storage/tokudb/ha_tokudb_alter_55.cc2
-rw-r--r--storage/tokudb/ha_tokudb_update.cc2
-rw-r--r--storage/tokudb/hatoku_hton.cc10
-rw-r--r--storage/tokudb/tokudb_sysvars.cc12
-rw-r--r--storage/tokudb/tokudb_sysvars.h2
34 files changed, 60 insertions, 68 deletions
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index 44675ef7ed9..4c8709bfca6 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -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.");
diff --git a/config.h.cmake b/config.h.cmake
index d3a76c77c39..3732171892b 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -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
diff --git a/extra/mariabackup/crc/crc-intel-pclmul.c b/extra/mariabackup/crc/crc-intel-pclmul.c
index d470c2bee43..501ca71d739 100644
--- a/extra/mariabackup/crc/crc-intel-pclmul.c
+++ b/extra/mariabackup/crc/crc-intel-pclmul.c
@@ -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
diff --git a/include/my_base.h b/include/my_base.h
index 63a9710c306..c36072c0bfa 100644
--- a/include/my_base.h
+++ b/include/my_base.h
@@ -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
diff --git a/include/my_dir.h b/include/my_dir.h
index af4e640c96a..a4024516c91 100644
--- a/include/my_dir.h
+++ b/include/my_dir.h
@@ -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 */
diff --git a/include/my_global.h b/include/my_global.h
index b32389d061f..93ab4ef45b2 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -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
diff --git a/sql/item.h b/sql/item.h
index 6b15ef54311..30da1c4968a 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -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);
diff --git a/sql/log.cc b/sql/log.cc
index f61cba21f9d..9cbf2f20ca5 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -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
diff --git a/sql/log_event.cc b/sql/log_event.cc
index c6bd8f90907..c490660e3a5 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -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
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 6e1a5997e15..851082a98e4 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -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;
diff --git a/sql/opt_range_mrr.cc b/sql/opt_range_mrr.cc
index ace6208fd77..515d94e8748 100644
--- a/sql/opt_range_mrr.cc
+++ b/sql/opt_range_mrr.cc
@@ -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
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 02c2ffb6a12..610d9de364d 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -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"
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc
index 982a80edcea..1f827f567a8 100644
--- a/storage/innobase/btr/btr0cur.cc
+++ b/storage/innobase/btr/btr0cur.cc
@@ -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
diff --git a/storage/innobase/fil/fil0pagecompress.cc b/storage/innobase/fil/fil0pagecompress.cc
index 6cd0dc41aa0..30195b3021f 100644
--- a/storage/innobase/fil/fil0pagecompress.cc
+++ b/storage/innobase/fil/fil0pagecompress.cc
@@ -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;
}
diff --git a/storage/innobase/gis/gis0sea.cc b/storage/innobase/gis/gis0sea.cc
index 095b421dc48..7ca2f7d8881 100644
--- a/storage/innobase/gis/gis0sea.cc
+++ b/storage/innobase/gis/gis0sea.cc
@@ -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);
diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h
index 6b3c0282c7b..c39ed96eb9c 100644
--- a/storage/innobase/include/dict0mem.h
+++ b/storage/innobase/include/dict0mem.h
@@ -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
diff --git a/storage/innobase/include/dict0types.h b/storage/innobase/include/dict0types.h
index f9ecf9b341d..6bb2771716b 100644
--- a/storage/innobase/include/dict0types.h
+++ b/storage/innobase/include/dict0types.h
@@ -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;
diff --git a/storage/innobase/page/page0page.cc b/storage/innobase/page/page0page.cc
index 52be0548055..6ec32ee4d5b 100644
--- a/storage/innobase/page/page0page.cc
+++ b/storage/innobase/page/page0page.cc
@@ -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);
diff --git a/storage/mroonga/vendor/groonga/lib/alloc.c b/storage/mroonga/vendor/groonga/lib/alloc.c
index 5d77c19e74c..face9a3dde1 100644
--- a/storage/mroonga/vendor/groonga/lib/alloc.c
+++ b/storage/mroonga/vendor/groonga/lib/alloc.c
@@ -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)
{
diff --git a/storage/mroonga/vendor/groonga/lib/grn.h b/storage/mroonga/vendor/groonga/lib/grn.h
index 0d0768eba41..541c19d3e21 100644
--- a/storage/mroonga/vendor/groonga/lib/grn.h
+++ b/storage/mroonga/vendor/groonga/lib/grn.h
@@ -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) {\
diff --git a/storage/rocksdb/rdb_buff.h b/storage/rocksdb/rdb_buff.h
index c9647707232..df6264029fa 100644
--- a/storage/rocksdb/rdb_buff.h
+++ b/storage/rocksdb/rdb_buff.h
@@ -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)
diff --git a/storage/tokudb/PerconaFT/ft/serialize/block_allocator.cc b/storage/tokudb/PerconaFT/ft/serialize/block_allocator.cc
index 29f6daa293a..18c86539734 100644
--- a/storage/tokudb/PerconaFT/ft/serialize/block_allocator.cc
+++ b/storage/tokudb/PerconaFT/ft/serialize/block_allocator.cc
@@ -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()
diff --git a/storage/tokudb/PerconaFT/ftcxx/malloc_utils.cpp b/storage/tokudb/PerconaFT/ftcxx/malloc_utils.cpp
index fbb5aa08571..41923892a15 100644
--- a/storage/tokudb/PerconaFT/ftcxx/malloc_utils.cpp
+++ b/storage/tokudb/PerconaFT/ftcxx/malloc_utils.cpp
@@ -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 {
diff --git a/storage/tokudb/PerconaFT/ftcxx/malloc_utils.hpp b/storage/tokudb/PerconaFT/ftcxx/malloc_utils.hpp
index 3e2b591430e..786d4d1c841 100644
--- a/storage/tokudb/PerconaFT/ftcxx/malloc_utils.hpp
+++ b/storage/tokudb/PerconaFT/ftcxx/malloc_utils.hpp
@@ -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>
diff --git a/storage/tokudb/PerconaFT/portability/memory.cc b/storage/tokudb/PerconaFT/portability/memory.cc
index 9594158cf38..403abfe1d68 100644
--- a/storage/tokudb/PerconaFT/portability/memory.cc
+++ b/storage/tokudb/PerconaFT/portability/memory.cc
@@ -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);
diff --git a/storage/tokudb/PerconaFT/portability/toku_assert.h b/storage/tokudb/PerconaFT/portability/toku_assert.h
index b0a7be3287b..e8bcf5a395f 100644
--- a/storage/tokudb/PerconaFT/portability/toku_assert.h
+++ b/storage/tokudb/PerconaFT/portability/toku_assert.h
@@ -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)
diff --git a/storage/tokudb/PerconaFT/portability/toku_portability.h b/storage/tokudb/PerconaFT/portability/toku_portability.h
index e459cfb8779..dc506b129cd 100644
--- a/storage/tokudb/PerconaFT/portability/toku_portability.h
+++ b/storage/tokudb/PerconaFT/portability/toku_portability.h
@@ -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
diff --git a/storage/tokudb/PerconaFT/util/scoped_malloc.cc b/storage/tokudb/PerconaFT/util/scoped_malloc.cc
index 55bbab39332..e13e1c2424a 100644
--- a/storage/tokudb/PerconaFT/util/scoped_malloc.cc
+++ b/storage/tokudb/PerconaFT/util/scoped_malloc.cc
@@ -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) {
diff --git a/storage/tokudb/ha_tokudb.h b/storage/tokudb/ha_tokudb.h
index c80be207005..b3b86e8b528 100644
--- a/storage/tokudb/ha_tokudb.h
+++ b/storage/tokudb/ha_tokudb.h
@@ -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);
diff --git a/storage/tokudb/ha_tokudb_alter_55.cc b/storage/tokudb/ha_tokudb_alter_55.cc
index 3e6a38c97de..ac473f3cbd8 100644
--- a/storage/tokudb/ha_tokudb_alter_55.cc
+++ b/storage/tokudb/ha_tokudb_alter_55.cc
@@ -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"
diff --git a/storage/tokudb/ha_tokudb_update.cc b/storage/tokudb/ha_tokudb_update.cc
index 2e56d4c6698..105c12a569d 100644
--- a/storage/tokudb/ha_tokudb_update.cc
+++ b/storage/tokudb/ha_tokudb_update.cc
@@ -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
diff --git a/storage/tokudb/hatoku_hton.cc b/storage/tokudb/hatoku_hton.cc
index cee8575eebb..de8cc576c19 100644
--- a/storage/tokudb/hatoku_hton.cc
+++ b/storage/tokudb/hatoku_hton.cc
@@ -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,
diff --git a/storage/tokudb/tokudb_sysvars.cc b/storage/tokudb/tokudb_sysvars.cc
index bbc39dc550a..58fe5a47133 100644
--- a/storage/tokudb/tokudb_sysvars.cc
+++ b/storage/tokudb/tokudb_sysvars.cc
@@ -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);
}
diff --git a/storage/tokudb/tokudb_sysvars.h b/storage/tokudb/tokudb_sysvars.h
index 7701f211729..52489cd82ff 100644
--- a/storage/tokudb/tokudb_sysvars.h
+++ b/storage/tokudb/tokudb_sysvars.h
@@ -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