This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

bug: source code is dimmed incorrectly in header files

When #defines are created using the project settings rather than in the source code, the syntax highlighter incorrectly dims sections between #ifdef / #endif blocks in header files.

For example, if I define DEBUG in the project settings and then have this in a header file:

// header.h
#ifdef DEBUG
void do_debug_thing();  // this line dimmed incorrectly
#endif

Does this make sense? I'm using the latest Keil V5 as of 18th January 2023.

Thanks,
Charlie.

Parents
  • If the symbol is defined in the project settings then it works. To see the problem, use the Misc Controls section to include a header file automatically and then define symbols in that header file.

    For example, create a file called header.h

    #pragma once

    #define TESTING

    Then, in Misc Controls, add -include "header.h"

    Then, in a C source file, try this

    #if !defined(TESTING)

    int test;  // This line will be dimmed when it shouldn't be

    #endif

Reply
  • If the symbol is defined in the project settings then it works. To see the problem, use the Misc Controls section to include a header file automatically and then define symbols in that header file.

    For example, create a file called header.h

    #pragma once

    #define TESTING

    Then, in Misc Controls, add -include "header.h"

    Then, in a C source file, try this

    #if !defined(TESTING)

    int test;  // This line will be dimmed when it shouldn't be

    #endif

Children