summaryrefslogtreecommitdiff
path: root/sql/opt_range.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/opt_range.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/opt_range.cc')
-rw-r--r--sql/opt_range.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 778fc418392..fdf6cc03a44 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -3514,11 +3514,10 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree,
{
int idx;
SEL_ARG **key,**end, **key_to_read= NULL;
- ha_rows best_records;
+ ha_rows UNINIT_VAR(best_records); /* protected by key_to_read */
TRP_RANGE* read_plan= NULL;
bool pk_is_clustered= param->table->file->primary_key_is_clustered();
DBUG_ENTER("get_key_scans_params");
- LINT_INIT(best_records); /* protected by key_to_read */
/*
Note that there may be trees that have type SEL_TREE::KEY but contain no
key reads at all, e.g. tree for expression "key1 is not null" where key1
@@ -5370,8 +5369,7 @@ static bool eq_tree(SEL_ARG* a,SEL_ARG *b)
SEL_ARG *
SEL_ARG::insert(SEL_ARG *key)
{
- SEL_ARG *element,**par,*last_element;
- LINT_INIT(par); LINT_INIT(last_element);
+ SEL_ARG *element,**UNINIT_VAR(par),*UNINIT_VAR(last_element);
for (element= this; element != &null_element ; )
{
@@ -7918,7 +7916,9 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree)
goto next_index;
}
else
+ {
DBUG_ASSERT(FALSE);
+ }
/* Check (SA2). */
if (min_max_arg_item)