Hello,
I am new to the CodeWarrior 10.1 environment and I am using the HCS08 Compiler for my project.
In my code I noticed that a static variable was being created and initialized at the start of a function but was never used and no warnings were thrown up.
Is there a -Wall argument to invoke somewhere for this compiler? How can I make sure this isn't happening elsewhere without scouring every file?
Thanks in advance,
Tom
Solved! Go to Solution.
Hello,
yes, there is an option to ignore all warnings: -W2.
But the compiler will not produce a warning for an unreferenced static local. A static local variable is handled like a global variable (with different access scope, of course), an if it is not used, the linker will dead strip/remove it.
But you can find the information that it has been removed in the linker map file here:
*********************************************************************************************
UNUSED-OBJECTS SECTION
---------------------------------------------------------------------------------------------
Otherwise you could use a tool like PC-lint to catch these kind of things.
Hope this helps,
BK
Hello,
yes, there is an option to ignore all warnings: -W2.
But the compiler will not produce a warning for an unreferenced static local. A static local variable is handled like a global variable (with different access scope, of course), an if it is not used, the linker will dead strip/remove it.
But you can find the information that it has been removed in the linker map file here:
*********************************************************************************************
UNUSED-OBJECTS SECTION
---------------------------------------------------------------------------------------------
Otherwise you could use a tool like PC-lint to catch these kind of things.
Hope this helps,
BK
Hi BK,
Thanks for the help. I was actually hoping the compiler would offer an option to turn on all warnings without the help of a tool like PC Lint. (The opposite of using -W2). But I shall concede defeat to another tool I guess.
The information about the unused object sections is valuable, I did not know that kind of output was included in the map file. Thanks for that!
Tom
Hello,
the S08 compiler is pretty verbose about variables/etc. But not in this case for static locals. Too bad in this case.
BK