| 1 | /***************************************************************************** |
| 2 | |
| 3 | Copyright (c) 2016, 2026, Oracle and/or its affiliates. |
| 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, version 2.0, as published by the |
| 7 | Free Software Foundation. |
| 8 | |
| 9 | This program is designed to work with certain software (including |
| 10 | but not limited to OpenSSL) that is licensed under separate terms, |
| 11 | as designated in a particular file or component or in included license |
| 12 | documentation. The authors of MySQL hereby grant you an additional |
| 13 | permission to link the program and your derivative works with the |
| 14 | separately licensed software that they have either included with |
| 15 | the program or referenced in the documentation. |
| 16 | |
| 17 | This program is distributed in the hope that it will be useful, but WITHOUT |
| 18 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 19 | FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0, |
| 20 | for more details. |
| 21 | |
| 22 | You should have received a copy of the GNU General Public License along with |
| 23 | this program; if not, write to the Free Software Foundation, Inc., |
| 24 | 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 25 | |
| 26 | *****************************************************************************/ |
| 27 | #ifndef _ut0dbg_h_ |
| 28 | #define _ut0dbg_h_ |
| 29 | |
| 30 | #include "lot0types.h" |
| 31 | |
| 32 | [[noreturn]] void ut_dbg_assertion_failed(const char *expr, const char *file, |
| 33 | uint64_t line); |
| 34 | |
| 35 | #define ut_a(EXPR) \ |
| 36 | do { \ |
| 37 | if (!(bool)(EXPR)) { \ |
| 38 | ut_dbg_assertion_failed(#EXPR, __FILE__, __LINE__); \ |
| 39 | } \ |
| 40 | } while (0) |
| 41 | |
| 42 | /** Abort execution. */ |
| 43 | #define ut_error ut_dbg_assertion_failed(0, __FILE__, __LINE__) |
| 44 | |
| 45 | /** Debug assertion. Does nothing unless UNIV_DEBUG is defined. */ |
| 46 | #define ut_ad(EXPR) ut_a(EXPR) |
| 47 | /** Debug statement. Does nothing unless UNIV_DEBUG is defined. */ |
| 48 | #define ut_d(EXPR) EXPR |
| 49 | |
| 50 | #endif // _ut0dbg_h_ |