spy v3.0.0
Andrée Borrel
Loading...
Searching...
No Matches
Main API

Everything spy reports about the target, the toolchain and the flags it was given. More...

Detailed Description

Everything spy reports about the target, the toolchain and the flags it was given.

Every axis spy detects is a constexpr object living in namespace spy, so a question the preprocessor used to answer becomes a value any constexpr context can read. The six groups below sort those values by the question they answer.

A value is read in three ways, shown here on the compiler:

// compared to a named value
if constexpr(spy::compiler == spy::gcc_) { }
// or the named value itself, which converts to bool
if constexpr(spy::gcc_) { }
// and any of them prints
std::cout << spy::compiler;
constexpr compiler_type compiler
Compiler reporting value.
Definition compiler.hpp:182

Versions are named by a user-defined literal per vendor, gathered in spy::literal, and the ordering operators compare against them:

using namespace spy::literal;
if constexpr(spy::compiler >= 15'0_clang) { } // clang 15 or later

Two different vendors compare as std::partial_ordering::unordered rather than as false, so spy::gcc_ < spy::clang_ has no answer instead of a wrong one.

Capabilities that are not an axis of their own live in spy::supports, each a plain constexpr inline bool.

Topics

 Target Platforms
 The system, the processor and the data model the code is compiled for.
 Compilers
 The compiler processing the code, and the literals naming its versions.
 Language Standards
 The C++ standard in force, and the C and C++ standard library implementations.
 Instruction Sets
 The SIMD extensions the flags turn on, and what they can compute.
 Accelerators
 The accelerator programming models the code is compiled with.
 Sanitizers
 The sanitizers the code is compiled with.