Skip to content

Conversation

@Spacefish
Copy link
Contributor

@Spacefish Spacefish commented Apr 5, 2025

Initialize two variables before accessing them in a goto block for logging.

Fixes build warnings like these:

In file included from /usr/include/stdio.h:970,
                 from /usr/include/malloc.h:25,
                 from /home/spacy/src/libsurvive/redist/linmath.h:7,
                 from /home/spacy/src/libsurvive/include/libsurvive/survive_types.h:5,
                 from /home/spacy/src/libsurvive/include/libsurvive/poser.h:4,
                 from /home/spacy/src/libsurvive/include/libsurvive/survive.h:5,
                 from /home/spacy/src/libsurvive/src/survive_sensor_activations.c:4:
In function ‘snprintf’,
    inlined from ‘SurviveSensorActivations_check_outlier’ at /home/spacy/src/libsurvive/src/survive_sensor_activations.c:183:3:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:68:10: warning: ‘measured_dev’ may be used uninitialized [-Wmaybe-uninitialized]
   68 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   69 |                                    __glibc_objsize (__s), __fmt,
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   70 |                                    __va_arg_pack ());
      |                                    ~~~~~~~~~~~~~~~~~
/home/spacy/src/libsurvive/src/survive_sensor_activations.c: In function ‘SurviveSensorActivations_check_outlier’:
/home/spacy/src/libsurvive/src/survive_sensor_activations.c:146:13: note: ‘measured_dev’ was declared here
  146 |         FLT measured_dev = self->angles_center_dev[lh][axis];
      |             ^~~~~~~~~~~~
In function ‘snprintf’,
    inlined from ‘SurviveSensorActivations_check_outlier’ at /home/spacy/src/libsurvive/src/survive_sensor_activations.c:183:3:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:68:10: warning: ‘cnt’ may be used uninitialized [-Wmaybe-uninitialized]
   68 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   69 |                                    __glibc_objsize (__s), __fmt,
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   70 |                                    __va_arg_pack ());
      |                                    ~~~~~~~~~~~~~~~~~
/home/spacy/src/libsurvive/src/survive_sensor_activations.c: In function ‘SurviveSensorActivations_check_outlier’:
/home/spacy/src/libsurvive/src/survive_sensor_activations.c:148:13: note: ‘cnt’ was declared here
  148 |         int cnt = self->angles_center_cnt[lh][axis];
      |             ^~~

@bl4ckb0ne
Copy link
Collaborator

LGTM, thanks!

@bl4ckb0ne bl4ckb0ne merged commit 32cf62c into collabora:master Apr 7, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants