qxLib
suppress_warnings.h
Go to the documentation of this file.
1 /**
2 
3  @file suppress_warnings.h
4  @author Khrapov
5  @date 11.11.2020
6  @copyright © Nick Khrapov, 2021. All right reserved.
7 
8 **/
9 #pragma once
10 
11 #include <qx/macros/config.h>
12 
13 #if QX_WIN
14 
15  /**
16  @def QX_PUSH_SUPPRESS_MSVC_WARNINGS
17  @brief Disable specified MSVC warnings
18  @param warnings - MSVC warnings numbers separated by space
19  **/
20  #define QX_PUSH_SUPPRESS_MSVC_WARNINGS(warnings) __pragma(warning(push)) __pragma(warning(disable : warnings))
21 
22  /**
23  @def QX_PUSH_SUPPRESS_ALL_WARNINGS
24  @brief Disable all warnings
25  **/
26  #define QX_PUSH_SUPPRESS_ALL_WARNINGS() __pragma(warning(push, 0))
27 
28  /**
29  @def QX_POP_SUPPRESS_WARNINGS
30  @brief Enable all warnings
31  **/
32  #define QX_POP_SUPPRESS_WARNINGS() __pragma(warning(pop))
33 
34  /**
35  @brief Force disable MSVC warnings, including all nested header includes
36  @note Prefer using QX_PUSH_SUPPRESS_MSVC_WARNINGS and QX_POP_SUPPRESS_WARNINGS
37  @param warnings - MSVC warnings numbers separated by space
38  **/
39  #define QX_DISABLE_MSVC_WARNINGS(warnings) __pragma(warning(disable : warnings))
40 
41  /**
42  @brief Enable warnings after QX_DISABLE_MSVC_WARNINGS
43  @param warnings - MSVC warnings numbers separated by space
44  **/
45  #define QX_RESTORE_MSVC_WARNINGS(warnings) __pragma(warning(default : warnings))
46 
47 #else
48 
49  #define QX_PUSH_SUPPRESS_MSVC_WARNINGS(warnings)
50  #define QX_PUSH_SUPPRESS_ALL_WARNINGS()
51  #define QX_POP_SUPPRESS_WARNINGS()
52  #define QX_DISABLE_MSVC_WARNINGS(warnings)
53  #define QX_RESTORE_MSVC_WARNINGS(warnings)
54 
55 #endif