summaryrefslogtreecommitdiff
path: root/sql/item_cmpfunc.cc
diff options
context:
space:
mode:
authorStaale Smedseng <staale.smedseng@sun.com>2009-08-28 17:51:31 +0200
committerStaale Smedseng <staale.smedseng@sun.com>2009-08-28 17:51:31 +0200
commit1ba25ae47caace207cda0be2b7994a1a845e6cce (patch)
tree4278d9f3353d5c86ca327f6ac2680c001e809843 /sql/item_cmpfunc.cc
parent5edd807a7ab72fc16472293fc94a7eb8e762e2b7 (diff)
downloadmariadb-git-1ba25ae47caace207cda0be2b7994a1a845e6cce.tar.gz
Bug #43414 Parenthesis (and other) warnings compiling MySQL
with gcc 4.3.2 This patch fixes a number of GCC warnings about variables used before initialized. A new macro UNINIT_VAR() is introduced for use in the variable declaration, and LINT_INIT() usage will be gradually deprecated. (A workaround is used for g++, pending a patch for a g++ bug.) GCC warnings for unused results (attribute warn_unused_result) for a number of system calls (present at least in later Ubuntus, where the usual void cast trick doesn't work) are also fixed. client/mysqlmanager-pwgen.c: A fix for warn_unused_result, adding fallback to use of srand()/rand() if /dev/random cannot be used. Also actually adds calls to rand() in the second branch so that it actually creates a random password.
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r--sql/item_cmpfunc.cc17
1 files changed, 5 insertions, 12 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index c940c4ab3c0..8c655cdc369 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -352,8 +352,7 @@ static bool convert_constant_item(THD *thd, Item_field *field_item,
/* For comparison purposes allow invalid dates like 2000-01-32 */
ulong orig_sql_mode= thd->variables.sql_mode;
enum_check_fields orig_count_cuted_fields= thd->count_cuted_fields;
- ulonglong orig_field_val; /* original field value if valid */
- LINT_INIT(orig_field_val);
+ ulonglong UNINIT_VAR(orig_field_val); /* original field value if valid */
thd->variables.sql_mode= (orig_sql_mode & ~MODE_NO_ZERO_DATE) |
MODE_INVALID_DATES;
thd->count_cuted_fields= CHECK_FIELD_IGNORE;
@@ -2453,19 +2452,13 @@ Item_func_nullif::is_null()
Item *Item_func_case::find_item(String *str)
{
- String *first_expr_str, *tmp;
- my_decimal *first_expr_dec, first_expr_dec_val;
- longlong first_expr_int;
- double first_expr_real;
+ String *UNINIT_VAR(first_expr_str), *tmp;
+ my_decimal *UNINIT_VAR(first_expr_dec), first_expr_dec_val;
+ longlong UNINIT_VAR(first_expr_int);
+ double UNINIT_VAR(first_expr_real);
char buff[MAX_FIELD_WIDTH];
String buff_str(buff,sizeof(buff),default_charset());
- /* These will be initialized later */
- LINT_INIT(first_expr_str);
- LINT_INIT(first_expr_int);
- LINT_INIT(first_expr_real);
- LINT_INIT(first_expr_dec);
-
if (first_expr_num != -1)
{
switch (cmp_type)