guanaqo 1.0.0-alpha.27
Utilities for scientific software
Loading...
Searching...
No Matches
Macros & Build Helpers

Detailed Description

Public-facing preprocessor utilities.

Collaboration diagram for Macros & Build Helpers:

Files

file  assume.hpp
 Assertion and assumption macros with debug/release semantics.
file  compiler.h
 Compiler feature detection helpers.
file  openmp.h
 OpenMP helpers.
file  preprocessor.h
 Token concatenation and argument-counting helpers.
file  stringify.h
 Stringify and token concatenation helpers.

Macros

#define GUANAQO_ASSUME(x)
 Invokes undefined behavior if the expression x does not evaluate to true.
#define GUANAQO_DEBUG_ASSERT(x)
 Check the expression x (in debug mode only).
#define GUANAQO_ASSERT(x)
 Check the expression x (regardless of debug or release mode).
#define GUANAQO_OMP(X)
 Emit the OpenMP pragma X if OpenMP is enabled.
#define GUANAQO_OMP_IF_ELSE(X, Y)
 Emit X if OpenMP is enabled, otherwise emit Y.
#define GUANAQO_OMP_IF(X)
 Emit X if OpenMP is enabled, otherwise emit nothing.
#define GUANAQO_CONCATENATE_TOKENS(a, b)
 Concatenate the given tokens.
#define GUANAQO_JOIN_TOKENS(...)
 Join the given tokens with underscores.
#define GUANAQO_JOIN_STRINGS(sep, ...)
 Join the given strings with the given separator.
#define GUANAQO_NOOP()
 A no-op statement (swallows a semicolon without causing warnings about empty statements).
#define GUANAQO_CAT(a, b)
 Concatenate the given tokens.
#define GUANAQO_STRINGIFY(s)
 Convert the given token to a string literal.

Macro Definition Documentation

◆ GUANAQO_ASSUME

#define GUANAQO_ASSUME ( x)

#include <guanaqo/assume.hpp>

Value:
#define GUANAQO_ASSERT(x)
Check the expression x (regardless of debug or release mode).
Definition assume.hpp:61

Invokes undefined behavior if the expression x does not evaluate to true.

Exceptions
std::logic_errorin debug mode if x is false.

Definition at line 69 of file assume.hpp.

◆ GUANAQO_DEBUG_ASSERT

#define GUANAQO_DEBUG_ASSERT ( x)

#include <guanaqo/assume.hpp>

Value:
do { \
if (!(x)) \
throw std::logic_error("Assertion " #x " failed (" __FILE__ \
":" GUANAQO_STRINGIFY(__LINE__) ")"); \
} while (false)
#define GUANAQO_STRINGIFY(s)
Convert the given token to a string literal.
Definition stringify.h:13

Check the expression x (in debug mode only).

Exceptions
std::logic_errorin debug mode if x is false.

Definition at line 53 of file assume.hpp.

◆ GUANAQO_ASSERT

#define GUANAQO_ASSERT ( x)

#include <guanaqo/assume.hpp>

Value:
do { \
if (!(x)) \
throw std::logic_error("Assertion " #x " failed (" __FILE__ \
":" GUANAQO_STRINGIFY(__LINE__) ")"); \
} while (false)

Check the expression x (regardless of debug or release mode).

Exceptions
std::logic_errorif x is false.

Definition at line 61 of file assume.hpp.

◆ GUANAQO_OMP

#define GUANAQO_OMP ( X)

#include <guanaqo/openmp.h>

Emit the OpenMP pragma X if OpenMP is enabled.

Definition at line 28 of file openmp.h.

◆ GUANAQO_OMP_IF_ELSE

#define GUANAQO_OMP_IF_ELSE ( X,
Y )

#include <guanaqo/openmp.h>

Value:
Y

Emit X if OpenMP is enabled, otherwise emit Y.

Definition at line 29 of file openmp.h.

◆ GUANAQO_OMP_IF

#define GUANAQO_OMP_IF ( X)

#include <guanaqo/openmp.h>

Value:
#define GUANAQO_NOOP()
A no-op statement (swallows a semicolon without causing warnings about empty statements).

Emit X if OpenMP is enabled, otherwise emit nothing.

Definition at line 30 of file openmp.h.

◆ GUANAQO_CONCATENATE_TOKENS

#define GUANAQO_CONCATENATE_TOKENS ( a,
b )

#include <guanaqo/preprocessor.h>

Value:
#define GUANAQO_CONCATENATE_TOKENS_IMPL(a, b)
Definition preprocessor.h:8

Concatenate the given tokens.

Definition at line 11 of file preprocessor.h.

◆ GUANAQO_JOIN_TOKENS

#define GUANAQO_JOIN_TOKENS ( ...)

#include <guanaqo/preprocessor.h>

Value:
#define GUANAQO_JOIN_TOKENS_ARGS_CHOOSER(N)
#define GUANAQO_NUM_ARGS(...)

Join the given tokens with underscores.

Definition at line 23 of file preprocessor.h.

◆ GUANAQO_JOIN_STRINGS

#define GUANAQO_JOIN_STRINGS ( sep,
... )

#include <guanaqo/preprocessor.h>

Value:
sep, __VA_ARGS__)
#define GUANAQO_JOIN_STRINGS_ARGS_CHOOSER(N)

Join the given strings with the given separator.

Definition at line 45 of file preprocessor.h.

◆ GUANAQO_NOOP

#define GUANAQO_NOOP ( )

#include <guanaqo/preprocessor.h>

Value:
do { \
} while (false)

A no-op statement (swallows a semicolon without causing warnings about empty statements).

Definition at line 66 of file preprocessor.h.

◆ GUANAQO_CAT

#define GUANAQO_CAT ( a,
b )

#include <guanaqo/stringify.h>

Value:
#define GUANAQO_CAT_IMPL(a, b)
Definition stringify.h:10

Concatenate the given tokens.

Definition at line 9 of file stringify.h.

◆ GUANAQO_STRINGIFY

#define GUANAQO_STRINGIFY ( s)

#include <guanaqo/stringify.h>

Value:
#define GUANAQO_STRINGIFY_IMPL(s)
Definition stringify.h:14

Convert the given token to a string literal.

Definition at line 13 of file stringify.h.