• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 // clang-format off
17 // compile and version specific, warning available since vs 2022
18 #if defined(__clang__) || defined(__GNUC__)
19 #define W_SUPPRESS_UNUSED _Pragma("GCC diagnostic ignored \"-Wunused-parameter\"")
20 #elif defined(_MSC_VER) && _MSC_VER > 1934
21 #define W_SUPPRESS_UNUSED _Pragma ("warning(disable : 5264)")
22 #elif defined(_MSC_VER) && _MSC_VER <= 1934
23 #define W_SUPPRESS_UNUSED
24 #else
25 #define W_SUPPRESS_UNUSED
26 #endif
27 
28 // compile and version specific, warning available since vs 2017
29 #if defined(__clang__) || defined(__GNUC__)
30 #define W_THIS_USED_BASE_INITIALIZER_LIST
31 #elif defined(_MSC_VER) && _MSC_VER > 1934
32 #define W_THIS_USED_BASE_INITIALIZER_LIST _Pragma ("warning(disable : 4355)")
33 #elif defined(_MSC_VER) && _MSC_VER <= 1934
34 #define W_THIS_USED_BASE_INITIALIZER_LIST __pragma(warning(disable:4355))
35 #else
36 #define W_THIS_USED_BASE_INITIALIZER_LIST
37 #endif
38 
39 // compile and version specific push and pop scopes
40 #if defined(__clang__) || defined(__GNUC__)
41 #define WARNING_SCOPE_START(...)    \
42     _Pragma("GCC diagnostic push"); \
43     __VA_ARGS__;
44 #define WARNING_SCOPE_END() _Pragma("GCC diagnostic pop");
45 #elif defined(_MSC_VER) && _MSC_VER > 1916
46 #define WARNING_SCOPE_START(...) \
47     _Pragma("warning(push)");    \
48     ##__VA_ARGS__;
49 #define WARNING_SCOPE_END() _Pragma("warning(pop)");
50 #elif defined(_MSC_VER) && _MSC_VER <= 1916
51 #define WARNING_SCOPE_START(...) \
52     __pragma(warning(push)) ;    \
53     ##__VA_ARGS__;
54 #define WARNING_SCOPE_END() __pragma(warning(pop)) ;
55 #else
56 #define WARNING_SCOPE_START(...)
57 #define WARNING_SCOPE_END()
58 #endif
59 // clang-format on
60