The use of the predefined macros __LINE__ and __FILE__ (and probably __DATE__, etc) generate "syntax error" warning indicators in the editor perspectives. This can easily be demonstrated with the following:
printf ("__LINE__: %d, __FILE__: %s\n", __LINE__, __FILE__);
The line would be flagged as having a syntax error in the margins and underlined in yellow.
We are using a similar printf statement in a custom ASSERT macro which is used in many places and thus indicate many syntax errors. It is our policy to try to remove all warnings from the code and these "FALSE" warnings hinder this (and clutters the source display).
It appears that the editors are treating __LINE__ and __FILE__ as empty macros which then cause the syntax error. Work-around-s of defining values for __LINE__ and __FILE__ remove the syntax error warning but then cause compiler errors when the code is compiled.
The compiler properly handles these and produces no warnings and properly values __LINE__ and __FILE__.
Please take a look at this post which talks about such syntax errors as reported by the Eclipse CDT parser and how to turn it off. Hope this helps.
If a post answers your question please mark it with the "Verify Answer" button
Search the wikis for common questions: CGT, BIOS, CCSv3, CCSv4Track a known bug with SDOWP. Enter the bug id in the "Find Record ID" box
We use __LINE__ and __FILE__ in our assert macro. To workaround eclipse flagging a syntax error, I added the following to our assert macro header file:
#ifndef __TI_COMPILER_VERSION__#define __LINE__ 0#define __FILE__ "\0"#endif
You can replace __TI_COMPILER_VERSION__ with any of your compiler pre-defined macros. See this post for getting a list of the compiler pre-defined macros with a null C program.
These two macros are known issue and should be fixed in CCS5.2 update.
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.