1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

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)
This commit is contained in:
Monty
2018-04-30 15:21:52 +03:00
parent 7d6b55b99a
commit a1fe7d75dc
15 changed files with 28 additions and 50 deletions

View File

@@ -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
{

View File

@@ -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

View File

@@ -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));

View File

@@ -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);

View File

@@ -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*/

View File

@@ -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
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 */

View File

@@ -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];
float weight=(float) ((filepos==HA_OFFSET_ERROR) ? 0 : wptr->weight);
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
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 */

View File

@@ -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);

View File

@@ -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)

View File

@@ -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 */

View File

@@ -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
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));

View File

@@ -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);

View File

@@ -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

View File

@@ -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)

View File

@@ -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 },