A Discrete-Event Network Simulator
API
unused.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2012 Andrey Mazo
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Andrey Mazo <ahippo@yandex.com>
19  */
20 
21 #ifndef UNUSED_H
22 #define UNUSED_H
23 
24 #include "ns3/deprecated.h"
25 
42 // We can't use NS_DEPRECATED_3_36 here because NS_UNUSED
43 // is used as a statement following a declaration:
44 // int x;
45 // NS_UNUSED (x);
46 // NS_DEPRECATED needs to be applied to the declaration
47 // NS_DEPRECATED_3_36 ("use double instead") int x;
48 // Instead we resort to a pragma
49 
50 #ifndef NS_UNUSED
51 # define NS_UNUSED(x) \
52  _Pragma ("GCC warning \"NS_UNUSED is deprecated, use [[maybe_unused]] directly\"") \
53  ((void)(x))
54 #endif
55 
64 #ifndef NS_UNUSED_GLOBAL
65 #if defined(__GNUC__)
66 # define NS_UNUSED_GLOBAL(x) \
67  NS_DEPRECATED_3_36 ("NS_UNUSED_GLOBAL is deprecated, use [[maybe_unused]] directly") \
68  [[maybe_unused]] x
69 #elif defined(__LCLINT__)
70 # define NS_UNUSED_GLOBAL(x) \
71  NS_DEPRECATED_3_36 ("NS_UNUSED_GLOBAL is deprecated, use [[maybe_unused]] directly") \
72  /*@unused@*/ x
73 #else
74 # define NS_UNUSED_GLOBAL(x) \
75  NS_DEPRECATED_3_36 ("NS_UNUSED_GLOBAL is deprecated, use [[maybe_unused]] directly") \
76  x
77 #endif
78 #endif
79 
80 #endif /* UNUSED_H */