@@ -1519,6 +1519,7 @@ inline capabilities_t cpu_capabilities() noexcept {
1519
1519
// Check for basic PAUSE instruction support (always available on x86-64)
1520
1520
caps = static_cast <capabilities_t >(caps | capability_x86_pause_k);
1521
1521
1522
+ #if defined(__GNUC__) || defined(__clang__) // We use inline assembly - unavailable in MSVC
1522
1523
// CPUID to check for WAITPKG support (TPAUSE instruction)
1523
1524
std::uint32_t eax, ebx, ecx, edx;
1524
1525
@@ -1528,6 +1529,7 @@ inline capabilities_t cpu_capabilities() noexcept {
1528
1529
1529
1530
// WAITPKG is bit 5 in ECX
1530
1531
if (ecx & (1u << 5 )) caps = static_cast <capabilities_t >(caps | capability_x86_tpause_k);
1532
+ #endif
1531
1533
1532
1534
#elif _FU_DETECT_ARCH_ARM64
1533
1535
@@ -1540,7 +1542,7 @@ inline capabilities_t cpu_capabilities() noexcept {
1540
1542
size_t size = sizeof (wfet_support);
1541
1543
if (sysctlbyname (" hw.optional.arm.FEAT_WFxT" , &wfet_support, &size, NULL , 0 ) == 0 && wfet_support)
1542
1544
caps = static_cast <capabilities_t >(caps | capability_arm64_wfet_k);
1543
- #else
1545
+ #elif defined(__GNUC__) || defined(__clang__) // We use inline assembly - unavailable in MSVC
1544
1546
// On non-Apple ARM systems, try to read the system register
1545
1547
// Note: This may fail on some systems where userspace access is restricted
1546
1548
std::uint64_t id_aa64isar2_el0 = 0 ;
@@ -3592,27 +3594,19 @@ struct logging_colors_t {
3592
3594
3593
3595
explicit logging_colors_t (bool use_colors) noexcept : use_colors_(use_colors) {}
3594
3596
3595
- #if FU_ENABLE_NUMA
3596
- explicit logging_colors_t (int file_descriptor = STDOUT_FILENO) noexcept {
3597
- if (!::isatty (file_descriptor)) return ;
3598
-
3599
- char const *term = std::getenv (" TERM" );
3600
- if (!term) return ;
3601
-
3602
- use_colors_ = std::strstr (term, " color" ) != nullptr || std::strstr (term, " xterm" ) != nullptr ||
3603
- std::strstr (term, " screen" ) != nullptr || std::strcmp (term, " linux" ) == 0 ;
3604
- }
3605
- #else
3606
3597
explicit logging_colors_t () noexcept {
3598
+ #if defined(_WIN32)
3599
+ if (!::isatty (_fileno (stdout))) return ;
3600
+ #endif
3601
+ #if defined(__unix__) || defined(__APPLE__)
3602
+ if (!::isatty (STDOUT_FILENO)) return ;
3603
+ #endif
3607
3604
char const *term = std::getenv (" TERM" );
3608
3605
if (!term) return ;
3609
-
3610
3606
use_colors_ = std::strstr (term, " color" ) != nullptr || std::strstr (term, " xterm" ) != nullptr ||
3611
3607
std::strstr (term, " screen" ) != nullptr || std::strcmp (term, " linux" ) == 0 ;
3612
3608
}
3613
3609
3614
- #endif
3615
-
3616
3610
/* ANSI style codes */
3617
3611
char const *reset () { return use_colors_ ? " \033 [0m" : " " ; }
3618
3612
char const *bold () { return use_colors_ ? " \033 [1m" : " " ; }
0 commit comments