Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LEFEBVREJP email
radix
Commits
ea3e95eb
Commit
ea3e95eb
authored
Jun 03, 2016
by
LEFEBVREJP email
Browse files
Adding radixbug with dbc and debug output.
parent
60c18f51
Pipeline
#5144
skipped
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
cmake/Dependencies.cmake
View file @
ea3e95eb
TRIBITS_PACKAGE_DEFINE_DEPENDENCIES
(
SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS
io radixio PS REQUIRED
plot radixplot PS OPTIONAL
bug radixbug SS OPTIONAL
io radixio SS OPTIONAL
plot radixplot SS OPTIONAL
)
radixbug/CMakeLists.txt
0 → 100644
View file @
ea3e95eb
TRIBITS_SUBPACKAGE
(
bug
)
SET
(
HEADERS
bug.hh
)
INSTALL
(
FILES
${
HEADERS
}
DESTINATION
"include/radixbug/"
)
TRIBITS_SUBPACKAGE_POSTPROCESS
()
radixbug/bug.hh
0 → 100644
View file @
ea3e95eb
#ifndef RADIX_RADIXBUG_BUG_HH_
#define RADIX_RADIXBUG_BUG_HH_
#ifndef DEBUG_OUTPUT
#define DEBUG_OUTPUT 0
#define DEBUG_CALL(c)
#else
#define DEBUG_CALL(c) c
#endif
// default to c++ compiler
/*
* @file: bug.hh
* @author: Jordan P. Lefebvre, lefebvrejp@ornl.gov
* @brief Debug functionality for including debug output \
* in your source without a performance penalty.
* This is an include ONLY package. There is no library to link against
* Each function is preprocessed to be included or not.
* If DEBUG_OUTPUT is defined the MACROs are included.
*
* Available MACROs:
* radix(arg) - std::cerr << arg - Pushes content to stderr
* radix_line(arg) - std::cerr << arg << std::endl - Push newline terminated content to stderr
* radix(arg) - std::cerr << arg - Pushes content to stderr
* radix_warning(arg) - std::cerr << arg << std::endl - Push newline terminated content to stderr
* radix_tagged_line(arg) - Same as radixLine, prefixed with FILE and LINE
* radix_tagged(arg) - Same as radix, prefixed with FILE and LINE
* radix_tagged_warning(arg) - Same as radixWarning, prefixed with FILE and Line
* radix_block(block) - block - Simply places code block in preprocessor
*/
#include
<iostream>
#include
<cstdio>
#if DEBUG_OUTPUT & 1
#define radix_line(arg) std::cerr << arg << std::endl
#define radix_flush_line(arg) std::cerr << arg << std::endl;fflush(stderr)
#define radix(arg) std::cerr << arg
#define radix_warning(arg) std::cerr << arg << std::endl
#define radix_tagged_warning(arg) std::cerr << __FILE__ << ":" << __LINE__ << ": " << arg << std::endl
#define radix_flush_warning(arg) std::cerr << arg << std::endl;fflush(stderr)
#define radix_tagged_line(arg) std::cerr << __FILE__ << ":" << __LINE__ << ": " << arg << std::endl
#define radix_flush_tagged_line(arg) std::cerr << __FILE__ << ":" << __LINE__ << ": " << arg << std::endl;fflush(stderr)
#define radix_tagged(arg) std::cerr << __FILE__ << ":" << __LINE__ << ": " << arg
#define radix_flush_tagged_warning(arg) std::cerr << __FILE__ << ":" << __LINE__ << ": " << arg << std::endl;fflush(stderr)
#define radix_tagged_block(block) std::cerr << __FILE__ << ":" << __LINE__ << ":" << std::endl; block
#define radix_block(block) block
#else
#define radix(arg)
#define radix_line(arg)
#define radix_flush_line(arg)
#define radix_warning(arg)
#define radix_flush_warning(arg)
#define radix_tagged_line(arg)
#define radix_flush_tagged_line(arg)
#define radix_tagged(arg)
#define radix_tagged_warning(arg)
#define radix_flush_tagged_warning(arg)
#define radix_tagged_block(block)
#define radix_block(block)
#endif
/* DEBUG_OUTPUT */
#include
<stdexcept>
#include
<sstream>
#ifndef RADIX_DBC
#define RADIX_DBC 0
#endif
//
// Defined all levels of RADIX_DBC
// RADIX_DBC = 1 enables Require
// RADIX_DBC = 2 enables Check
// RADIX_DBC = 4 enables Remember & Ensure
// RADIX_DBC = 7 enables all
// Insist is always enabled
#if RADIX_DBC & 1
#define radix_require(c) if(!(c)) {\
std::ostringstream stream; \
stream << __FILE__ << ":" \
<< __LINE__ << " radix_require("<< #c << ") failed." << std::endl; \
throw std::runtime_error(stream.str()); }
#else
#define radix_require(c)
#endif
#if RADIX_DBC & 2
#define radix_check(c) if(!(c)) {\
std::ostringstream stream; \
stream << __FILE__ << ":" \
<< __LINE__ << " radix_check("<< #c << ") failed." << std::endl; \
throw std::runtime_error(stream.str()); }
#else
#define radix_check(c)
#endif
#if RADIX_DBC & 4
#define radix_ensure(c) if(!(c)) {\
std::ostringstream stream; \
stream << __FILE__ << ":" \
<< __LINE__ << " radix_ensure("<< #c << ") failed." << std::endl; \
throw std::runtime_error(stream.str()); }
#define radix_remember(c) c
#else
#define radix_ensure(c)
#define radix_remember(c)
#endif
#define radix_insist(c, msg) if(!(c)) { \
std::ostringstream stream; \
stream << __FILE__ << ":" \
<< __LINE__ << "radix_insist("<< #c \
<< ") failed with this message:" \
<< std::endl << msg << std::endl; \
throw std::runtime_error(stream.str()); }
#endif
/* RADIX_RADIXBUG_BUG_HH_*/
radixbug/cmake/Dependencies.cmake
0 → 100644
View file @
ea3e95eb
TRIBITS_PACKAGE_DEFINE_DEPENDENCIES
(
LIB_REQUIRED_PACKAGES
LIB_OPTIONAL_PACKAGES
TEST_REQUIRED_PACKAGES
TEST_OPTIONAL_PACKAGES
LIB_REQUIRED_TPLS
LIB_OPTIONAL_TPLS
TEST_REQUIRED_TPLS
TEST_OPTIONAL_TPLS
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment