Reputation: 26576
Is there an easy way to accomplish this?
#pragma warning(default: all)
This isn't valid as it is; I can give a specific warning number instead of all
and that will restore that one warning to default, but I want to restore all warnings to their default. I don't want to write out a long list of all the warnings!
My goal is to make sure my code compiles cleanly, and that I'm not accidentally hiding any warnings in my own code that may have been disabled elsewhere.
Assume this is in a huge codebase, where other programmers have disabled warnings in headers (including precompiled headers) that I include but don't control, and in project settings or via the command line.
Upvotes: 1
Views: 1690
Reputation: 9070
http://msdn.microsoft.com/en-us/library/2c8f766e(v=vs.110).aspx
I'm afraid that you might already look the above reference. But, my suggestion is using the push/pop feature of the warning pragma:
#pragma warning(push) // The very beginning of your code
#include <...>
#pragma warning(pop)
// Your code
...
Push allows you to save every warning state at that moment, and pop restores to the original state.
Upvotes: 1