Commit 29c07643 authored by Sergei Golubchik's avatar Sergei Golubchik

enable -Wenum-compare -Wenum-conversion

to make the all headers -std=c++20 clean for those, who need c++20
(some plugins)
parent 16cebed5
...@@ -22,6 +22,8 @@ ENDIF() ...@@ -22,6 +22,8 @@ ENDIF()
SET(MY_WARNING_FLAGS SET(MY_WARNING_FLAGS
-Wall -Wall
-Wdeclaration-after-statement -Wdeclaration-after-statement
-Wenum-compare
-Wenum-conversion
-Wextra -Wextra
-Wformat-security -Wformat-security
-Wno-format-truncation -Wno-format-truncation
......
...@@ -132,7 +132,7 @@ int Gcalc_function::count_internal(const char *cur_func, uint set_type, ...@@ -132,7 +132,7 @@ int Gcalc_function::count_internal(const char *cur_func, uint set_type,
int mask= (c_op & op_not) ? 1:0; int mask= (c_op & op_not) ? 1:0;
uint n_ops= c_op & ~(op_any | op_not | v_mask); uint n_ops= c_op & ~(op_any | op_not | v_mask);
uint n_shape= c_op & ~(op_any | op_not | v_mask); /* same as n_ops */ uint n_shape= c_op & ~(op_any | op_not | v_mask); /* same as n_ops */
value v_state= (value) (c_op & v_mask); op_type v_state= (op_type) (c_op & v_mask);
int result= 0; int result= 0;
const char *sav_cur_func= cur_func; const char *sav_cur_func= cur_func;
......
...@@ -52,17 +52,15 @@ class Gcalc_function ...@@ -52,17 +52,15 @@ class Gcalc_function
int count_internal(const char *cur_func, uint set_type, int count_internal(const char *cur_func, uint set_type,
const char **end); const char **end);
public: public:
enum value
{
v_empty= 0x0000000,
v_find_t= 0x1000000,
v_find_f= 0x2000000,
v_t_found= 0x3000000,
v_f_found= 0x4000000,
v_mask= 0x7000000
};
enum op_type enum op_type
{ {
v_empty= 0x00000000,
v_find_t= 0x01000000,
v_find_f= 0x02000000,
v_t_found= 0x03000000,
v_f_found= 0x04000000,
v_mask= 0x07000000,
op_not= 0x80000000, op_not= 0x80000000,
op_shape= 0x00000000, op_shape= 0x00000000,
op_union= 0x10000000, op_union= 0x10000000,
......
...@@ -2636,10 +2636,10 @@ class Cost_estimate ...@@ -2636,10 +2636,10 @@ class Cost_estimate
double import_cost; /* cost of remote operations */ double import_cost; /* cost of remote operations */
double mem_cost; /* cost of used memory */ double mem_cost; /* cost of used memory */
enum { IO_COEFF=1 }; static const int IO_COEFF=1;
enum { CPU_COEFF=1 }; static const int CPU_COEFF=1;
enum { MEM_COEFF=1 }; static const int MEM_COEFF=1;
enum { IMPORT_COEFF=1 }; static const int IMPORT_COEFF=1;
Cost_estimate() Cost_estimate()
{ {
......
...@@ -5133,8 +5133,8 @@ my_eof(THD *thd) ...@@ -5133,8 +5133,8 @@ my_eof(THD *thd)
inline date_conv_mode_t sql_mode_for_dates(THD *thd) inline date_conv_mode_t sql_mode_for_dates(THD *thd)
{ {
static_assert((date_conv_mode_t::KNOWN_MODES & static_assert((ulonglong(date_conv_mode_t::KNOWN_MODES) &
time_round_mode_t::KNOWN_MODES) == 0, ulonglong(time_round_mode_t::KNOWN_MODES)) == 0,
"date_conv_mode_t and time_round_mode_t must use different " "date_conv_mode_t and time_round_mode_t must use different "
"bit values"); "bit values");
static_assert(MODE_NO_ZERO_DATE == date_mode_t::NO_ZERO_DATE && static_assert(MODE_NO_ZERO_DATE == date_mode_t::NO_ZERO_DATE &&
......
...@@ -1995,8 +1995,7 @@ class Query_tables_list ...@@ -1995,8 +1995,7 @@ class Query_tables_list
@retval nonzero if the statement is a row injection @retval nonzero if the statement is a row injection
*/ */
inline bool is_stmt_row_injection() const { inline bool is_stmt_row_injection() const {
return binlog_stmt_flags & return binlog_stmt_flags & (1U << BINLOG_STMT_TYPE_ROW_INJECTION);
(1U << (BINLOG_STMT_UNSAFE_COUNT + BINLOG_STMT_TYPE_ROW_INJECTION));
} }
/** /**
...@@ -2006,8 +2005,7 @@ class Query_tables_list ...@@ -2006,8 +2005,7 @@ class Query_tables_list
*/ */
inline void set_stmt_row_injection() { inline void set_stmt_row_injection() {
DBUG_ENTER("set_stmt_row_injection"); DBUG_ENTER("set_stmt_row_injection");
binlog_stmt_flags|= binlog_stmt_flags|= (1U << BINLOG_STMT_TYPE_ROW_INJECTION);
(1U << (BINLOG_STMT_UNSAFE_COUNT + BINLOG_STMT_TYPE_ROW_INJECTION));
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -2283,7 +2281,7 @@ class Query_tables_list ...@@ -2283,7 +2281,7 @@ class Query_tables_list
The statement is a row injection (i.e., either a BINLOG The statement is a row injection (i.e., either a BINLOG
statement or a row event executed by the slave SQL thread). statement or a row event executed by the slave SQL thread).
*/ */
BINLOG_STMT_TYPE_ROW_INJECTION = 0, BINLOG_STMT_TYPE_ROW_INJECTION = BINLOG_STMT_UNSAFE_COUNT,
/** The last element of this enumeration type. */ /** The last element of this enumeration type. */
BINLOG_STMT_TYPE_COUNT BINLOG_STMT_TYPE_COUNT
...@@ -2297,8 +2295,8 @@ class Query_tables_list ...@@ -2297,8 +2295,8 @@ class Query_tables_list
- The low BINLOG_STMT_UNSAFE_COUNT bits indicate the types of - The low BINLOG_STMT_UNSAFE_COUNT bits indicate the types of
unsafeness that the current statement has. unsafeness that the current statement has.
- The next BINLOG_STMT_TYPE_COUNT bits indicate if the statement - The next BINLOG_STMT_TYPE_COUNT-BINLOG_STMT_TYPE_COUNT bits indicate if
is of some special type. the statement is of some special type.
This must be a member of LEX, not of THD: each stored procedure This must be a member of LEX, not of THD: each stored procedure
needs to remember its unsafeness state between calls and each needs to remember its unsafeness state between calls and each
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment