31 #include <type_traits>
44 #ifdef TRLC_PLATFORM_ENABLE_DEBUG_UTILS
72 static constexpr
const char*
STRING =
"1.0.0";
79 return (
static_cast<uint32_t
>(
MAJOR) << 16) | (
static_cast<uint32_t
>(
MINOR) << 8) |
80 static_cast<uint32_t
>(
PATCH);
90 static constexpr
bool isAtLeast(
int major,
int minor = 0,
int patch = 0) noexcept {
92 uint32_t required = (
static_cast<uint32_t
>(major) << 16) |
93 (
static_cast<uint32_t
>(minor) << 8) |
static_cast<uint32_t
>(patch);
94 return current >= required;
146 std::stringstream ss;
149 ss << std::string(60,
'=') <<
"\n\n";
152 ss <<
"COMPILER INFORMATION:\n";
153 ss << std::string(25,
'-') <<
"\n";
164 ss <<
"PLATFORM INFORMATION:\n";
165 ss << std::string(25,
'-') <<
"\n";
168 ss <<
" Environment Type: ";
193 ss <<
"ARCHITECTURE INFORMATION:\n";
194 ss << std::string(29,
'-') <<
"\n";
197 ss <<
" Byte Order: ";
200 ss <<
"Little Endian";
206 ss <<
"Mixed Endian";
216 ss <<
" SIMD Support: " << (
hasSimdSupport() ?
"Yes" :
"No") <<
"\n\n";
219 ss <<
"C++ STANDARD INFORMATION:\n";
220 ss << std::string(29,
'-') <<
"\n";
224 ss <<
" If Constexpr: " << (
hasIfConstexpr() ?
"Yes" :
"No") <<
"\n";
225 ss <<
" Concepts: " << (
hasConcepts() ?
"Yes" :
"No") <<
"\n";
226 ss <<
" Coroutines: " << (
hasCoroutines() ?
"Yes" :
"No") <<
"\n";
227 ss <<
" Modules: " << (
hasModules() ?
"Yes" :
"No") <<
"\n";
228 ss <<
" Ranges: " << (
hasRanges() ?
"Yes" :
"No") <<
"\n\n";
231 ss <<
"FEATURE AVAILABILITY:\n";
232 ss << std::string(25,
'-') <<
"\n";
243 ss <<
"ENDIANNESS INFORMATION:\n";
244 ss << std::string(27,
'-') <<
"\n";
245 ss <<
" Byte Order: ";
248 ss <<
"Little Endian";
254 ss <<
"Mixed Endian";
262 ss <<
" Big Endian: "
269 #ifdef TRLC_PLATFORM_ENABLE_DEBUG_UTILS
270 ss <<
"DEBUG INFORMATION:\n";
271 ss << std::string(22,
'-') <<
"\n";
272 ss <<
" Debug Build: " << (
isDebugBuild() ?
"Yes" :
"No") <<
"\n";
273 ss <<
" Release Build: " << (
isReleaseBuild() ?
"Yes" :
"No") <<
"\n";
274 ss <<
" Debug Info: " << (
hasDebugInfo() ?
"Yes" :
"No") <<
"\n";
279 ss << std::string(60,
'=') <<
"\n";
280 ss <<
"Report generated by TRLC Platform v" <<
Version::STRING <<
"\n";
304 std::stringstream ss;
390 bool expected =
false;
392 expected,
true, std::memory_order_acq_rel)) {
396 std::this_thread::yield();
468 return report.getBriefSummary();
484 report.printReport();
495 #define TRLC_PLATFORM_INCLUDED
498 #define TRLC_PLATFORM_VERSION_MAJOR (trlc::platform::Version::MAJOR)
499 #define TRLC_PLATFORM_VERSION_MINOR (trlc::platform::Version::MINOR)
500 #define TRLC_PLATFORM_VERSION_PATCH (trlc::platform::Version::PATCH)
501 #define TRLC_PLATFORM_VERSION_STRING (trlc::platform::Version::STRING)
504 #define TRLC_PLATFORM_VERSION_ATLEAST(major, minor, patch) \
505 (trlc::platform::Version::isAtLeast(major, minor, patch))
512 static_assert(std::is_default_constructible_v<trlc::platform::CompilerInfo>,
513 "CompilerInfo must be default constructible");
514 static_assert(std::is_default_constructible_v<trlc::platform::PlatformInfo>,
515 "PlatformInfo must be default constructible");
516 static_assert(std::is_default_constructible_v<trlc::platform::ArchitectureInfo>,
517 "ArchitectureInfo must be default constructible");
518 static_assert(std::is_default_constructible_v<trlc::platform::CppStandardInfo>,
519 "CppStandardInfo must be default constructible");
520 static_assert(std::is_default_constructible_v<trlc::platform::FeatureSet>,
521 "FeatureSet must be default constructible");
526 "Version comparison must work correctly");
529 static_assert(std::is_default_constructible_v<trlc::platform::PlatformReport>,
530 "PlatformReport must be constructible");
CPU architecture and byte order detection for trlc-platform.
Compiler detection and capability utilities.
C++ standard version and feature detection for trlc-platform.
Portable debug and assertion utilities.
Byte order detection and utilities for cross-platform development.
Language and runtime feature detection utilities.
Portable cross-platform macros for common C++ idioms and optimizations.
Compile-time type and alignment information utilities.