Bug #43414 Parenthesis (and other) warnings compiling MySQL

with gcc 4.3.2

Compiling MySQL with gcc 4.3.2 and later produces a number of 
warnings, many of which are new with the recent compiler
versions.
            
This bug will be resolved in more than one patch to limit the
size of changesets. This is the second patch, fixing more
of the warnings.
This commit is contained in:
Staale Smedseng 2009-06-10 16:04:07 +02:00
parent dae006c17f
commit e6e1f4ac84
26 changed files with 147 additions and 144 deletions

View File

@ -29,7 +29,7 @@ typedef struct st_tina_share {
THR_LOCK lock;
} TINA_SHARE;
typedef struct tina_set {
struct tina_set {
off_t begin;
off_t end;
};

View File

@ -761,8 +761,8 @@ int field_conv(Field *to,Field *from)
to->table->s->db_low_byte_first == from->table->s->db_low_byte_first &&
(!(to->table->in_use->variables.sql_mode &
(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE | MODE_INVALID_DATES)) ||
to->type() != FIELD_TYPE_DATE &&
to->type() != FIELD_TYPE_DATETIME) &&
(to->type() != FIELD_TYPE_DATE &&
to->type() != FIELD_TYPE_DATETIME)) &&
(from->real_type() != MYSQL_TYPE_VARCHAR ||
((Field_varstring*)from)->length_bytes ==
((Field_varstring*)to)->length_bytes))

View File

@ -1478,7 +1478,7 @@ bool DTCollation::aggregate(DTCollation &dt, uint flags)
set(dt);
}
else
; // Do nothing
{} // Do nothing
}
else if ((flags & MY_COLL_ALLOW_SUPERSET_CONV) &&
left_is_superset(this, &dt))

View File

@ -116,12 +116,12 @@ struct MBR
int touches(const MBR *mbr)
{
/* The following should be safe, even if we compare doubles */
return ((((mbr->xmin == xmax) || (mbr->xmax == xmin)) &&
((mbr->ymin >= ymin) && (mbr->ymin <= ymax) ||
(mbr->ymax >= ymin) && (mbr->ymax <= ymax))) ||
return ((((mbr->xmin == xmax) || (mbr->xmax == xmin)) &&
(((mbr->ymin >= ymin) && (mbr->ymin <= ymax)) ||
((mbr->ymax >= ymin) && (mbr->ymax <= ymax)))) ||
(((mbr->ymin == ymax) || (mbr->ymax == ymin)) &&
((mbr->xmin >= xmin) && (mbr->xmin <= xmax) ||
(mbr->xmax >= xmin) && (mbr->xmax <= xmax))));
(((mbr->xmin >= xmin) && (mbr->xmin <= xmax)) ||
((mbr->xmax >= xmin) && (mbr->xmax <= xmax)))));
}
int within(const MBR *mbr)

View File

@ -1046,12 +1046,12 @@ static void acl_update_user(const char *user, const char *host,
for (uint i=0 ; i < acl_users.elements ; i++)
{
ACL_USER *acl_user=dynamic_element(&acl_users,i,ACL_USER*);
if (!acl_user->user && !user[0] ||
acl_user->user && !strcmp(user,acl_user->user))
if ((!acl_user->user && !user[0]) ||
(acl_user->user && !strcmp(user,acl_user->user)))
{
if (!acl_user->host.hostname && !host[0] ||
acl_user->host.hostname &&
!my_strcasecmp(system_charset_info, host, acl_user->host.hostname))
if ((!acl_user->host.hostname && !host[0]) ||
(acl_user->host.hostname &&
!my_strcasecmp(system_charset_info, host, acl_user->host.hostname)))
{
acl_user->access=privileges;
if (mqh->specified_limits & USER_RESOURCES::QUERIES_PER_HOUR)
@ -1129,16 +1129,16 @@ static void acl_update_db(const char *user, const char *host, const char *db,
for (uint i=0 ; i < acl_dbs.elements ; i++)
{
ACL_DB *acl_db=dynamic_element(&acl_dbs,i,ACL_DB*);
if (!acl_db->user && !user[0] ||
acl_db->user &&
!strcmp(user,acl_db->user))
if ((!acl_db->user && !user[0]) ||
(acl_db->user &&
!strcmp(user,acl_db->user)))
{
if (!acl_db->host.hostname && !host[0] ||
acl_db->host.hostname &&
!strcmp(host, acl_db->host.hostname))
if ((!acl_db->host.hostname && !host[0]) ||
(acl_db->host.hostname &&
!strcmp(host, acl_db->host.hostname)))
{
if (!acl_db->db && !db[0] ||
acl_db->db && !strcmp(db,acl_db->db))
if ((!acl_db->db && !db[0]) ||
(acl_db->db && !strcmp(db,acl_db->db)))
{
if (privileges)
acl_db->access=privileges;
@ -1345,8 +1345,8 @@ bool acl_check_host(const char *host, const char *ip)
return 0;
VOID(pthread_mutex_lock(&acl_cache->lock));
if (host && hash_search(&acl_check_hosts,(byte*) host,(uint) strlen(host)) ||
ip && hash_search(&acl_check_hosts,(byte*) ip,(uint) strlen(ip)))
if ((host && hash_search(&acl_check_hosts,(byte*) host,(uint) strlen(host))) ||
(ip && hash_search(&acl_check_hosts,(byte*) ip,(uint) strlen(ip))))
{
VOID(pthread_mutex_unlock(&acl_cache->lock));
return 0; // Found host
@ -1564,8 +1564,8 @@ find_acl_user(const char *host, const char *user, my_bool exact)
host,
acl_user->host.hostname ? acl_user->host.hostname :
""));
if (!acl_user->user && !user[0] ||
acl_user->user && !strcmp(user,acl_user->user))
if ((!acl_user->user && !user[0]) ||
(acl_user->user && !strcmp(user,acl_user->user)))
{
if (exact ? !my_strcasecmp(system_charset_info, host,
acl_user->host.hostname ?

View File

@ -247,7 +247,7 @@ bool test_if_number(NUM_INFO *info, const char *str, uint str_len)
}
DBUG_RETURN(0);
}
for (str++; *(end - 1) == '0'; end--); // jump over zeros at the end
for (str++; *(end - 1) == '0'; end--) ; // jump over zeros at the end
if (str == end) // number was something like '123.000'
{
char *endpos= (char*) str;

View File

@ -1556,7 +1556,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
it can not be cloned. Emit an error for an unsupported behaviour.
*/
if (table->query_id == thd->query_id ||
thd->prelocked_mode && table->query_id)
(thd->prelocked_mode && table->query_id))
{
my_error(ER_CANT_REOPEN_TABLE, MYF(0), table->alias);
DBUG_RETURN(0);
@ -1610,8 +1610,8 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
distance > 0 - we have lock mode higher then we require
distance == 0 - we have lock mode exactly which we need
*/
if (best_distance < 0 && distance > best_distance ||
distance >= 0 && distance < best_distance)
if ((best_distance < 0 && distance > best_distance) ||
(distance >= 0 && distance < best_distance))
{
best_distance= distance;
best_table= table;
@ -2298,8 +2298,8 @@ bool table_is_used(TABLE *table, bool wait_for_name_lock)
search= (TABLE*) hash_next(&open_cache, (byte*) key,
key_length, &state))
{
if (search->locked_by_name && wait_for_name_lock ||
search->is_name_opened() && search->needs_reopen_or_name_lock())
if ((search->locked_by_name && wait_for_name_lock) ||
(search->is_name_opened() && search->needs_reopen_or_name_lock()))
return 1; // Table is used
}
} while ((table=table->next));
@ -5142,7 +5142,7 @@ bool setup_fields(THD *thd, Item **ref_pointer_array,
thd->lex->current_select->cur_pos_in_select_list= 0;
while ((item= it++))
{
if (!item->fixed && item->fix_fields(thd, it.ref()) ||
if ((!item->fixed && item->fix_fields(thd, it.ref())) ||
(item= *(it.ref()))->check_cols(1))
{
thd->lex->current_select->is_item_list_lookup= save_is_item_list_lookup;
@ -5476,16 +5476,16 @@ insert_fields(THD *thd, Name_resolution_context *context, const char *db_name,
DBUG_ASSERT(tables->is_leaf_for_name_resolution());
if (table_name && my_strcasecmp(table_alias_charset, table_name,
tables->alias) ||
if ((table_name && my_strcasecmp(table_alias_charset, table_name,
tables->alias)) ||
(db_name && strcmp(tables->db,db_name)))
continue;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
/* Ensure that we have access rights to all fields to be inserted. */
if (!((table && !tables->view && (table->grant.privilege & SELECT_ACL) ||
tables->view && (tables->grant.privilege & SELECT_ACL))) &&
!any_privileges)
if (!((table && !tables->view && (table->grant.privilege & SELECT_ACL)) ||
(tables->view && (tables->grant.privilege & SELECT_ACL))) &&
!any_privileges)
{
field_iterator.set(tables);
if (check_grant_all_columns(thd, SELECT_ACL, &field_iterator))
@ -5539,7 +5539,7 @@ insert_fields(THD *thd, Name_resolution_context *context, const char *db_name,
*/
if (any_privileges)
{
DBUG_ASSERT(tables->field_translation == NULL && table ||
DBUG_ASSERT((tables->field_translation == NULL && table) ||
tables->is_natural_join);
DBUG_ASSERT(item->type() == Item::FIELD_ITEM);
Item_field *fld= (Item_field*) item;
@ -5684,7 +5684,7 @@ int setup_conds(THD *thd, TABLE_LIST *tables, TABLE_LIST *leaves,
if (*conds)
{
thd->where="where clause";
if (!(*conds)->fixed && (*conds)->fix_fields(thd, conds) ||
if ((!(*conds)->fixed && (*conds)->fix_fields(thd, conds)) ||
(*conds)->check_cols(1))
goto err_no_arena;
}
@ -5704,8 +5704,8 @@ int setup_conds(THD *thd, TABLE_LIST *tables, TABLE_LIST *leaves,
{
/* Make a join an a expression */
thd->where="on clause";
if (!embedded->on_expr->fixed &&
embedded->on_expr->fix_fields(thd, &embedded->on_expr) ||
if ((!embedded->on_expr->fixed &&
embedded->on_expr->fix_fields(thd, &embedded->on_expr)) ||
embedded->on_expr->check_cols(1))
goto err_no_arena;
select_lex->cond_count++;
@ -5860,8 +5860,8 @@ fill_record_n_invoke_before_triggers(THD *thd, List<Item> &fields,
enum trg_event_type event)
{
return (fill_record(thd, fields, values, ignore_errors) ||
triggers && triggers->process_triggers(thd, event,
TRG_ACTION_BEFORE, TRUE));
(triggers && triggers->process_triggers(thd, event,
TRG_ACTION_BEFORE, TRUE)));
}
@ -5955,8 +5955,8 @@ fill_record_n_invoke_before_triggers(THD *thd, Field **ptr,
enum trg_event_type event)
{
return (fill_record(thd, ptr, values, ignore_errors) ||
triggers && triggers->process_triggers(thd, event,
TRG_ACTION_BEFORE, TRUE));
(triggers && triggers->process_triggers(thd, event,
TRG_ACTION_BEFORE, TRUE)));
}

View File

@ -711,7 +711,7 @@ void multi_delete::send_error(uint errcode,const char *err)
/* the error was handled or nothing deleted and no side effects return */
if (error_handled ||
!thd->transaction.stmt.modified_non_trans_table && !deleted)
(!thd->transaction.stmt.modified_non_trans_table && !deleted))
DBUG_VOID_RETURN;
/* Something already deleted so we have to invalidate cache */

View File

@ -522,7 +522,7 @@ int send_variant_2_list(MEM_ROOT *mem_root, Protocol *protocol,
String **end= pointers + names->elements;
List_iterator<String> it(*names);
for (pos= pointers; pos!=end; (*pos++= it++));
for (pos= pointers; pos!=end; (*pos++= it++)) ;
my_qsort(pointers,names->elements,sizeof(String*),string_ptr_cmp);

View File

@ -413,7 +413,7 @@ void upgrade_lock_type(THD *thd, thr_lock_type *lock_type,
bool is_multi_insert)
{
if (duplic == DUP_UPDATE ||
duplic == DUP_REPLACE && *lock_type == TL_WRITE_CONCURRENT_INSERT)
(duplic == DUP_REPLACE && *lock_type == TL_WRITE_CONCURRENT_INSERT))
{
*lock_type= TL_WRITE_DEFAULT;
return;
@ -887,7 +887,8 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
if (changed)
query_cache_invalidate3(thd, table_list, 1);
}
if (changed && error <= 0 || thd->transaction.stmt.modified_non_trans_table
if ((changed && error <= 0)
|| thd->transaction.stmt.modified_non_trans_table
|| was_insert_delayed)
{
if (mysql_bin_log.is_open())
@ -3016,8 +3017,8 @@ bool select_insert::send_eof()
We must invalidate the table in the query cache before binlog writing
and ha_autocommit_or_rollback
*/
if (changed= (info.copied || info.deleted || info.updated))
changed= (info.copied || info.deleted || info.updated);
if (changed)
{
query_cache_invalidate3(thd, table, 1);
if (thd->transaction.stmt.modified_non_trans_table)

View File

@ -594,7 +594,7 @@ int MYSQLlex(void *arg, void *yythd)
its value in a query for the binlog, the query must stay
grammatically correct.
*/
else if (c == '?' && lip->stmt_prepare_mode && !ident_map[yyPeek()])
else if (c == '?' && lip->stmt_prepare_mode && !ident_map[(int)yyPeek()])
return(PARAM_MARKER);
return((int) c);
@ -661,7 +661,7 @@ int MYSQLlex(void *arg, void *yythd)
else
#endif
{
for (result_state= c; ident_map[c= yyGet()]; result_state|= c);
for (result_state= c; ident_map[c= yyGet()]; result_state|= c) ;
/* If there were non-ASCII characters, mark that we must convert */
result_state= result_state & 0x80 ? IDENT_QUOTED : IDENT;
}
@ -673,9 +673,9 @@ int MYSQLlex(void *arg, void *yythd)
If we find a space then this can't be an identifier. We notice this
below by checking start != lex->ptr.
*/
for (; state_map[c] == MY_LEX_SKIP ; c= yyGet());
for (; state_map[c] == MY_LEX_SKIP ; c= yyGet()) ;
}
if (start == lip->ptr && c == '.' && ident_map[yyPeek()])
if (start == lip->ptr && c == '.' && ident_map[(int)yyPeek()])
lip->next_state=MY_LEX_IDENT_SEP;
else
{ // '(' must follow directly if function
@ -708,7 +708,7 @@ int MYSQLlex(void *arg, void *yythd)
yylval->lex_str.length=1;
c=yyGet(); // should be '.'
lip->next_state= MY_LEX_IDENT_START;// Next is an ident (not a keyword)
if (!ident_map[yyPeek()]) // Probably ` or "
if (!ident_map[(int)yyPeek()]) // Probably ` or "
lip->next_state= MY_LEX_START;
return((int) c);
@ -782,11 +782,11 @@ int MYSQLlex(void *arg, void *yythd)
else
#endif
{
for (result_state=0; ident_map[c= yyGet()]; result_state|= c);
for (result_state=0; ident_map[c= yyGet()]; result_state|= c) ;
/* If there were non-ASCII characters, mark that we must convert */
result_state= result_state & 0x80 ? IDENT_QUOTED : IDENT;
}
if (c == '.' && ident_map[yyPeek()])
if (c == '.' && ident_map[(int)yyPeek()])
lip->next_state=MY_LEX_IDENT_SEP;// Next is '.'
yylval->lex_str= get_token(lip, 0, yyLength());
@ -872,7 +872,7 @@ int MYSQLlex(void *arg, void *yythd)
case MY_LEX_BIN_NUMBER: // Found b'bin-string'
yyGet(); // Skip '
while ((c= yyGet()) == '0' || c == '1');
while ((c= yyGet()) == '0' || c == '1') ;
length= (uint) (lip->ptr - lip->tok_start); // Length of bin-num + 3
if (c != '\'')
return(ABORT_SYM); // Illegal hex constant
@ -883,8 +883,8 @@ int MYSQLlex(void *arg, void *yythd)
return (BIN_NUM);
case MY_LEX_CMP_OP: // Incomplete comparison operator
if (state_map[yyPeek()] == MY_LEX_CMP_OP ||
state_map[yyPeek()] == MY_LEX_LONG_CMP_OP)
if (state_map[(int)yyPeek()] == MY_LEX_CMP_OP ||
state_map[(int)yyPeek()] == MY_LEX_LONG_CMP_OP)
yySkip();
if ((tokval = find_keyword(lip,(uint) (lip->ptr - lip->tok_start),0)))
{
@ -895,11 +895,11 @@ int MYSQLlex(void *arg, void *yythd)
break;
case MY_LEX_LONG_CMP_OP: // Incomplete comparison operator
if (state_map[yyPeek()] == MY_LEX_CMP_OP ||
state_map[yyPeek()] == MY_LEX_LONG_CMP_OP)
if (state_map[(int)yyPeek()] == MY_LEX_CMP_OP ||
state_map[(int)yyPeek()] == MY_LEX_LONG_CMP_OP)
{
yySkip();
if (state_map[yyPeek()] == MY_LEX_CMP_OP)
if (state_map[(int)yyPeek()] == MY_LEX_CMP_OP)
yySkip();
}
if ((tokval = find_keyword(lip,(uint) (lip->ptr - lip->tok_start),0)))
@ -1043,7 +1043,7 @@ int MYSQLlex(void *arg, void *yythd)
}
break;
case MY_LEX_USER_END: // end '@' of user@hostname
switch (state_map[yyPeek()]) {
switch (state_map[(int)yyPeek()]) {
case MY_LEX_STRING:
case MY_LEX_USER_VARIABLE_DELIMITER:
case MY_LEX_STRING_OR_DELIMITER:
@ -1068,7 +1068,7 @@ int MYSQLlex(void *arg, void *yythd)
yylval->lex_str.str=(char*) lip->ptr;
yylval->lex_str.length=1;
yySkip(); // Skip '@'
lip->next_state= (state_map[yyPeek()] ==
lip->next_state= (state_map[(int)yyPeek()] ==
MY_LEX_USER_VARIABLE_DELIMITER ?
MY_LEX_OPERATOR_OR_IDENT :
MY_LEX_IDENT_OR_KEYWORD);
@ -1080,7 +1080,7 @@ int MYSQLlex(void *arg, void *yythd)
[(global | local | session) .]variable_name
*/
for (result_state= 0; ident_map[c= yyGet()]; result_state|= c);
for (result_state= 0; ident_map[c= yyGet()]; result_state|= c) ;
/* If there were non-ASCII characters, mark that we must convert */
result_state= result_state & 0x80 ? IDENT_QUOTED : IDENT;
@ -1670,7 +1670,7 @@ void st_select_lex::print_limit(THD *thd, String *str)
item->substype() == Item_subselect::ALL_SUBS))
{
DBUG_ASSERT(!item->fixed ||
select_limit->val_int() == LL(1) && offset_limit == 0);
(select_limit->val_int() == LL(1) && offset_limit == 0));
return;
}

View File

@ -723,9 +723,9 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
real_item= item->real_item();
if (!read_info.enclosed &&
if ((!read_info.enclosed &&
(enclosed_length && length == 4 &&
!memcmp(pos, STRING_WITH_LEN("NULL"))) ||
!memcmp(pos, STRING_WITH_LEN("NULL")))) ||
(length == 1 && read_info.found_null))
{
@ -1132,8 +1132,8 @@ int READ_INFO::read_field()
}
// End of enclosed field if followed by field_term or line_term
if (chr == my_b_EOF ||
chr == line_term_char && terminator(line_term_ptr,
line_term_length))
(chr == line_term_char && terminator(line_term_ptr,
line_term_length)))
{ // Maybe unexpected linefeed
enclosed=1;
found_end_of_line=1;

View File

@ -1238,7 +1238,7 @@ pthread_handler_t handle_one_connection(void *arg)
decrease_user_connections(thd->user_connect);
if (thd->killed ||
net->vio && net->error && net->report_error)
(net->vio && net->error && net->report_error))
{
statistic_increment(aborted_threads, &LOCK_status);
}
@ -2366,11 +2366,11 @@ void log_slow_statement(THD *thd)
if ((thd->start_time > thd->time_after_lock &&
(ulong) (thd->start_time - thd->time_after_lock) >
thd->variables.long_query_time) ||
(thd->server_status &
((thd->server_status &
(SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED)) &&
opt_log_queries_not_using_indexes &&
/* == SQLCOM_END unless this is a SHOW command */
thd->lex->orig_sql_command == SQLCOM_END)
thd->lex->orig_sql_command == SQLCOM_END))
{
thd_proc_info(thd, "logging slow query");
thd->status_var.long_query_count++;
@ -2676,8 +2676,8 @@ mysql_execute_command(THD *thd)
variables, but for now this is probably good enough.
Don't reset warnings when executing a stored routine.
*/
if ((all_tables || &lex->select_lex != lex->all_selects_list ||
lex->sroutines.records) && !thd->spcont ||
if (((all_tables || &lex->select_lex != lex->all_selects_list ||
lex->sroutines.records) && !thd->spcont) ||
lex->time_zone_tables_used)
mysql_reset_errors(thd, 0);
@ -5641,7 +5641,7 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
if (schema_db)
{
if (!(sctx->master_access & FILE_ACL) && (want_access & FILE_ACL) ||
if ((!(sctx->master_access & FILE_ACL) && (want_access & FILE_ACL)) ||
(want_access & ~(SELECT_ACL | EXTRA_ACL | FILE_ACL)))
{
if (!no_errors)
@ -5678,7 +5678,7 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
DBUG_RETURN(FALSE);
}
if (((want_access & ~sctx->master_access) & ~(DB_ACLS | EXTRA_ACL)) ||
! db && dont_check_global_grants)
(! db && dont_check_global_grants))
{ // We can never grant this
DBUG_PRINT("error",("No possible access"));
if (!no_errors)
@ -6029,10 +6029,10 @@ bool check_some_access(THD *thd, ulong want_access, TABLE_LIST *table)
{
if (access & want_access)
{
if (!check_access(thd, access, table->db,
if ((!check_access(thd, access, table->db,
&table->grant.privilege, 0, 1,
test(table->schema_table)) &&
!grant_option || !check_grant(thd, access, table, 0, 1, 1))
!grant_option) || !check_grant(thd, access, table, 0, 1, 1))
DBUG_RETURN(0);
}
}
@ -7710,12 +7710,12 @@ bool multi_update_precheck(THD *thd, TABLE_LIST *tables)
else if ((check_access(thd, UPDATE_ACL, table->db,
&table->grant.privilege, 0, 1,
test(table->schema_table)) ||
grant_option &&
check_grant(thd, UPDATE_ACL, table, 0, 1, 1)) &&
(grant_option &&
check_grant(thd, UPDATE_ACL, table, 0, 1, 1))) &&
(check_access(thd, SELECT_ACL, table->db,
&table->grant.privilege, 0, 0,
test(table->schema_table)) ||
grant_option && check_grant(thd, SELECT_ACL, table, 0, 1, 0)))
(grant_option && check_grant(thd, SELECT_ACL, table, 0, 1, 0))))
DBUG_RETURN(TRUE);
table->table_in_first_from_clause= 1;
@ -7735,7 +7735,7 @@ bool multi_update_precheck(THD *thd, TABLE_LIST *tables)
if (check_access(thd, SELECT_ACL, table->db,
&table->grant.privilege, 0, 0,
test(table->schema_table)) ||
grant_option && check_grant(thd, SELECT_ACL, table, 0, 1, 0))
(grant_option && check_grant(thd, SELECT_ACL, table, 0, 1, 0)))
DBUG_RETURN(TRUE);
}
}
@ -7961,7 +7961,7 @@ static bool check_show_create_table_access(THD *thd, TABLE_LIST *table)
return check_access(thd, SELECT_ACL | EXTRA_ACL, table->db,
&table->grant.privilege, 0, 0,
test(table->schema_table)) ||
grant_option && check_grant(thd, SELECT_ACL, table, 2, UINT_MAX, 0);
(grant_option && check_grant(thd, SELECT_ACL, table, 2, UINT_MAX, 0));
}

View File

@ -1367,7 +1367,7 @@ static bool mysql_test_set_fields(Prepared_statement *stmt,
THD *thd= stmt->thd;
set_var_base *var;
if (tables && check_table_access(thd, SELECT_ACL, tables, 0) ||
if ((tables && check_table_access(thd, SELECT_ACL, tables, 0)) ||
open_and_lock_tables(thd, tables))
goto error;
@ -2714,7 +2714,7 @@ Prepared_statement::Prepared_statement(THD *thd_arg, Protocol *protocol_arg)
void Prepared_statement::setup_set_params()
{
/* Setup binary logging */
if (mysql_bin_log.is_open() && is_update_query(lex->sql_command) ||
if ((mysql_bin_log.is_open() && is_update_query(lex->sql_command)) ||
mysql_log.is_open() || mysql_slow_log.is_open())
{
set_params_from_vars= insert_params_from_vars_with_log;

View File

@ -1305,7 +1305,7 @@ JOIN::optimize()
join_tab[const_tables].type != JT_ALL &&
join_tab[const_tables].type != JT_FT &&
join_tab[const_tables].type != JT_REF_OR_NULL &&
(order && simple_order || group_list && simple_group))
((order && simple_order) || (group_list && simple_group)))
{
if (add_ref_to_table_cond(thd,&join_tab[const_tables])) {
DBUG_RETURN(1);
@ -1809,9 +1809,9 @@ JOIN::exec()
like SEC_TO_TIME(SUM(...)).
*/
if (curr_join->group_list && (!test_if_subpart(curr_join->group_list,
if ((curr_join->group_list && (!test_if_subpart(curr_join->group_list,
curr_join->order) ||
curr_join->select_distinct) ||
curr_join->select_distinct)) ||
(curr_join->select_distinct &&
curr_join->tmp_table_param.using_indirect_summary_function))
{ /* Must copy to another table */
@ -2269,9 +2269,10 @@ mysql_select(THD *thd, Item ***rref_pointer_array,
}
else
{
if (err= join->prepare(rref_pointer_array, tables, wild_num,
conds, og_num, order, group, having, proc_param,
select_lex, unit))
err= join->prepare(rref_pointer_array, tables, wild_num,
conds, og_num, order, group, having, proc_param,
select_lex, unit);
if (err)
{
goto err;
}
@ -2286,9 +2287,10 @@ mysql_select(THD *thd, Item ***rref_pointer_array,
DBUG_RETURN(TRUE);
thd_proc_info(thd, "init");
thd->used_tables=0; // Updated by setup_fields
if (err= join->prepare(rref_pointer_array, tables, wild_num,
conds, og_num, order, group, having, proc_param,
select_lex, unit))
err= join->prepare(rref_pointer_array, tables, wild_num,
conds, og_num, order, group, having, proc_param,
select_lex, unit);
if (err)
{
goto err;
}
@ -3744,7 +3746,7 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
if (use->key == prev->key && use->table == prev->table)
{
if (prev->keypart+1 < use->keypart ||
prev->keypart == use->keypart && found_eq_constant)
(prev->keypart == use->keypart && found_eq_constant))
continue; /* remove */
}
else if (use->keypart != 0) // First found must be 0
@ -4984,8 +4986,8 @@ best_extension_by_limited_search(JOIN *join,
{
if (best_record_count > current_record_count ||
best_read_time > current_read_time ||
idx == join->const_tables && // 's' is the first table in the QEP
s->table == join->sort_by_table)
(idx == join->const_tables && // 's' is the first table in the QEP
s->table == join->sort_by_table))
{
if (best_record_count >= current_record_count &&
best_read_time >= current_read_time &&
@ -5110,7 +5112,7 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
double current_read_time=read_time+best;
if (best_record_count > current_record_count ||
best_read_time > current_read_time ||
idx == join->const_tables && s->table == join->sort_by_table)
(idx == join->const_tables && s->table == join->sort_by_table))
{
if (best_record_count >= current_record_count &&
best_read_time >= current_read_time &&
@ -5955,8 +5957,8 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
the index if we are using limit and this is the first table
*/
if (cond &&
(!tab->keys.is_subset(tab->const_keys) && i > 0) ||
if ((cond &&
(!tab->keys.is_subset(tab->const_keys) && i > 0)) ||
(!tab->const_keys.is_clear_all() && i == join->const_tables &&
join->unit->select_limit_cnt <
join->best_positions[i].records_read &&
@ -7081,7 +7083,7 @@ static bool check_simple_equality(Item *left_item, Item *right_item,
left_item_equal->merge(right_item_equal);
/* Remove the merged multiple equality from the list */
List_iterator<Item_equal> li(cond_equal->current_level);
while ((li++) != right_item_equal);
while ((li++) != right_item_equal) ;
li.remove();
}
}
@ -9663,9 +9665,9 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
reclength=1; // Dummy select
/* Use packed rows if there is blobs or a lot of space to gain */
if (blob_count ||
string_total_length >= STRING_TOTAL_LENGTH_TO_PACK_ROWS &&
(string_total_length >= STRING_TOTAL_LENGTH_TO_PACK_ROWS &&
(reclength / string_total_length <= RATIO_TO_PACK_ROWS ||
string_total_length / string_count >= AVG_STRING_LENGTH_TO_PACK_ROWS))
string_total_length / string_count >= AVG_STRING_LENGTH_TO_PACK_ROWS)))
use_packed_rows= 1;
table->s->fields= field_count;
@ -10329,8 +10331,8 @@ bool create_myisam_from_heap(THD *thd, TABLE *table, TMP_TABLE_PARAM *param,
/* copy row that filled HEAP table */
if ((write_err=new_table.file->write_row(table->record[0])))
{
if (write_err != HA_ERR_FOUND_DUPP_KEY &&
write_err != HA_ERR_FOUND_DUPP_UNIQUE || !ignore_last_dupp_key_error)
if ((write_err != HA_ERR_FOUND_DUPP_KEY &&
write_err != HA_ERR_FOUND_DUPP_UNIQUE) || !ignore_last_dupp_key_error)
goto err;
}
@ -12812,8 +12814,8 @@ create_sort_index(THD *thd, JOIN *join, ORDER *order,
*/
if ((order != join->group_list ||
!(join->select_options & SELECT_BIG_RESULT) ||
select && select->quick &&
select->quick->get_type() == QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX) &&
(select && select->quick &&
select->quick->get_type() == QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX)) &&
test_if_skip_sort_order(tab,order,select_limit,0))
DBUG_RETURN(0);
for (ORDER *ord= join->order; ord; ord= ord->next)
@ -13626,8 +13628,8 @@ find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
/* Lookup the current GROUP field in the FROM clause. */
order_item_type= order_item->type();
from_field= (Field*) not_found_field;
if (is_group_field &&
order_item_type == Item::FIELD_ITEM ||
if ((is_group_field &&
order_item_type == Item::FIELD_ITEM) ||
order_item_type == Item::REF_ITEM)
{
from_field= find_field_in_tables(thd, (Item_ident*) order_item, tables,
@ -14053,7 +14055,7 @@ get_sort_by_table(ORDER *a,ORDER *b,TABLE_LIST *tables)
if (!map || (map & (RAND_TABLE_BIT | OUTER_REF_TABLE_BIT)))
DBUG_RETURN(0);
for (; !(map & tables->table->map); tables= tables->next_leaf);
for (; !(map & tables->table->map); tables= tables->next_leaf) ;
if (map != tables->table->map)
DBUG_RETURN(0); // More than one table
DBUG_PRINT("exit",("sort by table: %d",tables->table->tablenr));

View File

@ -2987,10 +2987,10 @@ bool store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table,
TYPE_ENUM_PROCEDURE))
return 0;
if (lex->orig_sql_command == SQLCOM_SHOW_STATUS_PROC &&
proc_table->field[2]->val_int() == TYPE_ENUM_PROCEDURE ||
lex->orig_sql_command == SQLCOM_SHOW_STATUS_FUNC &&
proc_table->field[2]->val_int() == TYPE_ENUM_FUNCTION ||
if ((lex->orig_sql_command == SQLCOM_SHOW_STATUS_PROC &&
proc_table->field[2]->val_int() == TYPE_ENUM_PROCEDURE) ||
(lex->orig_sql_command == SQLCOM_SHOW_STATUS_FUNC &&
proc_table->field[2]->val_int() == TYPE_ENUM_FUNCTION) ||
lex->orig_sql_command == SQLCOM_END)
{
restore_record(table, s->default_values);

View File

@ -982,8 +982,8 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
}
/* Don't pack rows in old tables if the user has requested this */
if ((sql_field->flags & BLOB_FLAG) ||
sql_field->sql_type == MYSQL_TYPE_VARCHAR &&
create_info->row_type != ROW_TYPE_FIXED)
(sql_field->sql_type == MYSQL_TYPE_VARCHAR &&
create_info->row_type != ROW_TYPE_FIXED))
(*db_options)|= HA_OPTION_PACK_RECORD;
it2.rewind();
}
@ -1422,7 +1422,7 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
sql_field->sql_type == MYSQL_TYPE_VARCHAR ||
sql_field->pack_flag & FIELDFLAG_BLOB)))
{
if (column_nr == 0 && (sql_field->pack_flag & FIELDFLAG_BLOB) ||
if ((column_nr == 0 && (sql_field->pack_flag & FIELDFLAG_BLOB)) ||
sql_field->sql_type == MYSQL_TYPE_VARCHAR)
key_info->flags|= HA_BINARY_PACK_KEY | HA_VAR_LENGTH_KEY;
else
@ -3954,9 +3954,9 @@ view_err:
}
else if (mysql_rename_table(new_db_type,new_db,tmp_name,new_db,
new_alias) ||
(new_name != table_name || new_db != db) && // we also do rename
((new_name != table_name || new_db != db) && // we also do rename
Table_triggers_list::change_table_name(thd, db, table_name,
new_db, new_alias))
new_db, new_alias)))
{ // Try to get everything back
error=1;

View File

@ -179,7 +179,7 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
need second part of condition below, since check_access() function also
checks that db is specified.
*/
if (!thd->lex->spname->m_db.length || create && !tables->db_length)
if (!thd->lex->spname->m_db.length || (create && !tables->db_length))
{
my_error(ER_NO_DB_ERROR, MYF(0));
DBUG_RETURN(TRUE);

View File

@ -1532,7 +1532,7 @@ void multi_update::send_error(uint errcode,const char *err)
/* the error was handled or nothing deleted and no side effects return */
if (error_handled ||
!thd->transaction.stmt.modified_non_trans_table && !updated)
(!thd->transaction.stmt.modified_non_trans_table && !updated))
return;
/* Something already updated so we have to invalidate cache */

View File

@ -268,11 +268,11 @@ bool create_view_precheck(THD *thd, TABLE_LIST *tables, TABLE_LIST *view,
*/
if ((check_access(thd, CREATE_VIEW_ACL, view->db, &view->grant.privilege,
0, 0, is_schema_db(view->db)) ||
grant_option && check_grant(thd, CREATE_VIEW_ACL, view, 0, 1, 0)) ||
(grant_option && check_grant(thd, CREATE_VIEW_ACL, view, 0, 1, 0))) ||
(mode != VIEW_CREATE_NEW &&
(check_access(thd, DROP_ACL, view->db, &view->grant.privilege,
0, 0, is_schema_db(view->db)) ||
grant_option && check_grant(thd, DROP_ACL, view, 0, 1, 0))))
(grant_option && check_grant(thd, DROP_ACL, view, 0, 1, 0)))))
goto err;
for (sl= select_lex; sl; sl= sl->next_select())
@ -322,7 +322,7 @@ bool create_view_precheck(THD *thd, TABLE_LIST *tables, TABLE_LIST *view,
{
if (check_access(thd, SELECT_ACL, tbl->db,
&tbl->grant.privilege, 0, 0, test(tbl->schema_table)) ||
grant_option && check_grant(thd, SELECT_ACL, tbl, 0, 1, 0))
(grant_option && check_grant(thd, SELECT_ACL, tbl, 0, 1, 0)))
goto err;
}
}

View File

@ -3943,7 +3943,7 @@ alter_list_item:
MYSQL_YYABORT;
}
if (check_table_name($3->table.str,$3->table.length) ||
$3->db.str && check_db_name($3->db.str))
($3->db.str && check_db_name($3->db.str)))
{
my_error(ER_WRONG_TABLE_NAME, MYF(0), $3->table.str);
MYSQL_YYABORT;
@ -4094,8 +4094,8 @@ slave_until:
| UNTIL_SYM slave_until_opts
{
LEX *lex=Lex;
if ((lex->mi.log_file_name || lex->mi.pos) &&
(lex->mi.relay_log_name || lex->mi.relay_log_pos) ||
if (((lex->mi.log_file_name || lex->mi.pos) &&
(lex->mi.relay_log_name || lex->mi.relay_log_pos)) ||
!((lex->mi.log_file_name && lex->mi.pos) ||
(lex->mi.relay_log_name && lex->mi.relay_log_pos)))
{

View File

@ -2112,8 +2112,8 @@ bool TABLE_LIST::prep_check_option(THD *thd, uint8 check_opt_type)
{
const char *save_where= thd->where;
thd->where= "check option";
if (!check_option->fixed &&
check_option->fix_fields(thd, &check_option) ||
if ((!check_option->fixed &&
check_option->fix_fields(thd, &check_option)) ||
check_option->check_cols(1))
{
DBUG_RETURN(TRUE);
@ -2827,7 +2827,7 @@ void Field_iterator_table_ref::set_field_iterator()
/* Necesary, but insufficient conditions. */
DBUG_ASSERT(table_ref->is_natural_join ||
table_ref->nested_join ||
table_ref->join_columns &&
(table_ref->join_columns &&
/* This is a merge view. */
((table_ref->field_translation &&
table_ref->join_columns->elements ==
@ -2836,7 +2836,7 @@ void Field_iterator_table_ref::set_field_iterator()
/* This is stored table or a tmptable view. */
(!table_ref->field_translation &&
table_ref->join_columns->elements ==
table_ref->table->s->fields)));
table_ref->table->s->fields))));
field_it= &natural_join_it;
DBUG_PRINT("info",("field_it for '%s' is Field_iterator_natural_join",
table_ref->alias));

View File

@ -729,7 +729,7 @@ struct TABLE_LIST
void cleanup_items();
bool placeholder()
{
return derived || view || schema_table || create && !table->db_stat ||
return derived || view || schema_table || (create && !table->db_stat) ||
!table;
}
void print(THD *thd, String *str);

View File

@ -76,8 +76,8 @@ uint calc_week(MYSQL_TIME *l_time, uint week_behaviour, uint *year)
if (l_time->month == 1 && l_time->day <= 7-weekday)
{
if (!week_year &&
(first_weekday && weekday != 0 ||
!first_weekday && weekday >= 4))
((first_weekday && weekday != 0) ||
(!first_weekday && weekday >= 4)))
return 0;
week_year= 1;
(*year)--;
@ -94,8 +94,8 @@ uint calc_week(MYSQL_TIME *l_time, uint week_behaviour, uint *year)
if (week_year && days >= 52*7)
{
weekday= (weekday + calc_days_in_year(*year)) % 7;
if (!first_weekday && weekday < 4 ||
first_weekday && weekday == 0)
if ((!first_weekday && weekday < 4) ||
(first_weekday && weekday == 0))
{
(*year)++;
return 1;

View File

@ -447,8 +447,8 @@ prepare_tz_info(TIME_ZONE_INFO *sp, MEM_ROOT *storage)
}
if (end_t == MY_TIME_T_MAX ||
(cur_off_and_corr > 0) &&
(end_t >= MY_TIME_T_MAX - cur_off_and_corr))
((cur_off_and_corr > 0) &&
(end_t >= MY_TIME_T_MAX - cur_off_and_corr)))
/* end of t space */
break;

View File

@ -604,9 +604,9 @@ bool Unique::get(TABLE *table)
outfile=table->sort.io_cache=(IO_CACHE*) my_malloc(sizeof(IO_CACHE),
MYF(MY_ZEROFILL));
if (!outfile || ! my_b_inited(outfile) &&
if (!outfile || (! my_b_inited(outfile) &&
open_cached_file(outfile,mysql_tmpdir,TEMP_PREFIX,READ_RECORD_BUFFER,
MYF(MY_WME)))
MYF(MY_WME))))
return 1;
reinit_io_cache(outfile,WRITE_CACHE,0L,0,0);