Warnings.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. #pragma once
  6. //=============================
  7. // Enabled Warnings
  8. //=============================
  9. #pragma warning(default:4242) // conversion possible loss of data
  10. //=============================
  11. // Disabled Warnings
  12. //=============================
  13. // Warnings that we don't care about
  14. #pragma warning(disable: 4100) // unreferenced formal parameter
  15. #pragma warning(disable: 4127) // constant expression for Trace/Assert
  16. #pragma warning(disable: 4200) // nonstandard extension used: zero-sized array in struct/union
  17. #pragma warning(disable: 4201) // nameless unions are part of C++
  18. #pragma warning(disable: 4512) // private operator= are good to have
  19. #pragma warning(disable: 4481) // allow use of abstract and override keywords
  20. #pragma warning(disable: 4324) // structure was padded due to alignment specifier
  21. // warnings caused by normal optimizations
  22. #if DBG
  23. #else // DBG
  24. #pragma warning(disable: 4702) // unreachable code caused by optimizations
  25. #pragma warning(disable: 4189) // initialized but unused variable
  26. #pragma warning(disable: 4390) // empty controlled statement
  27. #endif // DBG
  28. // PREFAST warnings
  29. #ifdef _PREFAST_
  30. // Warnings that we don't care about
  31. #pragma warning(disable:6322) // Empty _except block
  32. #pragma warning(disable:6255) // _alloca indicates failure by raising a stack overflow exception. Consider using _malloca instead.
  33. #pragma warning(disable:28112) // A variable (processNativeCodeSize) which is accessed via an Interlocked function must always be accessed via an Interlocked function. See line 1024: It is not always safe to access a variable which is accessed via the Interlocked* family of functions in any other way.
  34. #pragma warning(disable:28159) // Consider using 'GetTickCount64' instead of 'GetTickCount'. Reason: GetTickCount overflows roughly every 49 days. Code that does not take that into account can loop indefinitely. GetTickCount64 operates on 64 bit values and does not have that problem
  35. #ifndef NTBUILD
  36. // Would be nice to clean these up.
  37. #pragma warning(disable:6054) // String 'dumpName' might not be zero-terminated.
  38. #pragma warning(disable:6244) // Local declaration of 'Completed' hides previous declaration at line '76'
  39. #pragma warning(disable:6246) // Local declaration of 'i' hides declaration of the same name in outer scope.
  40. #pragma warning(disable:6326) // Potential comparison of a constant with another constant.
  41. #endif
  42. #endif // _PREFAST_