A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
unused.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2012 Andrey Mazo
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: Andrey Mazo <ahippo@yandex.com>
18 */
19
20#ifndef UNUSED_H
21#define UNUSED_H
22
23#include "ns3/deprecated.h"
24
40// We can't use NS_DEPRECATED_3_36 here because NS_UNUSED
41// is used as a statement following a declaration:
42// int x;
43// NS_UNUSED (x);
44// NS_DEPRECATED needs to be applied to the declaration
45// NS_DEPRECATED_3_36 ("use double instead") int x;
46// Instead we resort to a pragma
47
48#ifndef NS_UNUSED
49#define NS_UNUSED(x) \
50 _Pragma("GCC warning \"NS_UNUSED is deprecated, use [[maybe_unused]] directly\"")((void)(x))
51#endif
52
61#ifndef NS_UNUSED_GLOBAL
62#if defined(__GNUC__)
63#define NS_UNUSED_GLOBAL(x) \
64 NS_DEPRECATED_3_36("NS_UNUSED_GLOBAL is deprecated, use [[maybe_unused]] directly") \
65 [[maybe_unused]] x
66#elif defined(__LCLINT__)
67#define NS_UNUSED_GLOBAL(x) \
68 NS_DEPRECATED_3_36("NS_UNUSED_GLOBAL is deprecated, use [[maybe_unused]] directly") \
69 /*@unused@*/ x
70#else
71#define NS_UNUSED_GLOBAL(x) \
72 NS_DEPRECATED_3_36("NS_UNUSED_GLOBAL is deprecated, use [[maybe_unused]] directly") \
73 x
74#endif
75#endif
76
77#endif /* UNUSED_H */