Skip to main content
MGhah.1
Associate
March 13, 2021
Question

Autodiscovery not working for nested preprocessor defines.

Hello everybody,

I am wondering why autodiscovery is not working for nested preprocessor defines. In the attached project you can see the "#define DERIVATE 7890" is in "config.h" file.

In the "function1.c" file there is a block of #if ... #else .... #endif which based on the value of "DERIVATE" is grayed out correctly. Accordingly a nested definition for "test" occures inside the above mentioned #if ... #else .... #endif block. Now in "func2.c" there is another block of #if ... #else .... #endif which evaluates the value of the "test" but here the wrong blocks are grayed out which tells us the autodiscovery does not function for nested (or conditionally defined) preprocessor defines. Is there any work around this issue? I appreciate any comment on this.

Best Regards,

Manou

This topic has been closed for replies.

2 replies

Markus GIRDLAND
ST Employee
March 16, 2021

Hello MGhah!

The macro "test" is not known inside the func2.c file. It's only local to the function1.c file. To me it looks like you are trying to use macros for something it's not designed for. If I'm misunderstanding anything then please let me know!

MGhah.1
MGhah.1Author
Associate
March 22, 2021

Dear Mr.Girdland,

I appreciate your prompt reply and so sorry for my late response. You are absolutely right. In my first example the "test" was not visible in func2.c file. I just made an update to the files and I have attached them to this post. I still have the same problem althofh this time the "test"is visible in func2. When I hoover over "test" in func2, it shows me the correct value but the wrong block of code is grayed out. I even made a refresh, clean and rebuild but the problem persists.

I hope you can reproduce the problem at your desk as well. I have to add that, this is just a biginning of a much bigger discussion but this simple program should work fine first in the IDE.

Best Regards,

M.G.Golzar