How to fix C # pragma problems by disabling warnings that don't display correctly

I am currently having a problem using a third-party library that has broken pragmas that push a lot of shutdown warnings without them appearing correctly so that they stay forever. I want warnings to be included to detect any problems in my code that includes third-party files. Since changing a third-party source should be a last resort, I would like to know if there is any other way to fix this.

The only thing I can think of is to manually add calls #pragma warning (pop)until warnings start to appear again, but it seems really dirty. Is there some easy way to just pop everything that was pushed right away with a single call or something else? If this is not an option, are there other solutions to this problem than trying to figure out how to fix broken pragmas in a third-party source? The source of the third party is very complex, so correcting it there will not be easy.

EDIT: There seems to be no real solution to this other than fixing third-party code, so I assume that I'm just working with the dirty solution of adding a group of statements #pragma warning (pop)to the files that I'm working on , to make sure the warnings are turned on. It sucks, a lot, but I don’t have time to fix the third-party code, so I need to do it now ... I will leave it open for a couple of days, and if there is no better solution, then I will close it somehow.

+3
source share
3 answers

, - , #pragma warning(pop) , . .

, .

0

this, :

#pragma warning( push )

#include "offending_lib.h"

#pragma warning( pop ) 
+2

, warpper .

.

, VC, reset :

#pragma warning(default)

: http://msdn.microsoft.com/en-us/library/2c8f766e.aspx

0

All Articles