summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2013-11-28 22:35:59 +0100
committerSergei Golubchik <sergii@pisem.net>2013-11-28 22:35:59 +0100
commitab3604989c826aeda3fed147db64756a66361fb3 (patch)
tree7b0e06b600e210e9597267747a9552e2d7304189 /sql
parent38c91c067ba36e1bdc11ded707db9b9f0c84b871 (diff)
downloadmariadb-git-ab3604989c826aeda3fed147db64756a66361fb3.tar.gz
MDEV-4243 [PATCH] Warnings/errors while compiling with clang
fix the code to compile with clang. fix warnings too. include/probes_mysql_nodtrace.h: clang++ doesn't like numeric _constants_ being used in || (it suspects that the intention was | ). Boolean constants are ok. sql/hostname.cc: only used in DBUG_ASSERT sql/item.cc: str_to_time and str_to_datetime return bool, not MYSQL_TIMESTAMP_xxx sql/item_func.cc: str_to_datetime_with_warn() returns bool, not MYSQL_TIMESTAMP_xxx storage/cassandra/CMakeLists.txt: CMAKE_CXX_FLAGS can be empty storage/connect/odbconn.cpp: HWND is void* storage/connect/user_connect.h: deprecated on FreeBSD and unused anyway storage/connect/value.cpp: bad characters inside. unused. storage/spider/spd_trx.cc: clang++ warns that memset will also overwrite vtbl. it might be as well a good idea, as it asserts that the object will only be used as a storage. silence the warning.
Diffstat (limited to 'sql')
-rw-r--r--sql/filesort.cc4
-rw-r--r--sql/hostname.cc2
-rw-r--r--sql/item.cc5
-rw-r--r--sql/item_func.cc2
-rw-r--r--sql/item_subselect.cc2
-rw-r--r--sql/item_xmlfunc.h2
-rw-r--r--sql/slave.cc3
7 files changed, 8 insertions, 12 deletions
diff --git a/sql/filesort.cc b/sql/filesort.cc
index 8783aa96739..2b0a91bf5d0 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -1215,13 +1215,13 @@ bool check_if_pq_applicable(Sort_param *param,
if (param->max_rows == HA_POS_ERROR)
{
DBUG_PRINT("info", ("No LIMIT"));
- DBUG_RETURN(NULL);
+ DBUG_RETURN(false);
}
if (param->max_rows + 2 >= UINT_MAX)
{
DBUG_PRINT("info", ("Too large LIMIT"));
- DBUG_RETURN(NULL);
+ DBUG_RETURN(false);
}
ulong num_available_keys=
diff --git a/sql/hostname.cc b/sql/hostname.cc
index 6c3c70aa7ea..1200dd2c185 100644
--- a/sql/hostname.cc
+++ b/sql/hostname.cc
@@ -415,7 +415,7 @@ int ip_to_hostname(struct sockaddr_storage *ip_storage,
{
const struct sockaddr *ip= (const sockaddr *) ip_storage;
int err_code;
- bool err_status;
+ bool err_status __attribute__((unused));
Host_errors errors;
DBUG_ENTER("ip_to_hostname");
diff --git a/sql/item.cc b/sql/item.cc
index 248b0899026..38f5ed6bf5c 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -585,12 +585,11 @@ uint Item::temporal_precision(enum_field_types type)
MYSQL_TIME_STATUS status;
DBUG_ASSERT(fixed);
if ((tmp= val_str(&buf)) &&
- (type == MYSQL_TYPE_TIME ?
+ !(type == MYSQL_TYPE_TIME ?
str_to_time(tmp->charset(), tmp->ptr(), tmp->length(),
&ltime, TIME_TIME_ONLY, &status) :
str_to_datetime(tmp->charset(), tmp->ptr(), tmp->length(),
- &ltime, TIME_FUZZY_DATES, &status)) >
- MYSQL_TIMESTAMP_ERROR)
+ &ltime, TIME_FUZZY_DATES, &status)))
return MY_MIN(status.precision, TIME_SECOND_PART_DIGITS);
}
return MY_MIN(decimals, TIME_SECOND_PART_DIGITS);
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 1f516724a5f..36edc3aee55 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -1135,7 +1135,7 @@ bool Item_func_hybrid_result_type::get_date(MYSQL_TIME *ltime,
String tmp(buff,sizeof(buff), &my_charset_bin),*res;
if (!(res= str_op(&tmp)) ||
str_to_datetime_with_warn(res->charset(), res->ptr(), res->length(),
- ltime, fuzzydate) <= MYSQL_TIMESTAMP_ERROR)
+ ltime, fuzzydate))
goto err;
break;
break;
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 35e040cad3a..81c4f0f51e5 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -1333,8 +1333,6 @@ Item_exists_subselect::Item_exists_subselect(st_select_lex *select_lex):
emb_on_expr_nest(NULL), optimizer(0), exists_transformed(0)
{
DBUG_ENTER("Item_exists_subselect::Item_exists_subselect");
- bool val_bool();
-
init(select_lex, new select_exists_subselect(this));
max_columns= UINT_MAX;
null_value= FALSE; //can't be NULL
diff --git a/sql/item_xmlfunc.h b/sql/item_xmlfunc.h
index 800cf6ed760..e818a6da408 100644
--- a/sql/item_xmlfunc.h
+++ b/sql/item_xmlfunc.h
@@ -21,7 +21,7 @@
/* This file defines all XML functions */
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */
#endif
diff --git a/sql/slave.cc b/sql/slave.cc
index 2b584365828..0912d77e070 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -6005,10 +6005,9 @@ static Log_event* next_event(rpl_group_info *rgi, ulonglong *event_size)
IO_CACHE* cur_log = rli->cur_log;
mysql_mutex_t *log_lock = rli->relay_log.get_log_lock();
const char* errmsg=0;
- THD *thd = rgi->thd;
DBUG_ENTER("next_event");
- DBUG_ASSERT(thd != 0 && thd == rli->sql_driver_thd);
+ DBUG_ASSERT(rgi->thd != 0 && rgi->thd == rli->sql_driver_thd);
*event_size= 0;
#ifndef DBUG_OFF