A Discrete-Event Network Simulator
API
warnings.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2022 Universita' di Firenze, Italy
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Tommaso Pecorella <tommaso.pecorella@unifi.it>
18  */
19 
20 #ifndef NS3_WARNINGS_H
21 #define NS3_WARNINGS_H
22 
61 #if defined(_MSC_VER)
62 // You can find the MSC warning codes at
63 // https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warnings-c4000-c5999
64 #define NS_WARNING_PUSH __pragma(warning(push))
65 #define NS_WARNING_SILENCE_DEPRECATED __pragma(warning(disable : 4996))
66 #define NS_WARNING_POP __pragma(warning(pop))
67 
68 #elif defined(__GNUC__) || defined(__clang__)
69 // Clang seems to understand these GCC pragmas
70 #define NS_WARNING_PUSH _Pragma("GCC diagnostic push")
71 #define NS_WARNING_SILENCE_DEPRECATED \
72  _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
73 #define NS_WARNING_POP _Pragma("GCC diagnostic pop")
74 
75 #else
76 #define NS_WARNING_PUSH
77 #define NS_WARNING_SILENCE_DEPRECATED
78 #define NS_WARNING_POP
79 
80 #endif
81 
82 #define NS_WARNING_PUSH_DEPRECATED \
83  NS_WARNING_PUSH; \
84  NS_WARNING_SILENCE_DEPRECATED
85 
86 #endif /* NS3_WARNINGS_H */