Suppressing Inspections for code disabled by conditional defines

Hello! I wonder if it's possible to disable Inspections for the code that is not relevant/disabled by conditional compilation directives?
We have quite a complex project in different programming languages and parts of our code have definitions of the same variables inside #ifdef defines and IntelliJ Idea warns a lot about duplicate variable definitions. Like

#ifdef SpecificEnvironment
int variable=1
#else
int variable=2
#endif

It's just a small example of what we face, but the problem is much more complex. I want to disable Inspections for the case where SpecificEnvironment is not defined. Is it possible? Eclipse was able to do that.

Thanks!

6 comments
Comment actions Permalink

It's not supported. What language do you use? What is the standard for ifdef conditions used in this language?

0
Comment actions Permalink

That's so bad :(
We have it written in C++, PHP, Typescript and ActionScript/Flex. We have a lot of conditional defines all around the code in different languages and we try to port it from Eclipse and collect all the code under the same environment - so we were considering IntelliJ as a solution. It worked pretty well in Eclipse.

Do you have it in plans? Are there any workarounds? Any special comments we can add around defines we have in place?

0
Comment actions Permalink

John, is that C++? Do you use CLion or some third-partly C++ plugin?

0
Comment actions Permalink

It's mostly C++ and ActionScript. And we can't drop ActionScript for at least a year or two (because the codebase we have is still quite huge).

0
Comment actions Permalink

IntelliJ IDEA doesn't support C++ code, what do you use to edit/highlight it?

0
Comment actions Permalink

So there's no way to bring all the code under the same environment and there's no way to suppress inspections in the unused define blocks, right?

0

Please sign in to leave a comment.