SyTen
macros.h File Reference

Simple macros. More...

#include <tuple>
#include <cstdlib>
#include "inc/util/warning_msgs.h"
+ Include dependency graph for macros.h:
+ This graph shows which files directly or indirectly include this file:

Macros

#define if_constexpr   if constexpr
 Helper macro to fix indenting problems with editors which don't know the constexpr keyword... More...
 
#define SYTEN_ASSERT(x)   if (!(x)) { issue_error(#x, __FILE__, SYTEN_STRINGIFY(__LINE__)); }
 Throws a std::runtime_error if the first argument evaluates to false. More...
 
#define SYTEN_ASSERT_DEBUG(x)
 Behaves like SYTEN_ASSERT for debug builds and expands to nothing otherwise. More...
 
#define SYTEN_ASSERT_MSG(x, ...)   if (!(x)) { issue_error(#x, __FILE__, SYTEN_STRINGIFY(__LINE__), __VA_ARGS__); }
 Throws a std::runtime_error if the first argument evaluates to false and prints all other arguments using logGE(). More...
 
#define SYTEN_ASSERT_MSG_DEBUG(x, ...)
 Behaves like SYTEN_ASSERT_MSG for debug builds and expands to nothing otherwise. More...
 
#define SYTEN_EXIT(code, ...)   { issue_warning("[forced exit]", __FILE__, SYTEN_STRINGIFY(__LINE__), __VA_ARGS__); std::exit(code); }
 Prints the supplied message, generates a backtrace and exits using the first argument as error code. More...
 
#define SYTEN_INFO_DEBUG_BUILD   "no"
 "yes" if this is a debug build, "no" if it isn't More...
 
#define SYTEN_INFO_OPENMP   "no"
 three comma-separated elements if OpenMP is enabled, "no" otherwise More...
 
#define SYTEN_INFO_OPENMP_ENABLED   "no"
 "yes" if OpenMP is enabled, "no" otherwise More...
 
#define SYTEN_INFO_STENSOR   "STensor enabled up to rank " SYTEN_STRINGIFY(SYTEN_STENSOR_MAX_RANK) "."
 Describes the STensor configuration. More...
 
#define SYTEN_LAMBDA(x)   [&]() { return x; }
 Constructs an all-capturing lambda which returns the argument on call. More...
 
#define SYTEN_SINGLE_ARG(...)   __VA_ARGS__
 Singlifies arguments, useful if they contain commas. More...
 
#define SYTEN_STRINGIFY(...)   SYTEN_QUOTE(__VA_ARGS__)
 Stringifies the argument with macro expansion. More...
 
#define SYTEN_WARN(x)   if (!(x)) { issue_warning(#x, __FILE__, SYTEN_STRINGIFY(__LINE__)); }
 Prints a warning if the first argument evaluates to false. More...
 
#define SYTEN_WARN_DEBUG(x)
 Behaves like SYTEN_WARN for debug builds and expands to nothing otherwise. More...
 
#define SYTEN_WARN_MSG(x, ...)   if (!(x)) { issue_warning(#x, __FILE__, SYTEN_STRINGIFY(__LINE__), __VA_ARGS__); }
 Prints a warning if the first argument evaluates to false and prints all other arguments using logGW(). More...
 
#define SYTEN_WARN_MSG_DEBUG(x, ...)
 Behaves like SYTEN_WARN_MSG for debug builds and expands to nothing otherwise. More...
 

Detailed Description

Simple macros.