CLion, Incorrect "Pragma diagnostic pop could not pop, no matching push" inspection warning

Answered

I recently updated my Clion to 2018.2.  Now every .cpp/.h file where I have a 

#pragma clang diagnostic pop

at the end of the file, I am getting a "Pragma diagnostic pop could not pop, no matching push" inspection warning.  I have checked and double checked and I am certain that my those statements are balanced and correct.  This is happening in every file where the #pragma clang diagnostic pop is at the end of the file.  My typical use case is to have the the push at the top of a file like so:

#pragma clang diagnostic push
#pragma ide diagnostic ignored "OCUnusedStructInspection"
#pragma ide diagnostic ignored "CannotResolve"

followed my all my code, then at the end of the file have the following:

#pragma clang diagnostic pop

In most cases Clion inserted these statements as I disabled certain inspections for an entire file.

This always happens with the last pop statement in the file where the push is at the beginning of the file.  Any push/pop statements within the body seem to work fine.  

Thanks,

Craig

 

0
2 comments

Hello! Sorry for the inconvenience. We have a related issue in our tracker: https://youtrack.jetbrains.com/issue/CPP-13405. Feel free to comment or upvote in order to get updates.

Meanwhile you can disable options in File | Settings | Languages & Frameworks | C/C++ | Clangd as a workaround.

0
Avatar
Permanently deleted user

Thanks Anna for your response.  I did up vote the issue and look forward to it being resolved in a future release.

0

Please sign in to leave a comment.