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 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Peter D. Barnes, Jr. <pdbarnes@llnl.gov>
7 */
8
9#ifndef NS3_BUILD_PROFILE_H
10#define NS3_BUILD_PROFILE_H
11
12/**
13 * \file
14 * \ingroup debugging
15 * NS_BUILD_DEBUG, NS_BUILD_RELEASE, and NS_BUILD_OPTIMIZED
16 * macro definitions.
17 */
18
19/**
20 * \ingroup debugging
21 * Build profile no-op macro.
22 * \param [in] code The code to skip.
23 */
24#define NS_BUILD_PROFILE_NOOP(code) \
25 do \
26 if (false) \
27 { \
28 code; \
29 } \
30 while (false)
31
32/**
33 * \ingroup debugging
34 * Build profile macro to execute a code snippet.
35 * \param [in] code The code to execute.
36 */
37#define NS_BUILD_PROFILE_OP(code) \
38 do \
39 { \
40 code; \
41 } while (false)
42
43#ifdef NS3_BUILD_PROFILE_DEBUG
44/**
45 * \ingroup debugging
46 * Execute a code snippet in debug builds.
47 * \param [in] code The code to execute.
48 */
49#define NS_BUILD_DEBUG(code) NS_BUILD_PROFILE_OP(code)
50#else
51#define NS_BUILD_DEBUG(code) NS_BUILD_PROFILE_NOOP(code)
52#endif
53
54#ifdef NS3_BUILD_PROFILE_RELEASE
55/**
56 * \ingroup debugging
57 * Execute a code snippet in release builds.
58 * \param [in] code The code to execute.
59 */
60#define NS_BUILD_RELEASE(code) NS_BUILD_PROFILE_OP(code)
61#else
62#define NS_BUILD_RELEASE(code) NS_BUILD_PROFILE_NOOP(code)
63#endif
64
65#ifdef NS3_BUILD_PROFILE_OPTIMIZED
66/**
67 * \ingroup debugging
68 * Execute a code snippet in optimized builds.
69 * \param [in] code The code to execute.
70 */
71#define NS_BUILD_OPTIMIZED(code) NS_BUILD_PROFILE_OP(code)
72#else
73#define NS_BUILD_OPTIMIZED(code) NS_BUILD_PROFILE_NOOP(code)
74#endif
75
76#endif /* NS3_BUILD_PROFILE_H */