Skip to content

LCC: get rid of excess -Wunused-but-set-variable on release builds

LCC, as of 1.26, has a buggy EDG frontend that emits -Wunused-but-set-variable warning even if there's something like "(void)var" when frontend optimizations are enabled (>=-O1). To get rid of this warning, we use "__builtin_prefetch(&(var))" instead. It clearly disallows compiler to optimize usage of this variable, and thus don't emit a warning.

In all places, where this warning was emitted, void casts are replaced to "TREAT_AS_USED(var)", which is defined in cmStandardLexer.h for lexers, and in cmConfigure.cmake.h.in for all other source code.

Merge request reports