msvc_recommended_pragmas.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #ifndef _MSC_VER
  2. #pragma error "This header is for Microsoft VC or clang-cl only."
  3. #endif /* _MSC_VER */
  4. /* Make MSVC more pedantic, this is a recommended pragma list
  5. * from _Win32_Programming_ by Rector and Newcomer.
  6. */
  7. #ifndef __clang__
  8. #pragma warning(error:4002) /* too many actual parameters for macro */
  9. #pragma warning(error:4003) /* not enough actual parameters for macro */
  10. #pragma warning(1:4010) /* single-line comment contains line-continuation character */
  11. #pragma warning(error:4013) /* 'function' undefined; assuming extern returning int */
  12. #pragma warning(1:4016) /* no function return type; using int as default */
  13. #pragma warning(error:4020) /* too many actual parameters */
  14. #pragma warning(error:4021) /* too few actual parameters */
  15. #pragma warning(error:4027) /* function declared without formal parameter list */
  16. #pragma warning(error:4029) /* declared formal parameter list different from definition */
  17. #pragma warning(error:4033) /* 'function' must return a value */
  18. #pragma warning(error:4035) /* 'function' : no return value */
  19. #pragma warning(error:4045) /* array bounds overflow */
  20. #pragma warning(error:4047) /* different levels of indirection */
  21. #pragma warning(error:4049) /* terminating line number emission */
  22. #pragma warning(error:4053) /* An expression of type void was used as an operand */
  23. #pragma warning(error:4071) /* no function prototype given */
  24. #pragma warning(disable:4101) /* unreferenced local variable */
  25. #pragma warning(error:4150)
  26. /* G_NORETURN */
  27. #pragma warning(error:4646) /* function declared with __declspec(noreturn) has non-void return type */
  28. #pragma warning(error:4715) /* 'function': not all control paths return a value */
  29. #pragma warning(error:4098) /* 'void' function returning a value */
  30. #pragma warning(disable:4244) /* No possible loss of data warnings */
  31. #pragma warning(disable:4305) /* No truncation from int to char warnings */
  32. #pragma warning(error:4819) /* The file contains a character that cannot be represented in the current code page */
  33. #endif /* __clang__ */
  34. /* work around Microsoft's premature attempt to deprecate the C-Library */
  35. #define _CRT_SECURE_NO_WARNINGS
  36. #define _CRT_NONSTDC_NO_WARNINGS