diff options
author | Monty <monty@mariadb.org> | 2018-04-30 15:21:52 +0300 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2018-04-30 15:21:52 +0300 |
commit | a1fe7d75dc0468ebf2f31e6e7ddeef186abcd230 (patch) | |
tree | 597212e3eec8fc08961f1d93e9d3caa52ff4db01 | |
parent | 7d6b55b99aa11bc888bdf7ad1ccdf845909a91c5 (diff) | |
download | mariadb-git-a1fe7d75dc0468ebf2f31e6e7ddeef186abcd230.tar.gz |
Removed even more warning that was found with -Wunused
- Removed test if HA_FT_WTYPE == HA_KEYTYPE_FLOAT as this never worked
(HA_KEYTYPE_FLOAT is an enum)
- Define HA_FT_MAXLEN to 126 (was tested before but never defined)
-rw-r--r-- | client/mysql_upgrade.c | 2 | ||||
-rw-r--r-- | sql-common/client_plugin.c | 2 | ||||
-rw-r--r-- | storage/innobase/buf/buf0buf.cc | 4 | ||||
-rw-r--r-- | storage/innobase/buf/buf0lru.cc | 4 | ||||
-rw-r--r-- | storage/maria/ma_create.c | 4 | ||||
-rw-r--r-- | storage/maria/ma_ft_nlq_search.c | 10 | ||||
-rw-r--r-- | storage/maria/ma_ft_update.c | 11 | ||||
-rw-r--r-- | storage/maria/ma_fulltext.h | 5 | ||||
-rw-r--r-- | storage/maria/ma_pagecache.c | 2 | ||||
-rw-r--r-- | storage/myisam/ft_nlq_search.c | 8 | ||||
-rw-r--r-- | storage/myisam/ft_update.c | 11 | ||||
-rw-r--r-- | storage/myisam/fulltext.h | 5 | ||||
-rw-r--r-- | storage/sphinx/ha_sphinx.cc | 4 | ||||
-rw-r--r-- | storage/sphinx/snippets_udf.cc | 4 | ||||
-rw-r--r-- | tests/mysql_client_test.c | 2 |
15 files changed, 28 insertions, 50 deletions
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index 0e0695c9ebe..64e0c68a9ce 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -1144,7 +1144,7 @@ int main(int argc, char **argv) load_defaults_or_exit("my", load_default_groups, &argc, &argv); defaults_argv= argv; /* Must be freed by 'free_defaults' */ -#if __WIN__ +#if defined(__WIN__) if (GetModuleFileName(NULL, self_name, FN_REFLEN) == 0) #endif { diff --git a/sql-common/client_plugin.c b/sql-common/client_plugin.c index f81660f8986..4c584d17294 100644 --- a/sql-common/client_plugin.c +++ b/sql-common/client_plugin.c @@ -28,7 +28,7 @@ There is no reference counting and no unloading either. */ -#if _MSC_VER +#if defined(_MSC_VER) /* Silence warnings about variable 'unused' being used. */ #define FORCE_INIT_OF_VARS 1 #endif diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 12d7f275e1e..250b879467d 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -7357,10 +7357,10 @@ buf_pool_reserve_tmp_slot( /* 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) size = snappy_max_compressed_length(size); #endif -#if HAVE_LZO +#if defined(HAVE_LZO) size += LZO1X_1_15_MEM_COMPRESS; #endif free_slot->comp_buf = static_cast<byte*>(aligned_malloc(size, srv_page_size)); diff --git a/storage/innobase/buf/buf0lru.cc b/storage/innobase/buf/buf0lru.cc index aadaac7c1d9..8ec2c883075 100644 --- a/storage/innobase/buf/buf0lru.cc +++ b/storage/innobase/buf/buf0lru.cc @@ -1208,10 +1208,8 @@ buf_LRU_old_adjust_len( ut_ad(buf_pool_mutex_own(buf_pool)); ut_ad(buf_pool->LRU_old_ratio >= BUF_LRU_OLD_RATIO_MIN); ut_ad(buf_pool->LRU_old_ratio <= BUF_LRU_OLD_RATIO_MAX); -#if BUF_LRU_OLD_RATIO_MIN * BUF_LRU_OLD_MIN_LEN <= BUF_LRU_OLD_RATIO_DIV * (BUF_LRU_OLD_TOLERANCE + 5) -# error "BUF_LRU_OLD_RATIO_MIN * BUF_LRU_OLD_MIN_LEN <= BUF_LRU_OLD_RATIO_DIV * (BUF_LRU_OLD_TOLERANCE + 5)" -#endif #ifdef UNIV_LRU_DEBUG + compile_time_assert(BUF_LRU_OLD_RATIO_MIN * BUF_LRU_OLD_MIN_LEN <= BUF_LRU_OLD_RATIO_DIV * (BUF_LRU_OLD_TOLERANCE + 5)); /* buf_pool->LRU_old must be the first item in the LRU list whose "old" flag is set. */ ut_a(buf_pool->LRU_old->old); diff --git a/storage/maria/ma_create.c b/storage/maria/ma_create.c index d7dcbf387c8..503d2420c41 100644 --- a/storage/maria/ma_create.c +++ b/storage/maria/ma_create.c @@ -1432,7 +1432,7 @@ int _ma_update_state_lsns(MARIA_SHARE *share, LSN lsn, TrID create_trid, @retval 1 error (disk problem) */ -#if (_MSC_VER == 1310) +#if defined(_MSC_VER) && (_MSC_VER == 1310) /* Visual Studio 2003 compiler produces internal compiler error in this function. Disable optimizations to workaround. @@ -1505,6 +1505,6 @@ int _ma_update_state_lsns_sub(MARIA_SHARE *share, LSN lsn, TrID create_trid, MARIA_FILE_CREATE_TRID_OFFSET, MYF(MY_NABP)) || (do_sync && mysql_file_sync(file, MYF(0)))); } -#if (_MSC_VER == 1310) +#if defined(_MSC_VER) && (_MSC_VER == 1310) #pragma optimize("",on) #endif /*VS2003 compiler bug workaround*/ diff --git a/storage/maria/ma_ft_nlq_search.c b/storage/maria/ma_ft_nlq_search.c index 3252b95e89e..3b0ea0baab7 100644 --- a/storage/maria/ma_ft_nlq_search.c +++ b/storage/maria/ma_ft_nlq_search.c @@ -77,11 +77,7 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio) my_off_t key_root; uint extra=HA_FT_WLEN+share->rec_reflength; MARIA_KEY key; -#if HA_FT_WTYPE == HA_KEYTYPE_FLOAT - float tmp_weight; -#else -#error -#endif + float tmp_weight; DBUG_ENTER("walk_and_match"); LINT_INIT_STRUCT(subkeys); @@ -139,12 +135,8 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio) r= _ma_search_first(info, keyinfo, key_root); goto do_skip; } -#if HA_FT_WTYPE == HA_KEYTYPE_FLOAT /* The weight we read was actually a float */ tmp_weight= subkeys.f; -#else -#error -#endif /* The following should be safe, even if we compare doubles */ if (tmp_weight==0) DBUG_RETURN(doc_cnt); /* stopword, doc_cnt should be 0 */ diff --git a/storage/maria/ma_ft_update.c b/storage/maria/ma_ft_update.c index ddf2a7251ab..1b4f018779a 100644 --- a/storage/maria/ma_ft_update.c +++ b/storage/maria/ma_ft_update.c @@ -289,17 +289,10 @@ MARIA_KEY *_ma_ft_make_key(MARIA_HA *info, MARIA_KEY *key, uint keynr, FT_WORD *wptr, my_off_t filepos) { uchar buf[HA_FT_MAXBYTELEN+16]; - DBUG_ENTER("_ma_ft_make_key"); - -#if HA_FT_WTYPE == HA_KEYTYPE_FLOAT - { float weight=(float) ((filepos==HA_OFFSET_ERROR) ? 0 : wptr->weight); - mi_float4store(buf,weight); - } -#else -#error -#endif + DBUG_ENTER("_ma_ft_make_key"); + mi_float4store(buf,weight); int2store(buf+HA_FT_WLEN,wptr->len); memcpy(buf+HA_FT_WLEN+2,wptr->pos,wptr->len); /* Can't be spatial so it's ok to call _ma_make_key directly here */ diff --git a/storage/maria/ma_fulltext.h b/storage/maria/ma_fulltext.h index 89f7268974c..dc663806d34 100644 --- a/storage/maria/ma_fulltext.h +++ b/storage/maria/ma_fulltext.h @@ -20,6 +20,11 @@ #include "maria_def.h" #include "ft_global.h" +/* If HA_FT_MAXLEN is change to 127 or over, it must be tested properly as + it may cause different representation on disk for full text indexes +*/ +#define HA_FT_MAXLEN 126 + int _ma_ft_cmp(MARIA_HA *, uint, const uchar *, const uchar *); int _ma_ft_add(MARIA_HA *, uint, uchar *, const uchar *, my_off_t); int _ma_ft_del(MARIA_HA *, uint, uchar *, const uchar *, my_off_t); diff --git a/storage/maria/ma_pagecache.c b/storage/maria/ma_pagecache.c index fd5995515c1..d10595fffd9 100644 --- a/storage/maria/ma_pagecache.c +++ b/storage/maria/ma_pagecache.c @@ -985,7 +985,7 @@ static int flush_all_key_blocks(PAGECACHE *pagecache) resizing, due to the page locking specific to this page cache. So we disable it for now. */ -#if NOT_USED /* keep disabled until code is fixed see above !! */ +#ifdef NOT_USED /* keep disabled until code is fixed see above !! */ size_t resize_pagecache(PAGECACHE *pagecache, size_t use_mem, uint division_limit, uint age_threshold, uint changed_blocks_hash_size) diff --git a/storage/myisam/ft_nlq_search.c b/storage/myisam/ft_nlq_search.c index 3945484c8eb..55fae97bb3c 100644 --- a/storage/myisam/ft_nlq_search.c +++ b/storage/myisam/ft_nlq_search.c @@ -75,11 +75,7 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio) MI_KEYDEF *keyinfo=info->s->keyinfo+aio->keynr; my_off_t key_root; uint extra= HA_FT_WLEN + info->s->rec_reflength; -#if HA_FT_WTYPE == HA_KEYTYPE_FLOAT float tmp_weight; -#else -#error -#endif DBUG_ENTER("walk_and_match"); LINT_INIT_STRUCT(subkeys); @@ -134,12 +130,8 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio) r=_mi_search_first(info, keyinfo, key_root); goto do_skip; } -#if HA_FT_WTYPE == HA_KEYTYPE_FLOAT /* The weight we read was actually a float */ tmp_weight= subkeys.f; -#else -#error -#endif /* The following should be safe, even if we compare doubles */ if (tmp_weight==0) DBUG_RETURN(doc_cnt); /* stopword, doc_cnt should be 0 */ diff --git a/storage/myisam/ft_update.c b/storage/myisam/ft_update.c index f851c0236ae..51d8ee81339 100644 --- a/storage/myisam/ft_update.c +++ b/storage/myisam/ft_update.c @@ -281,17 +281,10 @@ uint _ft_make_key(MI_INFO *info, uint keynr, uchar *keybuf, FT_WORD *wptr, my_off_t filepos) { uchar buf[HA_FT_MAXBYTELEN+16]; + float weight=(float) ((filepos==HA_OFFSET_ERROR) ? 0 : wptr->weight); DBUG_ENTER("_ft_make_key"); -#if HA_FT_WTYPE == HA_KEYTYPE_FLOAT - { - float weight=(float) ((filepos==HA_OFFSET_ERROR) ? 0 : wptr->weight); - mi_float4store(buf,weight); - } -#else -#error -#endif - + mi_float4store(buf,weight); int2store(buf+HA_FT_WLEN,wptr->len); memcpy(buf+HA_FT_WLEN+2,wptr->pos,wptr->len); DBUG_RETURN(_mi_make_key(info,keynr,(uchar*) keybuf,buf,filepos)); diff --git a/storage/myisam/fulltext.h b/storage/myisam/fulltext.h index 98b3247ba19..05e0dd9c30e 100644 --- a/storage/myisam/fulltext.h +++ b/storage/myisam/fulltext.h @@ -21,6 +21,11 @@ #include "myisamdef.h" #include "ft_global.h" +/* If HA_FT_MAXLEN is change to 127 or over, it must be tested properly as + it may cause different representation on disk for full text indexes +*/ +#define HA_FT_MAXLEN 126 + int _mi_ft_cmp(MI_INFO *, uint, const uchar *, const uchar *); int _mi_ft_add(MI_INFO *, uint, uchar *, const uchar *, my_off_t); int _mi_ft_del(MI_INFO *, uint, uchar *, const uchar *, my_off_t); diff --git a/storage/sphinx/ha_sphinx.cc b/storage/sphinx/ha_sphinx.cc index 0540ff082ce..3c6fb9ce6fc 100644 --- a/storage/sphinx/ha_sphinx.cc +++ b/storage/sphinx/ha_sphinx.cc @@ -17,7 +17,7 @@ #pragma implementation // gcc: Class implementation #endif -#if _MSC_VER>=1400 +#if defined(_MSC_VER) && _MSC_VER>=1400 #define _CRT_SECURE_NO_DEPRECATE 1 #define _CRT_NONSTDC_NO_DEPRECATE 1 #endif @@ -65,7 +65,7 @@ #define MSG_WAITALL 0 #endif -#if _MSC_VER>=1400 +#if defined(_MSC_VER) && _MSC_VER>=1400 #pragma warning(push,4) #endif diff --git a/storage/sphinx/snippets_udf.cc b/storage/sphinx/snippets_udf.cc index 77f76876819..ab2764407d8 100644 --- a/storage/sphinx/snippets_udf.cc +++ b/storage/sphinx/snippets_udf.cc @@ -45,7 +45,7 @@ typedef uchar byte; /// partially copy-pasted stuff that should be moved elsewhere -#if UNALIGNED_RAM_ACCESS +#ifdef UNALIGNED_RAM_ACCESS /// pass-through wrapper template < typename T > inline T sphUnalignedRead ( const T & tRef ) @@ -83,7 +83,7 @@ void sphUnalignedWrite ( void * pPtr, const T & tVal ) *pDst++ = *pSrc++; } -#endif +#endif /* UNALIGNED_RAM_ACCESS */ #define SPHINXSE_MAX_ALLOC (16*1024*1024) diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index fd336481439..0abeab8de1c 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -20622,7 +20622,7 @@ static struct my_tests_st my_tests[]= { #ifdef EMBEDDED_LIBRARY { "test_embedded_start_stop", test_embedded_start_stop }, #endif -#if NOT_YET_WORKING +#ifdef NOT_YET_WORKING { "test_drop_temp", test_drop_temp }, #endif { "test_fetch_seek", test_fetch_seek }, |