]> git.tuebingen.mpg.de Git - paraslash.git/commit
aft.c: Silence scan-build warning.
authorAndre Noll <maan@systemlinux.org>
Fri, 1 Jun 2012 08:24:58 +0000 (10:24 +0200)
committerAndre Noll <maan@systemlinux.org>
Wed, 13 Jun 2012 14:43:15 +0000 (16:43 +0200)
commit869f0e06ec4e15abc9230c1b2d7615da5250802e
treeb4bfb139283b3e08623cad429b4f08f5c79c3fc5
parent4cdf53ccaf94a774be3424763978c56b9bcaf0d1
aft.c: Silence scan-build warning.

scan-build issues the following warning in prepare_ls_row():

aft.c:1338:3: warning: Assigned value is garbage or undefined
GET_NUM_DIGITS(score, &num_digits);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aft.c:719:21: note: expanded from:
typeof((x)) _tmp = PARA_ABS(x); \
   ^
./para.h:50:2: note: expanded from:
typeof(x) _x = (x); \
^              ~~~

This is because clang can not prove that the "score" variable is
always initialized at this point. However, I can: The problematic
GET_NUM_DIGITS() statement is only executed if LS_FLAG_ADMISSIBLE_ONLY
is set in options->flags, but in this case "score" will be set by
get_score_and_aft_row() because this function only fails to do so if it
returns negative. In this case we return early from prepare_ls_row().

Let's make it easier for clang and initialize it anyway.
aft.c