mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-09 06:30:10 +01:00
Global: replaces __attribute__ to C23 [[attribute]]
This commit is contained in:
@@ -510,14 +510,14 @@ void ffCPUDetectByCpuid(FFCPUResult* cpu) {
|
||||
}
|
||||
}
|
||||
#else
|
||||
void ffCPUDetectByCpuid(FF_A_UNUSED FFCPUResult* cpu) {
|
||||
void ffCPUDetectByCpuid([[maybe_unused]] FFCPUResult* cpu) {
|
||||
// Unsupported system
|
||||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
void ffCPUDetectByCpuid(FF_A_UNUSED FFCPUResult* cpu) {
|
||||
void ffCPUDetectByCpuid([[maybe_unused]] FFCPUResult* cpu) {
|
||||
// Unsupported architecture
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <OS.h>
|
||||
#include <private/shared/cpu_type.h>
|
||||
|
||||
const char* ffDetectCPUImpl(FF_A_UNUSED const FFCPUOptions* options, FFCPUResult* cpu) {
|
||||
const char* ffDetectCPUImpl([[maybe_unused]] const FFCPUOptions* options, FFCPUResult* cpu) {
|
||||
system_info sysInfo;
|
||||
if (get_system_info(&sysInfo) != B_OK) {
|
||||
return "get_system_info() failed";
|
||||
|
||||
@@ -546,11 +546,11 @@ static void detectArmName(FFstrbuf* cpuinfo, FFCPUResult* cpu, uint32_t implId)
|
||||
static const char* parseCpuInfo(
|
||||
FFstrbuf* cpuinfo,
|
||||
FFCPUResult* cpu,
|
||||
FF_A_UNUSED FFstrbuf* physicalCoresBuffer,
|
||||
FF_A_UNUSED FFstrbuf* cpuMHz,
|
||||
FF_A_UNUSED FFstrbuf* cpuIsa,
|
||||
FF_A_UNUSED FFstrbuf* cpuUarch,
|
||||
FF_A_UNUSED FFstrbuf* cpuImplementer) {
|
||||
[[maybe_unused]] FFstrbuf* physicalCoresBuffer,
|
||||
[[maybe_unused]] FFstrbuf* cpuMHz,
|
||||
[[maybe_unused]] FFstrbuf* cpuIsa,
|
||||
[[maybe_unused]] FFstrbuf* cpuUarch,
|
||||
[[maybe_unused]] FFstrbuf* cpuImplementer) {
|
||||
char* line = nullptr;
|
||||
size_t len = 0;
|
||||
|
||||
@@ -681,7 +681,7 @@ static bool detectFrequency(FFCPUResult* cpu, const FFCPUOptions* options) {
|
||||
|
||||
#if __i386__ || __x86_64__
|
||||
|
||||
FF_A_UNUSED static uint16_t getPackageCount(FFstrbuf* cpuinfo) {
|
||||
[[maybe_unused]] static uint16_t getPackageCount(FFstrbuf* cpuinfo) {
|
||||
const char* p = cpuinfo->chars;
|
||||
uint64_t low = 0, high = 0;
|
||||
|
||||
@@ -700,7 +700,7 @@ FF_A_UNUSED static uint16_t getPackageCount(FFstrbuf* cpuinfo) {
|
||||
return (uint16_t) (__builtin_popcountll(low) + __builtin_popcountll(high));
|
||||
}
|
||||
|
||||
FF_A_UNUSED static const char* detectCPUX86(const FFCPUOptions* options, FFCPUResult* cpu) {
|
||||
[[maybe_unused]] static const char* detectCPUX86(const FFCPUOptions* options, FFCPUResult* cpu) {
|
||||
FF_STRBUF_AUTO_DESTROY cpuinfo = ffStrbufCreateA(PROC_FILE_BUFFSIZ);
|
||||
if (!ffReadFileBuffer(FF_CPUINFO_PATH, &cpuinfo) || cpuinfo.length == 0) {
|
||||
return "ffReadFileBuffer(\"" FF_CPUINFO_PATH "\") failed";
|
||||
@@ -813,7 +813,7 @@ static const char* detectPhysicalCores(FFCPUResult* cpu) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
FF_A_UNUSED static void parseIsa(FFstrbuf* cpuIsa) {
|
||||
[[maybe_unused]] static void parseIsa(FFstrbuf* cpuIsa) {
|
||||
// Always use the last part of the ISA string. Ref: #590 #1204
|
||||
ffStrbufSubstrAfterLastC(cpuIsa, ' ');
|
||||
|
||||
@@ -833,7 +833,7 @@ FF_A_UNUSED static void parseIsa(FFstrbuf* cpuIsa) {
|
||||
}
|
||||
}
|
||||
|
||||
FF_A_UNUSED static void detectSocName(FFCPUResult* cpu) {
|
||||
[[maybe_unused]] static void detectSocName(FFCPUResult* cpu) {
|
||||
if (cpu->name.length > 0) {
|
||||
return;
|
||||
}
|
||||
@@ -953,7 +953,7 @@ FF_A_UNUSED static void detectSocName(FFCPUResult* cpu) {
|
||||
}
|
||||
|
||||
#ifdef __loongarch__
|
||||
FF_A_UNUSED static uint16_t getLoongarchPropCount(FFstrbuf* cpuinfo, const char* key) {
|
||||
[[maybe_unused]] static uint16_t getLoongarchPropCount(FFstrbuf* cpuinfo, const char* key) {
|
||||
const char* p = cpuinfo->chars;
|
||||
uint64_t low = 0, high = 0;
|
||||
uint32_t keylen = (uint32_t) strlen(key);
|
||||
@@ -974,7 +974,7 @@ FF_A_UNUSED static uint16_t getLoongarchPropCount(FFstrbuf* cpuinfo, const char*
|
||||
}
|
||||
#endif
|
||||
|
||||
FF_A_UNUSED static const char* detectCPUOthers(const FFCPUOptions* options, FFCPUResult* cpu) {
|
||||
[[maybe_unused]] static const char* detectCPUOthers(const FFCPUOptions* options, FFCPUResult* cpu) {
|
||||
cpu->coresLogical = (uint16_t) get_nprocs_conf();
|
||||
cpu->coresOnline = (uint16_t) get_nprocs();
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ static const char* detectCpuTemp(const FFCPUOptions* options, double* current) {
|
||||
return "open(_PATH_SYSMON, O_RDONLY | O_CLOEXEC) failed";
|
||||
}
|
||||
|
||||
FF_A_CLEANUP(freePropDict) prop_dictionary_t root = nullptr;
|
||||
[[gnu::cleanup(freePropDict)]] prop_dictionary_t root = nullptr;
|
||||
if (prop_dictionary_recv_ioctl(fd, ENVSYS_GETDICTIONARY, &root) < 0) {
|
||||
return "prop_dictionary_recv_ioctl(ENVSYS_GETDICTIONARY) failed";
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "cpu.h"
|
||||
|
||||
const char* ffDetectCPUImpl(FF_A_UNUSED const FFCPUOptions* options, FF_A_UNUSED FFCPUResult* cpu) {
|
||||
const char* ffDetectCPUImpl([[maybe_unused]] const FFCPUOptions* options, [[maybe_unused]] FFCPUResult* cpu) {
|
||||
return "Not supported on this platform";
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ static inline uint16_t countTypeId(kstat_ctl_t* kc, const char* type) {
|
||||
}
|
||||
|
||||
const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu) {
|
||||
FF_A_CLEANUP(kstatFreeWrap) kstat_ctl_t* kc = kstat_open();
|
||||
[[gnu::cleanup(kstatFreeWrap)]] kstat_ctl_t* kc = kstat_open();
|
||||
if (!kc) {
|
||||
return "kstat_open() failed";
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ const char* detectThermalTemp(const FFCPUOptions* options, double* result) {
|
||||
}
|
||||
}
|
||||
|
||||
FF_A_CLEANUP(ffPerfCloseQueryHandle)
|
||||
[[gnu::cleanup(ffPerfCloseQueryHandle)]]
|
||||
HANDLE hQuery = nullptr;
|
||||
|
||||
if (PerfOpenQueryHandle(nullptr, &hQuery) != ERROR_SUCCESS) {
|
||||
@@ -139,7 +139,7 @@ const char* detectThermalTemp(const FFCPUOptions* options, double* result) {
|
||||
}
|
||||
|
||||
// 7.5
|
||||
typedef struct FFSmbiosProcessorInfo {
|
||||
typedef struct [[gnu::packed]] FFSmbiosProcessorInfo {
|
||||
FFSmbiosHeader Header;
|
||||
|
||||
uint8_t SocketDesignation; // string
|
||||
@@ -181,7 +181,7 @@ typedef struct FFSmbiosProcessorInfo {
|
||||
|
||||
// 3.6+
|
||||
uint16_t ThreadEnabled; // varies
|
||||
} FF_A_PACKED FFSmbiosProcessorInfo;
|
||||
} FFSmbiosProcessorInfo;
|
||||
|
||||
static_assert(offsetof(FFSmbiosProcessorInfo, ThreadEnabled) == 0x30,
|
||||
"FFSmbiosProcessorInfo: Wrong struct alignment");
|
||||
@@ -238,7 +238,7 @@ static const char* detectNCores(const FFCPUOptions* options, FFCPUResult* cpu) {
|
||||
return "GetLogicalProcessorInformationEx(RelationAll, nullptr, &length) failed";
|
||||
}
|
||||
|
||||
SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX* FF_AUTO_FREE
|
||||
FF_AUTO_FREE SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX*
|
||||
pProcessorInfo = (SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX*) malloc(length);
|
||||
|
||||
if (!NT_SUCCESS(NtQuerySystemInformationEx(SystemLogicalProcessorAndGroupInformation, &lpr, sizeof(lpr), pProcessorInfo, length, &length))) {
|
||||
|
||||
Reference in New Issue
Block a user