InnoDB Plugin  1.0
ut0dbg.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3 Copyright (c) 1994, 2009, Oracle and/or its affiliates. All Rights Reserved.
4 
5 This program is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License as published by the Free Software
7 Foundation; version 2 of the License.
8 
9 This program is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 
13 You should have received a copy of the GNU General Public License along with
14 this program; if not, write to the Free Software Foundation, Inc.,
15 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
16 
17 *****************************************************************************/
18 
19 /*****************************************************************/
26 #ifndef ut0dbg_h
27 #define ut0dbg_h
28 
29 #ifdef UNIV_INNOCHECKSUM
30 #define ut_a assert
31 #define ut_ad assert
32 #define ut_error assert(0)
33 #else /* !UNIV_INNOCHECKSUM */
34 
35 #include "univ.i"
36 #include <stdlib.h>
37 #include "os0thread.h"
38 
39 #if defined(__GNUC__) && (__GNUC__ > 2)
40 
43 # define UT_DBG_FAIL(EXPR) UNIV_UNLIKELY(!((ulint)(EXPR)))
44 #else
45 
46 extern ulint ut_dbg_zero;
50 # define UT_DBG_FAIL(EXPR) !((ulint)(EXPR) + ut_dbg_zero)
51 #endif
52 
53 /*************************************************************/
55 UNIV_INTERN
56 void
58 /*====================*/
59  const char* expr,
60  const char* file,
61  ulint line)
62  UNIV_COLD __attribute__((nonnull(2)));
63 
65 # define UT_DBG_PANIC abort()
66 
69 #define ut_a(EXPR) do { \
70  if (UT_DBG_FAIL(EXPR)) { \
71  ut_dbg_assertion_failed(#EXPR, \
72  __FILE__, (ulint) __LINE__); \
73  UT_DBG_PANIC; \
74  } \
75 } while (0)
76 
78 #define ut_error do { \
79  ut_dbg_assertion_failed(0, __FILE__, (ulint) __LINE__); \
80  UT_DBG_PANIC; \
81 } while (0)
82 
83 #ifdef UNIV_DEBUG
84 
85 #define ut_ad(EXPR) ut_a(EXPR)
86 
87 #define ut_d(EXPR) do {EXPR;} while (0)
88 #else
89 
90 #define ut_ad(EXPR)
91 
92 #define ut_d(EXPR)
93 #endif
94 
97 #define UT_NOT_USED(A) A = A
98 
99 #ifdef UNIV_COMPILE_TEST_FUNCS
100 
101 #include <sys/types.h>
102 #include <sys/time.h>
103 #include <sys/resource.h>
104 
106 struct speedo_t {
107  struct rusage ru;
108  struct timeval tv;
109 };
110 
111 /*******************************************************************/
113 UNIV_INTERN
114 void
115 speedo_reset(
116 /*=========*/
117  speedo_t* speedo);
119 /*******************************************************************/
122 UNIV_INTERN
123 void
124 speedo_show(
125 /*========*/
126  const speedo_t* speedo);
128 #endif /* UNIV_COMPILE_TEST_FUNCS */
129 
130 #endif /* !UNIV_INNOCHECKSUM */
131 
132 #endif