A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
build-profile.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2015 LLNL
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: Peter D. Barnes, Jr. <pdbarnes@llnl.gov>
18 */
19
20#ifndef NS3_BUILD_PROFILE_H
21#define NS3_BUILD_PROFILE_H
22
23/**
24 * \file
25 * \ingroup debugging
26 * NS_BUILD_DEBUG, NS_BUILD_RELEASE, and NS_BUILD_OPTIMIZED
27 * macro definitions.
28 */
29
30/**
31 * \ingroup debugging
32 * Build profile no-op macro.
33 * \param [in] code The code to skip.
34 */
35#define NS_BUILD_PROFILE_NOOP(code) \
36 do \
37 if (false) \
38 { \
39 code; \
40 } \
41 while (false)
42
43/**
44 * \ingroup debugging
45 * Build profile macro to execute a code snippet.
46 * \param [in] code The code to execute.
47 */
48#define NS_BUILD_PROFILE_OP(code) \
49 do \
50 { \
51 code; \
52 } while (false)
53
54#ifdef NS3_BUILD_PROFILE_DEBUG
55/**
56 * \ingroup debugging
57 * Execute a code snippet in debug builds.
58 * \param [in] code The code to execute.
59 */
60#define NS_BUILD_DEBUG(code) NS_BUILD_PROFILE_OP(code)
61#else
62#define NS_BUILD_DEBUG(code) NS_BUILD_PROFILE_NOOP(code)
63#endif
64
65#ifdef NS3_BUILD_PROFILE_RELEASE
66/**
67 * \ingroup debugging
68 * Execute a code snippet in release builds.
69 * \param [in] code The code to execute.
70 */
71#define NS_BUILD_RELEASE(code) NS_BUILD_PROFILE_OP(code)
72#else
73#define NS_BUILD_RELEASE(code) NS_BUILD_PROFILE_NOOP(code)
74#endif
75
76#ifdef NS3_BUILD_PROFILE_OPTIMIZED
77/**
78 * \ingroup debugging
79 * Execute a code snippet in optimized builds.
80 * \param [in] code The code to execute.
81 */
82#define NS_BUILD_OPTIMIZED(code) NS_BUILD_PROFILE_OP(code)
83#else
84#define NS_BUILD_OPTIMIZED(code) NS_BUILD_PROFILE_NOOP(code)
85#endif
86
87#endif /* NS3_BUILD_PROFILE_H */