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