TI E2E Community
TI C/C++ Compiler
TI C/C++ Compiler - Forum
Why CCS 5.2 doesn't report a warning on unused" variables
Tried to search eClipse help for enabling this feature but no luck...I want my code to be clean by removing all "unused variables"
By default, the compiler does warn about unused local or static global variables. This can be disabled with the -pds179 option; make sure you are not using that option. The compiler cannot detect unused non-static global variables. Could you post source code that demonstrates the problem?
As Archaeologist said it's set by default, you can check if it's set going to:
Window -> Preferences -> C/C++ -> Code Analysis -> Potential Programming Problems -> Unused variable declaration in file scope
Option #179 is selected and works fine in detecting unused "Local" variables, but no option for detecting unused "global" variables!?
There is no option for detecting unused non-static globals. Knowing whether the global is truly unused would require looking at every source file in the entire application, and the part of the compiler that does the detection can only see the one source file.
All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.