mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2025-12-20 03:30:19 +01:00
tests/string: fix false-positive uninitialized val
GCC 14.2 with debugoptimized build complained:
In file included from ../../git/weston/tests/weston-test-assert.h:32,
from ../../git/weston/tests/string-test.c:36:
In function ‘strtof_conversions’,
inlined from ‘wrapstrtof_conversions’ at ../../git/weston/tests/string-test.c:92:1:
../../git/weston/shared/weston-assert.h:60:12: error: ‘val’ may be used uninitialized [-Werror=maybe-uninitialized]
60 | if (!cond) \
| ^
../../git/weston/tests/weston-test-assert.h:153:34: note: in expansion of macro ‘weston_assert_’
153 | #define test_assert_f32_eq(a, b) weston_assert_(NULL, a, b, float, "%.10g", ==)
| ^~~~~~~~~~~~~~
../../git/weston/tests/string-test.c:97:9: note: in expansion of macro ‘test_assert_f32_eq’
97 | test_assert_f32_eq(val, 0.0);
| ^~~~~~~~~~~~~~~~~~
../../git/weston/tests/string-test.c: In function ‘wrapstrtof_conversions’:
../../git/weston/tests/string-test.c:94:15: note: ‘val’ was declared here
94 | float val;
| ^~~
The debug build did not complain.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
parent
6af97ec150
commit
2e66195546
1 changed files with 1 additions and 1 deletions
|
|
@ -91,7 +91,7 @@ TEST(strtol_conversions)
|
||||||
|
|
||||||
TEST(strtof_conversions)
|
TEST(strtof_conversions)
|
||||||
{
|
{
|
||||||
float val;
|
float val = NAN;
|
||||||
|
|
||||||
test_assert_true(safe_strtofloat("0.0", &val));
|
test_assert_true(safe_strtofloat("0.0", &val));
|
||||||
test_assert_f32_eq(val, 0.0);
|
test_assert_f32_eq(val, 0.0);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue