Static analyzer warnings

Running the Xcode static analyzer i get few warnings:

Dead store

JuceLibraryCode/modules/juce_graphics/unicode/sheenbidi/Source/SBParagraph.c:275:5: Value stored to 'lastLink' is never read
JuceLibraryCode/modules/juce_graphics/fonts/harfbuzz/hb-ot-layout-common.hh:3756:7: Value stored to 'varStore' is never read
JuceLibraryCode/modules/juce_graphics/fonts/harfbuzz/hb-ot-var-gvar-table.hh:706:6: Value stored to 'flush' is never read
JuceLibraryCode/modules/juce_graphics/fonts/harfbuzz/hb-buffer-deserialize-text-glyphs.hh:325:46: Value stored to 'eof' during its initialization is never read
JuceLibraryCode/modules/juce_graphics/fonts/harfbuzz/hb-buffer-deserialize-text-unicode.hh:175:46: Value stored to 'eof' during its initialization is never read
JuceLibraryCode/modules/juce_graphics/fonts/harfbuzz/hb-buffer-verify.cc:174:5: Value stored to 'start' is never read
JuceLibraryCode/modules/juce_graphics/fonts/harfbuzz/hb-buffer-verify.cc:305:7: Value stored to 'start' is never read
JuceLibraryCode/modules/juce_graphics/fonts/harfbuzz/OT/Layout/GSUB/ReverseChainSingleSubstFormat1.hh:102:5: Value stored to 'count' is never read
JuceLibraryCode/modules/juce_graphics/fonts/harfbuzz/hb-ot-shaper-myanmar-machine.hh:450:2: Value stored to 'te' is never read

It’s an old version of Xcode (12.5) by the way ; didn’t try with more recent.

Still the same with JUCE 8.0.8 ; am i the only one with that warnings?

These are all from external libraries so I wouldn’t be surprised if the JUCE team made the conscious decision to ignore warnings in these files.

Do you see any macros around these? It’s not uncommon to see warnings about unused variables if they’re only used within some #if SOME_PLATFORM macro.

1 Like

Mainly not ; it just plain dead stores due to overzealous redundant initializations.
Notice that compilation is on macOS Big Sur ; could be related.
Anyway it took me 2 minutes to silent them with (void) statements (like below).

Unfortunately I don’t see a good way of suppressing these warnings. We want to avoid modifying the third-party dependencies themselves, especially because new analyzer versions might introduce new checks that in turn require new changes to the dependencies. clang-tidy is supposed to support // NOLINTBEGIN and // NOLINTEND to suppress warnings within a range of lines, but at the moment I can’t get this to work for the deadcode.DeadStores warnings we’re seeing.

2 Likes

Good to know, thanks.