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.

editor highlights syntax error that is not

the editor highlights the TEST and TEST_FAIL_MESSAGE lines as "syntax error" (no indication what syntax is in error).  but the code compiles without error.

#include "unity_fixture.h"

TEST(Test01a_Init, testInitCalled)
{
    if (!_InitCalled)
    {
        TEST_FAIL_MESSAGE("Init() was not called");
         return;
    }
}

"unity_fixture.h" is from https://sourceforge.net/projects/unity/

  • Kurt,

    Could you please check if this is reproducible in a new workspace with CCS 5.1? I don't see syntax errors with this code snippet.

    Also check your settings under Project Properties->C/C++ General->Code Analysis->Launching. The "Run with build" and "Run as you type" settings should be unchecked.

  • 1) yes, I still get the error with a new workspace. does your code build? I did not see the syntax error until I pointed to the Unity include files and ran a build.

    2) I do not see "C/C++ General" at the top level of Project | Properties. 

  • My code does not build, I get other identifier undefined errors with the provided code snippet, but there are no syntax errors in the editor. If you can send me your source file(s) I can see if I can reproduce the issue.

    You would need to click on the "Show Advanced Settings" at the bottom of the Properties page to see C/C++ General.

  • 1) You have to be able to build.  That is why I gave you the reference to Unity. Download Unity.  Add unity/src and unity/extras/fixture/src directories to your Include path.

    here is my complete source code:

    #include "unity_fixture.h"

    TEST_GROUP(Test01b_Init);

    TEST_SETUP(Test01b_Init)
    {
    }
    TEST_TEAR_DOWN(Test01b_Init)
    {
    }

    TEST(Test01b_Init, testInitUSB)
    {
    }

    TEST_GROUP_RUNNER(Test01b_Init)
    {
     RUN_TEST_CASE(Test01b_Init, testInitUSB);
    }

    2) yes, they are unchecked

  • Thanks for the source file, I was able to reproduce the syntax error. I'm not quite sure why the indexer is reporting an error on just this one macro. But I was able to find a way to disable the indexer markers without disabling the indexer itself (so that code completion and declaration-navigation will still continue to work).

    Go to Window Preferences, and the page shown below and uncheck the three checkboxes for "C/C++ Indexer Markers". Let us know if this works.

  • Yes, that works.

    But there are places where the indexer is useful.  I will leave it as is, hopefully knowing which parts are broken, and wait for a fix.