Geert Stappers
2017-03-06 07:20:24 UTC
Making all in global
CC parse.lo
CC log-error.lo
CC data_dir.lo
CC params.lo
params.c:246:14: warning: comparison of constant -1 with expression of type
'urj_param_type_t' (aka 'enum URJ_PARAM_TYPE_T') is always false
[-Wtautological-constant-out-of-range-compare]
if (type == -1)
~~~~ ^ ~~
1 warning generated.
There lots of warnings of this kind generated, caused by out of rangeCC parse.lo
CC log-error.lo
CC data_dir.lo
CC params.lo
params.c:246:14: warning: comparison of constant -1 with expression of type
'urj_param_type_t' (aka 'enum URJ_PARAM_TYPE_T') is always false
[-Wtautological-constant-out-of-range-compare]
if (type == -1)
~~~~ ^ ~~
1 warning generated.
comparisons that always give false logic.. something worth cleaning up
in near future..
244
245 type = urj_param_type_of(params, key);
246 if (type == -1)
247 return URJ_STATUS_FAIL;
248
The function called, also in urjtag/src/global/params.c
62
63 static urj_param_type_t
64 urj_param_type_of(const urj_param_list_t *params, int key)
65 {
66 int i;
67
68 for (i = 0; i < params->n; i++)
69 if (params->list[i].key == key)
70 return params->list[i].type;
71
72 urj_error_set (URJ_ERROR_INVALID, "unknown key %d", key);
73 return -1;
74 }
75
Proposals for getting around the compiler warning
-Wtautological-constant-out-of-range-compare
are very welcome.
Groeten
Geert Stappers
--
Leven en laten leven
Leven en laten leven