Several "warning: variable '...' may be uninitialized when used here" warnings with clang (Xcode 9.2 for iOS)
When building for iOS with Xcode 9.2 or 9.3 beta (clang) I get a number of warnings about values that the compiler can't verify are initialized at time of use.
Generally these are cases where one conditional branch initializes a local, another doesn't, and then follow-up code uses the local with some kind of conditional guard that the compiler doesn't grok, but it's nice to double-check and silence the warnings.
- WARN | xcodebuild: libtheora/lib/decode.c:1586:24: warning: variable 'last_zzi' may be uninitialized when used here [-Wconditional-uninitialized]
- NOTE | xcodebuild: libtheora/lib/decode.c:1535:33: note: initialize the variable 'last_zzi' to silence this warning
- WARN | xcodebuild: libtheora/lib/encfrag.c:104:26: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value]
- NOTE | xcodebuild: libtheora/lib/encfrag.c:104:26: note: remove the call to 'abs' since unsigned values cannot be negative
- WARN | xcodebuild: libtheora/lib/huffdec.c:308:10: warning: variable 'best_nbits' may be uninitialized when used here [-Wconditional-uninitialized]
- NOTE | xcodebuild: libtheora/lib/huffdec.c:280:17: note: initialize the variable 'best_nbits' to silence this warning
- WARN | xcodebuild: libtheora/lib/quant.c:113:55: warning: variable 'plj' may be uninitialized when used here [-Wconditional-uninitialized]
- NOTE | xcodebuild: libtheora/lib/quant.c:101:18: note: initialize the variable 'plj' to silence this warning
- WARN | xcodebuild: libtheora/lib/tokenize.c:637:42: warning: variable 'best_next' may be uninitialized when used here [-Wconditional-uninitialized]
- NOTE | xcodebuild: libtheora/lib/tokenize.c:491:5: note: variable 'best_next' is declared here
- WARN | xcodebuild: libtheora/lib/tokenize.c:623:31: warning: variable 'best_token' may be uninitialized when used here [-Wconditional-uninitialized]
- NOTE | xcodebuild: libtheora/lib/tokenize.c:492:5: note: variable 'best_token' is declared here
- WARN | xcodebuild: libtheora/lib/tokenize.c:623:65: warning: variable 'best_eb' may be uninitialized when used here [-Wconditional-uninitialized]
- NOTE | xcodebuild: libtheora/lib/tokenize.c:493:5: note: variable 'best_eb' is declared here
- WARN | xcodebuild: libtheora/lib/tokenize.c:641:27: warning: variable 'best_bits' may be uninitialized when used here [-Wconditional-uninitialized]
- NOTE | xcodebuild: libtheora/lib/tokenize.c:490:5: note: variable 'best_bits' is declared here
- WARN | xcodebuild: libtheora/lib/tokenize.c:642:25: warning: variable 'best_qc' may be uninitialized when used here [-Wconditional-uninitialized]
- NOTE | xcodebuild: libtheora/lib/tokenize.c:494:5: note: variable 'best_qc' is declared here
- WARN | xcodebuild: libtheora/lib/tokenize.c:1191:16: warning: variable 'token1' may be uninitialized when used here [-Wconditional-uninitialized]
- NOTE | xcodebuild: libtheora/lib/tokenize.c:1094:3: note: variable 'token1' is declared here
- WARN | xcodebuild: libtheora/lib/tokenize.c:1193:16: warning: variable 'eb1' may be uninitialized when used here [-Wconditional-uninitialized]
- NOTE | xcodebuild: libtheora/lib/tokenize.c:1095:3: note: variable 'eb1' is declared here
- WARN | xcodebuild: libtheora/lib/tokenize.c:1354:40: warning: variable 'ti' may be uninitialized when used here [-Wconditional-uninitialized]
- NOTE | xcodebuild: libtheora/lib/tokenize.c:1331:5: note: variable 'ti' is declared here