cancel
Showing results for 
Search instead for 
Did you mean: 

Autodiscovery not working for nested preprocessor defines.

MGhah.1
Associate II

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

2 REPLIES 2
Markus GIRDLAND
ST Employee

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
Associate II

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