summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavi Arnaut <Davi.Arnaut@Sun.COM>2008-12-16 10:12:22 -0200
committerDavi Arnaut <Davi.Arnaut@Sun.COM>2008-12-16 10:12:22 -0200
commit3ce026ec2f66a73be82a26055dd4761479a73811 (patch)
treec93d4234e3d8d278b91319b97e252f86a083eb0d
parent0772b6a833a33304c753b7afa9b58b6b6c8f6464 (diff)
downloadmariadb-git-3ce026ec2f66a73be82a26055dd4761479a73811.tar.gz
Fix warnings and bug spotted by gcc-4.3.
Related to operator precedence and associativity. Make the expressions as explicit as possible. sql/field.h: Silence gcc-4.3 warning: be more explicit. sql/item.cc: Silence gcc-4.3 warning: be more explicit. sql/item_sum.cc: Silence gcc-4.3 warning: be more explicit. sql/log_event.cc: Silence gcc-4.3 warning: be more explicit. sql/spatial.h: Silence gcc-4.3 warning: be more explicit. sql/sql_lex.cc: Silence gcc-4.3 warning: be more explicit. sql/table.h: Silence gcc-4.3 warning: be more explicit. storage/federated/ha_federated.cc: Fix operator precedence bug. storage/heap/ha_heap.cc: Silence gcc-4.3 warning: be more explicit.
-rw-r--r--sql/field.h2
-rw-r--r--sql/item.cc6
-rw-r--r--sql/item_sum.cc7
-rw-r--r--sql/log_event.cc2
-rw-r--r--sql/spatial.h10
-rw-r--r--sql/sql_lex.cc2
-rw-r--r--sql/table.h2
-rw-r--r--storage/federated/ha_federated.cc2
-rw-r--r--storage/heap/ha_heap.cc2
9 files changed, 17 insertions, 18 deletions
diff --git a/sql/field.h b/sql/field.h
index 81905cc64ae..23033e6cc7a 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -209,7 +209,7 @@ public:
memcpy(ptr, ptr + l_offset, pack_length());
if (null_ptr)
*null_ptr= ((*null_ptr & (uchar) ~null_bit) |
- null_ptr[l_offset] & null_bit);
+ (null_ptr[l_offset] & null_bit));
}
virtual bool binary() const { return 1; }
virtual bool zero_pack() const { return 1; }
diff --git a/sql/item.cc b/sql/item.cc
index 7f85713915d..b8fcdb832d4 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -2628,7 +2628,7 @@ void Item_param::set_time(MYSQL_TIME *tm, timestamp_type time_type,
if (value.time.year > 9999 || value.time.month > 12 ||
value.time.day > 31 ||
- time_type != MYSQL_TIMESTAMP_TIME && value.time.hour > 23 ||
+ (time_type != MYSQL_TIMESTAMP_TIME && value.time.hour > 23) ||
value.time.minute > 59 || value.time.second > 59)
{
char buff[MAX_DATE_STRING_REP_LENGTH];
@@ -4840,8 +4840,8 @@ int Item::save_in_field(Field *field, bool no_conversions)
{
int error;
if (result_type() == STRING_RESULT ||
- result_type() == REAL_RESULT &&
- field->result_type() == STRING_RESULT)
+ (result_type() == REAL_RESULT &&
+ field->result_type() == STRING_RESULT))
{
String *result;
CHARSET_INFO *cs= collation.collation;
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index c2b3b954634..1821136cc9d 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -654,8 +654,7 @@ Item_sum_hybrid::fix_fields(THD *thd, Item **ref)
return TRUE;
// 'item' can be changed during fix_fields
- if (!item->fixed &&
- item->fix_fields(thd, args) ||
+ if ((!item->fixed && item->fix_fields(thd, args)) ||
(item= args[0])->check_cols(1))
return TRUE;
decimals=item->decimals;
@@ -981,8 +980,8 @@ void Item_sum_distinct::fix_length_and_dec()
integers each <= 2^32.
*/
if (table_field_type == MYSQL_TYPE_INT24 ||
- table_field_type >= MYSQL_TYPE_TINY &&
- table_field_type <= MYSQL_TYPE_LONG)
+ (table_field_type >= MYSQL_TYPE_TINY &&
+ table_field_type <= MYSQL_TYPE_LONG))
{
val.traits= Hybrid_type_traits_fast_decimal::instance();
break;
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 0d03593946d..cd8fa0c3a85 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -2680,7 +2680,7 @@ void Query_log_event::print_query_header(IO_CACHE* file,
if (!(flags & LOG_EVENT_SUPPRESS_USE_F) && db)
{
- if (different_db= memcmp(print_event_info->db, db, db_len + 1))
+ if ((different_db= memcmp(print_event_info->db, db, db_len + 1)))
memcpy(print_event_info->db, db, db_len + 1);
if (db[0] && different_db)
my_b_printf(file, "use %s%s\n", db, print_event_info->delimiter);
diff --git a/sql/spatial.h b/sql/spatial.h
index f806861290e..69a1f24506e 100644
--- a/sql/spatial.h
+++ b/sql/spatial.h
@@ -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)
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 983d53a041d..7d0a4d18d34 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -2002,7 +2002,7 @@ void st_select_lex::print_limit(THD *thd,
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;
}
diff --git a/sql/table.h b/sql/table.h
index 8d6473661ac..a6a256b30b6 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -1363,7 +1363,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, enum_query_type query_type);
diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc
index 2f1c5e51caa..6cfbd355c40 100644
--- a/storage/federated/ha_federated.cc
+++ b/storage/federated/ha_federated.cc
@@ -2828,7 +2828,7 @@ int ha_federated::info(uint flag)
if (!(row= mysql_fetch_row(result)))
goto error;
- if (flag & HA_STATUS_VARIABLE | HA_STATUS_CONST)
+ if (flag & (HA_STATUS_VARIABLE | HA_STATUS_CONST))
{
/*
deleted is set in ha_federated::info
diff --git a/storage/heap/ha_heap.cc b/storage/heap/ha_heap.cc
index be2914adac4..19863d83874 100644
--- a/storage/heap/ha_heap.cc
+++ b/storage/heap/ha_heap.cc
@@ -91,7 +91,7 @@ const char **ha_heap::bas_ext() const
int ha_heap::open(const char *name, int mode, uint test_if_locked)
{
if ((test_if_locked & HA_OPEN_INTERNAL_TABLE) ||
- !(file= heap_open(name, mode)) && my_errno == ENOENT)
+ (!(file= heap_open(name, mode)) && my_errno == ENOENT))
{
HA_CREATE_INFO create_info;
internal_table= test(test_if_locked & HA_OPEN_INTERNAL_TABLE);