Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / native_client / src / shared / utils / debugging.h
1 /*
2  * Copyright 2009 The Native Client Authors. All rights reserved.
3  * Use of this source code is governed by a BSD-style license that can be
4  * found in the LICENSE file.
5  */
6
7 /* Define simple debugging utilities that are turned on/off by the
8  * value of the define flag DEBUGGING.
9  *
10  * To turn on debugging of instruction decoding, change value of
11  * DEBUGGING to 1.
12  *
13  */
14
15 #ifndef NATIVE_CLIENT_SRC_SHARED_UTILS_DEBUGGING_H__
16 #define NATIVE_CLIENT_SRC_SHARED_UTILS_DEBUGGING_H__
17
18 /* Turn off debugging if not otherwise specified in the specific code file. */
19 #ifndef DEBUGGING
20 #define DEBUGGING 0
21 #endif
22
23 #if DEBUGGING
24 /* Defines to execute statement(s) s if in DEBUGGING mode, and compile
25  * in either mode. This allows type checking to be applied at all times.
26  */
27 #define DEBUG(s) s
28 #else
29 /* Defines to compile but not include statement(s) s if not
30  * in DEBUGGING mode.
31  */
32 #define DEBUG(s) do { if (0) { s; } } while (0)
33 #endif
34
35 #if DEBUGGING
36 /* Defines to compile execute statement(s) if in DEBUGGING mode.
37  * Erases otherwise. This should only be used when linking
38  * would otherwise require the symbol when DEBUGGING is false.
39 */
40 #define DEBUG_OR_ERASE(s) s
41 #else
42 /* Defines to erase s if not in DEBUGGING mode. */
43 #define DEBUG_OR_ERASE(s)
44 #endif
45
46 #endif  /* NATIVE_CLIENT_SRC_SHARED_UTILS_DEBUGGING_H__ */