Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibly a false warning but can't hurt to initialize these 2 variables #132

Open
dejanyy opened this issue May 22, 2020 · 0 comments
Open

Comments

@dejanyy
Copy link

dejanyy commented May 22, 2020

Compiling the code using -Weverything, clang c++ gives this warning:

./src/woff2_dec.cc:1215:39: warning: variable 'priv_length' may be uninitialized when used here [-Wconditional-uninitialized]
src_offset = Round4(priv_offset + priv_length);
^~~~~~~~~~~
./src/woff2_dec.cc:1095:23: note: initialize the variable 'priv_length' to silence this warning
uint32_t priv_length;
^
= 0
./src/woff2_dec.cc:1205:39: warning: variable 'meta_length' may be uninitialized when used here [-Wconditional-uninitialized]
src_offset = Round4(meta_offset + meta_length);
^~~~~~~~~~~
./src/woff2_dec.cc:1081:23: note: initialize the variable 'meta_length' to silence this warning
uint32_t meta_length;
^
= 0

Changing line 1081 as follows:

uint32_t meta_length = 0;

and line 1095 as follows:

uint32_t priv_length = 0;

silences this warning.

@dejanyy dejanyy changed the title Possibly a flase warning but can't hurt to initialize these 2 variables Possibly a false warning but can't hurt to initialize these 2 variables May 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant