40static_assert(
sizeof(BuildFingerprint) > 0);
43inline void set_field(
char* dst, std::size_t cap,
const char* src) {
44 std::snprintf(dst, cap,
"%s", src ? src :
"");
53#if defined(_MSVC_LANG)
64 __clang_major__, __clang_minor__, __clang_patchlevel__);
65#elif defined(__GNUC__)
67 __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
68#elif defined(_MSC_VER)
75#if defined(__aarch64__) || defined(_M_ARM64)
76 const char* arch =
"arm64";
77#elif defined(__x86_64__) || defined(_M_X64)
78 const char* arch =
"x86_64";
80 const char* arch =
"unknown-arch";
83 const char* os =
"macos";
84#elif defined(__linux__)
85 const char* os =
"linux";
87 const char* os =
"windows";
89 const char* os =
"unknown-os";
91 std::snprintf(fp.
target,
sizeof fp.
target,
"%s-%s", arch, os);
94#if defined(_LIBCPP_VERSION)
95 std::snprintf(fp.
stdlib,
sizeof fp.
stdlib,
"libc++ %d", _LIBCPP_VERSION);
96#elif defined(__GLIBCXX__)
97 std::snprintf(fp.
stdlib,
sizeof fp.
stdlib,
"libstdc++ %d", __GLIBCXX__);
98#elif defined(_MSVC_STL_VERSION)
99 std::snprintf(fp.
stdlib,
sizeof fp.
stdlib,
"msvcstl %d", _MSVC_STL_VERSION);
106 const int ndebug = 1;
108 const int ndebug = 0;
110#if defined(__EXCEPTIONS) || defined(_CPPUNWIND)
115#if defined(__GXX_RTTI) || defined(_CPPRTTI)
120#if defined(_GLIBCXX_USE_CXX11_ABI)
121 const int cxx11abi = _GLIBCXX_USE_CXX11_ABI;
123 const int cxx11abi = -1;
125#if defined(_ITERATOR_DEBUG_LEVEL)
126 const int itdbg = _ITERATOR_DEBUG_LEVEL;
127#elif defined(_LIBCPP_DEBUG)
128 const int itdbg = _LIBCPP_DEBUG;
132#if defined(_LIBCPP_HARDENING_MODE)
133 const int hardening = _LIBCPP_HARDENING_MODE;
134#elif defined(_GLIBCXX_ASSERTIONS)
135 const int hardening = 1;
137 const int hardening = 0;
139#if defined(_LIBCPP_ABI_VERSION)
140 const int libcppabi = _LIBCPP_ABI_VERSION;
142 const int libcppabi = -1;
145 "ndebug=%d;exc=%d;rtti=%d;cxx11abi=%d;itdbg=%d;harden=%d;libcppabi=%d",
146 ndebug, exc, rtti, cxx11abi, itdbg, hardening, libcppabi);
152 [[maybe_unused]]
auto append = [&](
const char* tag) {
153 if (n) n +=
static_cast<std::size_t
>(std::snprintf(buf + n,
sizeof buf - n,
","));
154 n +=
static_cast<std::size_t
>(std::snprintf(buf + n,
sizeof buf - n,
"%s", tag));
156#if defined(__SANITIZE_ADDRESS__)
158#elif defined(__has_feature)
159# if __has_feature(address_sanitizer)
163#if defined(__has_feature)
164# if __has_feature(thread_sanitizer)
167# if __has_feature(memory_sanitizer)
171#if defined(__SANITIZE_THREAD__)
174#if defined(UNDEFINED_BEHAVIOR_SANITIZER) || defined(__SANITIZE_UNDEFINED__)
180#if defined(PULP_SDK_VERSION)
192 return a.schema_version == b.schema_version &&
193 a.cpp_standard == b.cpp_standard &&
194 a.sample_precision == b.sample_precision &&
195 std::strncmp(a.compiler, b.compiler,
sizeof a.compiler) == 0 &&
196 std::strncmp(a.target, b.target,
sizeof a.target) == 0 &&
197 std::strncmp(a.stdlib, b.stdlib,
sizeof a.stdlib) == 0 &&
198 std::strncmp(a.abi_flags, b.abi_flags,
sizeof a.abi_flags) == 0 &&
199 std::strncmp(a.sanitizers, b.sanitizers,
sizeof a.sanitizers) == 0 &&
200 std::strncmp(a.sdk_version, b.sdk_version,
sizeof a.sdk_version) == 0;
206 std::vector<std::string> out;
207 auto cmp_str = [&](
const char* field,
const char* s,
const char* l) {
208 if (std::strncmp(s, l, 64) != 0)
209 out.push_back(std::string(field) +
": shell='" + s +
"' logic='" + l +
"'");
211 auto cmp_int = [&](
const char* field,
long s,
long l) {
213 out.push_back(std::string(field) +
": shell=" + std::to_string(s) +
214 " logic=" + std::to_string(l));