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.

“_ _TI_COMPILER_VERSION_ _” incorrectly treated by syntax highlighter

Other Parts Discussed in Thread: MSP430F2274

Hi,

In a MSP430F2274 project compiled with TI MSP430 compiler 4.1, a part of conditional precompiled content depending on predefined macro “_ _TI_COMPILER_VERSION_ _” is darkened.

In MSP430’s manual SLAU132 “_ _TI_COMPILER_VERSION_ _” is defined. Examination of the .pp source file also showed that part enclosed in the conditional block directly below

#elif (defined __TI_COMPILER_VERSION__) && (defined __MSP430__)

has been included in the file.
However the syntax highlighting of CCS still show the block (the conditional block directly below the cited line above) in gray. This wasted us a significant time because we traced back and forth in vain for locating a specific definition without going into the <msp430.h> which has been grayed.

We would like to know is the inconsistency between “__TI_COMPILER_VERSION__” and CCS highlighting a known problem?
 
  
Matt

  • This is mishandled by CCS.  I'll get something filed on this and get back to you with the ID number for it.  

    The problem here is that __TI_COMPILER_VERSION__ is a special preprocessor symbol that is defined not by the user, but by the compiler.  It is a good guess that CCS does not consider such symbols when parsing the C code to figure out how to highlight it.

    Thanks and regards,

    -George

  • Gerogem,

    Thanks, now we understand it.

  • This issue is filed in the SDOWP system with id SDSCM00044279.  Feel free to track it with the SDOWP link below in my signature.

    Thanks and regards,

    -George

  • Geroge,

    I saw the report. Thanks. Now I just try to manually spot or search for the __TI_COMPILER_VERSION__  keyword when I suspect any problem from it. Hope the new release could fix it soon.

  • Is have the following:
    #if defined(__TI_COMPILER_VERSION__)
      // Not outgrayed
    #endif

    #if defined ( __ICC430__ || __TI_COMPILER_VERSION__ )

    // outgrayed
        if(strcmp((char*) buffer, "FAT16   ") &&
           strcmp((char*) buffer + 9, "FAT16   "))
    #else

    // Not outgrayed
        if(strcmp_P((char*) buffer, PSTR("FAT16   ")) &&
           strcmp_P((char*) buffer + 9, PSTR("FAT16   ")))
    #endif

    Why is the second outgreyed ?

  • O.K. I got is. The right syntax is:
    #if defined( __ICC430__ ) || defined (__TI_COMPILER_VERSION__ )

    regards,

    Steffen

  • Sorry to bump a necro thread, but it seems better than starting a new one.

    It seems that it's been over two years since this issue was reported, and yet it's still occurring! The strange part is certain projects highlight correctly, and others don't. In one case, two different files with the exact same source code highlighted differently. The reason I'm concerned is that it's not clear whether or not the preprocessor is actually handling it correctly -- will my interrupts be omitted?

    Example:

  • Aurelius Rowsell said:
    The strange part is certain projects highlight correctly, and others don't. In one case, two different files with the exact same source code highlighted differently. The reason I'm concerned is that it's not clear whether or not the preprocessor is actually handling it correctly -- will my interrupts be omitted?

    The highlighting in the CCS editor is done by CCS trying to track which macros are defined in the code, which CCS sometimes gets wrong. If you are concerned about interrupts being omitted by the compiler, try putting #warning into the #if conditional parts to see which one the compiler preprocessor is seeing as defined.

    To see which predefined compiler macros CCS is using for a project look under the CCS project properties and show the advanced settings under C/C++ General -> Paths and Symbols -> Symbols. For a project which has correctly detected the TI compiler predefined macros you should see __TI_COMPILER_VERSION__ in the list of symbols (among others):

    Are there any differences between the symbols shown in the project where the highlighting works and the one where the highlighting doesn't work?

    Also, are you using Linux or Windows?

    Under Linux I have seen that sometimes the TI compiler predefined symbols are missing for some projects, but didn't track down what caused the problem.

  • I noticed under windows 7 and CCS (6.0.1.00040) that symbol __TI_COMPILER_VERSION__ (and many others) are not displayed in Symbols table after adding "${PROJECT_ROOT}/driverlib/MSP430FR5xx_6xx" path to MSP430 Compiler -> Include options. Removing this path restores full proper list of symbols, and also lines of code dedicated to use under __TI_COMPILER_VERSION__ are not grayed. I haven't found what definition in driver lib causes this problem. Maybe it will help TI to found the reason of the problem.
  • I've just found solution. Only using relative path "../driverlib/MSP430FR5xx_6xx" helps and now all symbols are shown and properly interpreted by editor. I think it is a problem with eclipse, not driverlib. Maybe using eclipse luna by CCS in the future helps.