On 09/18/2015 08:29 PM, Martin Sebor wrote:
I guess it is not the 'const' I think should be handled special but the
'static'. Having unused static variables (const or not) declared in a
header file but unused seems reasonable since the header file may be
included in multiple .c files each of which uses a subset of the static
variables.
I tend to agree. I suppose diagnosing unused non-const static
definitions might be helpful but I can't think of a good reason
to diagnose unused initialized static consts in C. Especially
since they're not diagnosed in C++.
Would diagnosing them in source files while avoiding the warning
for static const definitions in headers be an acceptable compromise?
It's probably worth a try.
jeff