Skip to content

Commit

Permalink
Fix a lot of compiler warnings found by -Wunused
Browse files Browse the repository at this point in the history
  • Loading branch information
montywi committed Apr 26, 2018
1 parent 0bdc15d commit 2ccd671
Show file tree
Hide file tree
Showing 34 changed files with 60 additions and 68 deletions.
2 changes: 1 addition & 1 deletion client/mysqlbinlog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
Expand Down
4 changes: 2 additions & 2 deletions config.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion extra/mariabackup/crc/crc-intel-pclmul.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/my_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/my_dir.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
6 changes: 3 additions & 3 deletions include/my_global.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
7 changes: 0 additions & 7 deletions sql/item.h
Original file line number Diff line number Diff line change
Expand Up @@ -3180,17 +3180,10 @@ class Item_null_result :public Item_null
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);
Expand Down
2 changes: 1 addition & 1 deletion sql/log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion sql/log_event.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion sql/mysqld.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions sql/opt_range_mrr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -315,7 +315,7 @@ bool sel_arg_range_seq_next(range_seq_t rseq, KEY_MULTI_RANGE *range)
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
Expand Down
2 changes: 1 addition & 1 deletion sql/sql_lex.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
12 changes: 5 additions & 7 deletions storage/innobase/btr/btr0cur.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions storage/innobase/fil/fil0pagecompress.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/gis/gis0sea.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions storage/innobase/include/dict0mem.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions storage/innobase/include/dict0types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/page/page0page.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion storage/mroonga/vendor/groonga/lib/alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion storage/mroonga/vendor/groonga/lib/grn.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) {\
Expand Down
2 changes: 1 addition & 1 deletion storage/rocksdb/rdb_buff.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion storage/tokudb/PerconaFT/ft/serialize/block_allocator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion storage/tokudb/PerconaFT/ftcxx/malloc_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion storage/tokudb/PerconaFT/ftcxx/malloc_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
14 changes: 7 additions & 7 deletions storage/tokudb/PerconaFT/portability/memory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -345,7 +345,7 @@ toku_free(void *p) {

void *
toku_xmalloc(size_t size) {
#if __APPLE__
#if defined(__APPLE__)
if (size == 0) {
return nullptr;
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion storage/tokudb/PerconaFT/portability/toku_assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion storage/tokudb/PerconaFT/portability/toku_portability.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion storage/tokudb/PerconaFT/util/scoped_malloc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading

0 comments on commit 2ccd671

Please sign in to comment.