muu/preprocessor.h file

Compiler feature detection, attributes, string-makers, etc.

Defines

#define MUU_ABSTRACT_INTERFACE
Marks a class being interface-only and not requiring a vtable.
#define MUU_ALWAYS_INLINE
The same linkage semantics as the inline keyword, with an additional hint to the optimizer that you'd really, really like a function inlined.
#define MUU_ARCH_AMD64
1 when targeting AMD64, otherwise 0.
#define MUU_ARCH_ARM
1 when targeting any flavour of ARM, otherwise 0.
#define MUU_ARCH_ARM32
1 when targeting 32-bit ARM, otherwise 0.
#define MUU_ARCH_ARM64
1 when targeting 64-bit ARM, otherwise 0.
#define MUU_ARCH_BITNESS
The 'bitness' of the target architecture (e.g. 64 on AMD64).
#define MUU_ARCH_ITANIUM
1 when targeting 64-bit Itanium, otherwise 0.
#define MUU_ARCH_X64
1 when targeting any 64-bit architecture, otherwise 0.
#define MUU_ARCH_X86
1 when targeting 32-bit x86, otherwise 0.
#define MUU_ASSUME(expr)
Optimizer hint for signalling various assumptions about state at specific points in code.
#define MUU_ATTR(...)
Expands to __attribute__(( ... )) when compiling with a compiler that supports GNU-style attributes.
#define MUU_ATTR_CLANG(...)
Expands to __attribute__(( ... )) when compiling with Clang.
#define MUU_ATTR_CLANG_GE(ver, ...)
Expands to __attribute__(( ... )) when compiling with Clang and __clang_major__ >= ver.
#define MUU_ATTR_CLANG_LT(ver, ...)
Expands to __attribute__(( ... )) when compiling with Clang and __clang_major__ < ver.
#define MUU_ATTR_GCC(...)
Expands to __attribute__(( ... )) when compiling with GCC.
#define MUU_ATTR_GCC_GE(ver, ...)
Expands to __attribute__(( ... )) when compiling with GCC and __GNUC__ >= ver.
#define MUU_ATTR_GCC_LT(ver, ...)
Expands to __attribute__(( ... )) when compiling with GCC and __GNUC__ < ver.
#define MUU_ATTR_NDEBUG(...)
Expands to __attribute__(( ... )) when compiling with a compiler that supports GNU-style attributes and NDEBUG is defined.
#define MUU_BIG_ENDIAN
1 when the target environment is big-endian, otherwise 0.
#define MUU_CLANG
The value of __clang_major__ when the code is being compiled by LLVM/Clang, otherwise 0.
#define MUU_CONCAT(x, y)
Concatenates two preprocessor inputs. Equivalent to the ## operator, but with macro expansion.
#define MUU_CONSTEVAL
Expands to C++20's consteval if supported by your compiler, otherwise constexpr.
#define MUU_CPP
The currently-targeted C++ standard. 17 for C++17, 20 for C++20, etc.
#define MUU_CUDA
1 when compiled with nVIDIA's CUDA compiler, otherwise 0.
#define MUU_DECLSPEC(...)
Expands to __declspec( ... ) when compiling with MSVC (or another compiler in MSVC-mode).
#define MUU_DEFAULT_COPY(T)
Explicitly defaults the copy constructor and copy-assignment operator of a class or struct.
#define MUU_DEFAULT_MOVE(T)
Explicitly defaults the move constructor and move-assignment operator of a class or struct.
#define MUU_DELETE_COPY(T)
Explicitly deletes the copy constructor and copy-assignment operator of a class or struct.
#define MUU_DELETE_MOVE(T)
Explicitly deletes the move constructor and move-assignment operator of a class or struct.
#define MUU_DISABLE_ARITHMETIC_WARNINGS
Disables compiler warnings relating to integer and floating-point arithmetic.
#define MUU_DISABLE_CODE_ANALYSIS_WARNINGS
Disables interactive code analysis warnings (e.g. Visual Studio's background analysis engine).
#define MUU_DISABLE_DEPRECATION_WARNINGS
Disables compiler warnings relating to deprecated functions, types, etc.
#define MUU_DISABLE_LIFETIME_WARNINGS
Disables compiler warnings relating to object lifetime (initialization, destruction, magic statics, et cetera).
#define MUU_DISABLE_SHADOW_WARNINGS
Disables compiler warnings relating to variable, class and function name shadowing.
#define MUU_DISABLE_SPAM_WARNINGS
Disables compiler warnings that are generally spammy/superfluous (padding, double promotion, cast alignment, etc.)
#define MUU_DISABLE_SUGGESTION_WARNINGS
Disables compiler warnings resulting from -Wsuggest=... and friends.
#define MUU_DISABLE_SWITCH_WARNINGS
Disables compiler warnings relating to the use of switch statements.
#define MUU_DISABLE_WARNINGS
Pushes the current compiler warning state onto the stack then disables ALL compiler warnings.
#define MUU_DOXYGEN
1 when the code being interpreted by Doygen or some other documentation generator, otherwise 0.
#define MUU_EMPTY_BASES
Marks a class as having only empty base classes.
#define MUU_ENABLE_WARNINGS
Re-enables compiler warnings again after using MUU_DISABLE_WARNINGS.
#define MUU_GCC
The value of __GNUC__ when the code is being compiled by GCC specifically, otherwise 0.
#define MUU_GCC_LIKE
The value of __GNUC__ when it is defined by the compiler, otherwise 0.
#define MUU_HAS_ATTR(attr)
The result of __has_attribute(attr) if supported by the compiler, otherwise 0.
#define MUU_HAS_BUILTIN(name)
The result of __has_builtin(name) if supported by the compiler, otherwise 0.
#define MUU_HAS_CHAR8
1 when the compiler supports C++20's char8_t, otherwise 0.
#define MUU_HAS_CONSTEVAL
1 when the compiler supports C++20's consteval immediate functions, otherwise 0.
#define MUU_HAS_CPP_ATTR(attr)
The result of __has_cpp_attribute(attr) if supported by the compiler, otherwise 0.
#define MUU_HAS_EXCEPTIONS
1 when C++ exceptions are supported and enabled, otherwise 0.
#define MUU_HAS_FEATURE(name)
The result of __has_feature(name) if supported by the compiler, otherwise 0.
#define MUU_HAS_FLOAT128
1 when the target environment has 128-bit floats, otherwise 0.
#define MUU_HAS_FLOAT16
1 when the target environment has the 16-bit floating point type _Float16.
#define MUU_HAS_FP16
1 when the target environment has the storage-only 16-bit floating point type __fp16.
#define MUU_HAS_IF_CONSTEVAL
1 when the compiler supports C++23's if consteval { }, otherwise 0.
#define MUU_HAS_INCLUDE(header)
The result of __has_include(header) if supported by the compiler, otherwise 0.
#define MUU_HAS_INT128
1 when the target environment has 128-bit integers, otherwise 0.
#define MUU_HAS_RTTI
1 when C++ run-time type identification (RTTI) is supported and enabled, otherwise 0.
#define MUU_ICC
The value of __INTEL_COMPILER when the code is being compiled by ICC, otherwise 0.
#define MUU_INTELLISENSE
1 when the code being compiled by an IDE's 'intellisense' compiler, otherwise 0.
#define MUU_ISET_AVX
1 when the target supports the AVX instruction set, otherwise 0.
#define MUU_ISET_AVX2
1 when the target supports the AVX2 instruction set, otherwise 0.
#define MUU_ISET_AVX512
1 when the target supports any of the AVX512 instruction sets, otherwise 0.
#define MUU_ISET_MMX
1 when the target supports the MMX instruction set, otherwise 0.
#define MUU_ISET_SSE
1 when the target supports the SSE instruction set, otherwise 0.
#define MUU_ISET_SSE2
1 when the target supports the SSE2 instruction set, otherwise 0.
#define MUU_LIKELY(...)
Expands a conditional to include an optimizer intrinsic (or C++20's [
  • ], if available) indicating that an if/else conditional is the likely path.
  • #define MUU_LINUX
    1 when building for a Linux distro, otherwise 0.
    #define MUU_LITTLE_ENDIAN
    1 when the target environment is little-endian, otherwise 0.
    #define MUU_MAKE_FLAGS(T)
    Stamps out operators for enum 'flags' types.
    #define MUU_MAKE_RAW_STRING(s)
    Stringifies the input, converting it verbatim into a raw string literal.
    #define MUU_MAKE_STRING(s)
    Stringifies the input, converting it into a string literal.
    #define MUU_MAKE_STRING_VIEW(s)
    Stringifies the input, converting it verbatim into a raw string view literal.
    #define MUU_MALLOC
    Optimizer hint that marks an allocating function's pointer return value as representing a newly allocated memory region free from aliasing.
    #define MUU_MSVC
    The value of _MSC_VER when the code is being compiled by MSVC specifically, otherwise 0.
    #define MUU_MSVC_LIKE
    The value of _MSC_VER when it is defined by the compiler, otherwise 0.
    #define MUU_NEVER_INLINE
    A strong hint to the optimizer that you really, really do not want a function inlined.
    #define MUU_NODISCARD
    Expands to [[nodiscard]] or __attribute__((warn_unused_result)).
    #define MUU_NODISCARD_CTOR
    Expands to [[nodiscard]] if your compiler supports it on constructors.
    #define MUU_NOOP
    Expands to a no-op expression.
    #define MUU_NO_UNIQUE_ADDRESS
    Expands to C++20's [[no_unique_address]] if supported by your compiler.
    #define MUU_POP_WARNINGS
    Pops the current compiler warning state off the stack.
    #define MUU_PRAGMA_CLANG(...)
    Expands to _Pragma("clang ...") when compiling with Clang.
    #define MUU_PRAGMA_CLANG_GE(ver, ...)
    Expands to _Pragma("clang ...") when compiling with Clang and __clang_major__ >= ver.
    #define MUU_PRAGMA_CLANG_LT(ver, ...)
    Expands to _Pragma("clang ...") when compiling with Clang and __clang_major__ < ver.
    #define MUU_PRAGMA_GCC(...)
    Expands to _Pragma("GCC ...") when compiling with GCC.
    #define MUU_PRAGMA_GCC_GE(ver, ...)
    Expands to _Pragma("GCC ...") when compiling with GCC and __GNUC__ >= ver.
    #define MUU_PRAGMA_GCC_LT(ver, ...)
    Expands to _Pragma("GCC ...") when compiling with GCC and __GNUC__ < ver.
    #define MUU_PRAGMA_ICC(...)
    Expands to _pragma(...) when compiling with ICC.
    #define MUU_PRAGMA_MSVC(...)
    Expands to __pragma(...) when compiling with MSVC.
    #define MUU_PRAGMA_MSVC_GE(ver, ...)
    Expands to __pragma(...) when compiling with MSVC and _MSC_VER >= ver.
    #define MUU_PRAGMA_MSVC_LT(ver, ...)
    Expands to __pragma(...) when compiling with MSVC and _MSC_VER < ver.
    #define MUU_PUSH_WARNINGS
    Pushes the current compiler warning state onto the stack.
    #define MUU_TRIVIAL_ABI
    Marks a simple type which might otherwise be considered non-trivial as being trivial over ABI boundaries.
    #define MUU_UNIX
    1 when building for a GNU/Unix variant, otherwise 0.
    #define MUU_UNLIKELY(...)
    Expands a conditional to include an optimizer intrinsic (or C++20's [[unlikely]], if available) indicating that an if/else conditional is the unlikely path.
    #define MUU_UNREACHABLE
    Marks a position in the code as being unreachable.
    #define MUU_UNUSED(...)
    Explicitly denotes the result of an expression as being unused.
    #define MUU_VECTORCALL
    Expands to __vectorcall on compilers that support it.
    #define MUU_WINDOWS
    1 when building for the Windows operating system, otherwise 0.