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.

Compiler/TMS570LS3137: Macros within header files do not appear to be evaluated during a clean

Part Number: TMS570LS3137

Tool/software: TI C/C++ Compiler

I attached a screen-shot that shows this problem. The header file below does not include the header file that defines DEBUG_CONFIG_VARS_INCLUDED, so the precompilation-condition #if (DEBUG_CONFIG_VARS_INCLUDED == TRUE) should be evaluated as false, but it is not -- see the screen shot shows the definitions of IntegralHoldEnable and EnableSmoothing as not-grayed.

If we perform a clean-build, this is still not discovered; however if we edit this particular header-file, then this bug will be discovered. It would appear that clean does not re-evaluate all header files.

Thanks,

Jim

 discovered. 

  • I can't seem to get it to ever highlight the conditional code when using #if.   For me #ifdef works fine but not #if.

    The indexer should run as soon as you save the file, which you would need to do to add or remove the #include for the file that includes the definition.

    If you change your code to is #ifdef and then have your other header file define or not DEBUG_CONFIG_VARS_INCLUDED does it work?

    Also is the header file with the #define in it part of your project or is it a file that is located elsewhere and just referenced by the include path?

    Regards,

    John

  • I tried to put together a little more complete example:

  • This is not a bug after all; from the C-standard, "A control line of the form #include <filename> causes the replacement of that line by the entire contents of the file filename". In my particular example, the header-file-snippet I attached happened to be ALWAYS preceded by the other header-file that defined the macro of interest. If I changed the order of the #include statements in our code, then the compiler properly found the missing macro definition.
    Thanks,
    Jim
  • Jim,

    Thanks for letting us know. I thought maybe the indexer was getting confused but I couldn't trigger the problem.

    Regards,
    John