Flow123d
release_3.0.0-1070-g00ac913
|
Global macros to enhance readability and debugging, general constants. More...
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include "system/exc_common.hh"
#include "config.h"
#include "mpi.h"
#include "logger.hh"
#include "asserts.hh"
Go to the source code of this file.
Macros | |
#define | INPUT_CHECK(i, ...) do { if (!(i)) xprintf(UsrErr,__VA_ARGS__); } while (0) |
Debugging macros. More... | |
#define | OLD_ASSERT(...) |
#define | OLD_WARN_ASSERT(...) |
#define | OLD_ASSERT_EQUAL(a, b) |
#define | OLD_ASSERT_LESS(a, b) |
#define | OLD_ASSERT_LE(a, b) |
#define | OLD_ASSERT_PTR(ptr) |
#define | DBGCOUT(...) |
#define | DBGVAR(var) |
#define | FLOW123D_FORCE_LINK_IN_CHILD(x) int force_link_##x = 0; |
#define | _TOKENPASTE(x, y) func_ ## x ## y |
#define | _TOKENPASTE2(x, y) _TOKENPASTE(x, y) |
#define | FLOW123D_FORCE_LINK_IN_PARENT(x) extern int force_link_##x; void _TOKENPASTE2(x, __LINE__)(void) { force_link_##x = 1; } |
Global macros to enhance readability and debugging, general constants.
* Copyright (C) 2015 Technical University of Liberec. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Definition in file global_defs.h.
#define _TOKENPASTE | ( | x, | |
y | |||
) | func_ ## x ## y |
Definition at line 181 of file global_defs.h.
#define _TOKENPASTE2 | ( | x, | |
y | |||
) | _TOKENPASTE(x, y) |
Definition at line 182 of file global_defs.h.
#define DBGCOUT | ( | ... | ) |
Definition at line 164 of file global_defs.h.
#define DBGVAR | ( | var | ) |
Definition at line 165 of file global_defs.h.
#define FLOW123D_FORCE_LINK_IN_CHILD | ( | x | ) | int force_link_##x = 0; |
These macros are necessary in classes that contain Input::Type::Abstract (PARENT macro) and in classes contain descendant of this Abstract (CHILD macro) if these descendants are initialized through methods of Input::Factory
class.
These macros are necessary for initializing of static variables in classes that contain descendants of parent Abstract.
Definition at line 180 of file global_defs.h.
#define FLOW123D_FORCE_LINK_IN_PARENT | ( | x | ) | extern int force_link_##x; void _TOKENPASTE2(x, __LINE__)(void) { force_link_##x = 1; } |
Definition at line 183 of file global_defs.h.
Debugging macros.
The macro OLD_ASSERT has to be used for assertion tests. An error occures if given condition is violated. Macro accepts additional variables to print.
Example:
* OLD_ASSERT( i<size , "Array X overflow: index %d >= alocated size %d.\n",i,size); *
The macro INPUT_CHECK should be used for assertions about user input. So they produce User Error instead of Program error.
The macro DBGCOUT should be used for debugging messages, so they can be removed in production version.
OLD_WARN_ASSERT - can be used for consistency tests in debugging version.
Definition at line 51 of file global_defs.h.
#define OLD_ASSERT | ( | ... | ) |
Actually there are following debugging switches FLOW123D_DEBUG_MESSAGES - use various debugging messages introduced by DBGCOUT FLOW123D_DEBUG_ASSERTS - use assertion checks introduced by ASSERT FLOW123D_DEBUG_PROFILER - use profiling introduced by START_TIMER, END_TIMER
You can turn all off defining: FLOW123D_NODEBUG or turn all on defining: FLOW123D_DEBUG
FLOW123D_DEBUG overrides FLOW123D_NODEBUG
Definition at line 131 of file global_defs.h.
#define OLD_ASSERT_EQUAL | ( | a, | |
b | |||
) |
Definition at line 133 of file global_defs.h.
#define OLD_ASSERT_LE | ( | a, | |
b | |||
) |
Definition at line 135 of file global_defs.h.
#define OLD_ASSERT_LESS | ( | a, | |
b | |||
) |
Definition at line 134 of file global_defs.h.
#define OLD_ASSERT_PTR | ( | ptr | ) |
Definition at line 136 of file global_defs.h.
#define OLD_WARN_ASSERT | ( | ... | ) |
Definition at line 132 of file global_defs.h.