This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

  • Resolved

__LINE__ and __FILE__ give "Syntax Error" in CCS Editor perspectives.

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__.

  • Guru 144285 points

    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.

    ____________________________________________________________________________

    Please click This Resolved My Issue if the reply answers your question.

    Search the wikis for common questions: Compiler, CCSv6, CCSv7
    Track 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.

    http://e2e.ti.com/support/development_tools/compiler/f/343/t/84818.aspx#292631

  • In reply to Aaron Schlicht:

    These two macros are known issue and should be fixed in CCS5.2 update.

    Regards,
    Patrick 

This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.