mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-07 21:50:08 +01:00
Global: replaces __attribute__ to C23 [[attribute]]
This commit is contained in:
@@ -316,18 +316,18 @@ typedef struct _DXGK_NODEMETADATA_FLAGS {
|
||||
};
|
||||
} DXGK_NODEMETADATA_FLAGS;
|
||||
|
||||
typedef struct _DXGK_NODEMETADATA {
|
||||
typedef struct [[gnu::packed]] _DXGK_NODEMETADATA {
|
||||
DXGK_ENGINE_TYPE EngineType;
|
||||
WCHAR FriendlyName[DXGK_MAX_METADATA_NAME_LENGTH];
|
||||
DXGK_NODEMETADATA_FLAGS Flags; // WDDM 2.2
|
||||
BOOLEAN GpuMmuSupported; // WDDM 2.0 ???
|
||||
BOOLEAN IoMmuSupported;
|
||||
} FF_A_PACKED DXGK_NODEMETADATA;
|
||||
} DXGK_NODEMETADATA;
|
||||
|
||||
typedef struct _D3DKMT_NODEMETADATA {
|
||||
typedef struct [[gnu::packed]] _D3DKMT_NODEMETADATA {
|
||||
UINT NodeOrdinalAndAdapterIndex; // WDDMv2: High word is physical adapter index, low word is node ordinal
|
||||
DXGK_NODEMETADATA NodeData;
|
||||
} FF_A_PACKED D3DKMT_NODEMETADATA;
|
||||
} D3DKMT_NODEMETADATA;
|
||||
static_assert(sizeof(D3DKMT_NODEMETADATA) == 0x4E, "D3DKMT_NODEMETADATA structure size mismatch");
|
||||
|
||||
// Functions
|
||||
|
||||
@@ -106,7 +106,7 @@ const char* detectByOpenGL(FFlist* gpus) {
|
||||
ffStrbufInit(&result.slv);
|
||||
ffStrbufInit(&result.library);
|
||||
|
||||
FF_A_CLEANUP(ffDestroyOpenGLOptions) FFOpenGLOptions options;
|
||||
[[gnu::cleanup(ffDestroyOpenGLOptions)]] FFOpenGLOptions options;
|
||||
ffInitOpenGLOptions(&options);
|
||||
const char* error = ffDetectOpenGL(&options, &result);
|
||||
FF_DEBUG("OpenGL detection returns: %s", error ?: "success");
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "common/debug.h"
|
||||
|
||||
// Helper function to convert ADL status code to string
|
||||
FF_A_UNUSED static const char* ffAdlStatusToString(int status) {
|
||||
[[maybe_unused]] static const char* ffAdlStatusToString(int status) {
|
||||
switch (status) {
|
||||
#define FF_ADL_STATUS_CASE(name) \
|
||||
case name: \
|
||||
|
||||
@@ -48,7 +48,7 @@ const char* ffDetectMthreadsGpuInfo(const FFGpuDriverCondition* cond, FFGpuDrive
|
||||
#define FF_GPU_DRIVER_DLLNAME_PATH_PREFIX
|
||||
#endif
|
||||
|
||||
FF_A_UNUSED static inline bool getDriverSpecificDetectionFn(const char* vendor, __typeof__(&ffDetectNvidiaGpuInfo)* pDetectFn, const char** pDllName) {
|
||||
[[maybe_unused]] static inline bool getDriverSpecificDetectionFn(const char* vendor, __typeof__(&ffDetectNvidiaGpuInfo)* pDetectFn, const char** pDllName) {
|
||||
if (vendor == FF_GPU_VENDOR_NAME_NVIDIA) {
|
||||
*pDetectFn = ffDetectNvidiaGpuInfo;
|
||||
#ifdef _WIN32
|
||||
|
||||
@@ -15,7 +15,7 @@ enum {
|
||||
PCI_CONF_SIZE = 0x40,
|
||||
};
|
||||
|
||||
const char* ffDetectGPUImpl(FF_A_UNUSED const FFGPUOptions* options, FFlist* gpus) {
|
||||
const char* ffDetectGPUImpl([[maybe_unused]] const FFGPUOptions* options, FFlist* gpus) {
|
||||
int dDomainFd = open(_SERVERS_BUS "/pci/0000", O_RDONLY | O_CLOEXEC);
|
||||
if (dDomainFd < 0) {
|
||||
return "open(_SERVERS_BUS \"/pci/0000\") failed";
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <private/drivers/poke.h>
|
||||
|
||||
const char* ffDetectGPUImpl(FF_A_UNUSED const FFGPUOptions* options, FFlist* gpus) {
|
||||
const char* ffDetectGPUImpl([[maybe_unused]] const FFGPUOptions* options, FFlist* gpus) {
|
||||
FF_AUTO_CLOSE_FD int pokefd = open(POKE_DEVICE_FULLNAME, O_RDWR | O_CLOEXEC);
|
||||
if (pokefd < 0) {
|
||||
return "open(POKE_DEVICE_FULLNAME) failed";
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
|
||||
static bool detectDriverFromSysfs(FFstrbuf* result, FFstrbuf* pciDir, FFstrbuf* buffer, FF_A_UNUSED const char* drmKey) {
|
||||
static bool detectDriverFromSysfs(FFstrbuf* result, FFstrbuf* pciDir, FFstrbuf* buffer, [[maybe_unused]] const char* drmKey) {
|
||||
uint32_t pciDirLength = pciDir->length;
|
||||
ffStrbufAppendS(pciDir, "/driver");
|
||||
char pathBuf[PATH_MAX];
|
||||
@@ -52,7 +52,7 @@ static bool detectDriverFromSysfs(FFstrbuf* result, FFstrbuf* pciDir, FFstrbuf*
|
||||
return true;
|
||||
}
|
||||
|
||||
FF_A_UNUSED static const char* drmFindRenderFromCard(const char* drmCardKey, FFstrbuf* result) {
|
||||
[[maybe_unused]] static const char* drmFindRenderFromCard(const char* drmCardKey, FFstrbuf* result) {
|
||||
char path[PATH_MAX];
|
||||
sprintf(path, "/sys/class/drm/%s/device/drm", drmCardKey);
|
||||
FF_AUTO_CLOSE_DIR DIR* dirp = opendir(path);
|
||||
@@ -497,7 +497,7 @@ static const char* detectPci(const FFGPUOptions* options, FFlist* gpus, FFstrbuf
|
||||
#if __aarch64__
|
||||
#include "detection/cpu/cpu.h"
|
||||
|
||||
FF_A_UNUSED static const char* drmDetectAsahiSpecific(FFGPUResult* gpu, const char* name, FF_A_UNUSED FFstrbuf* buffer, FF_A_UNUSED const char* drmKey) {
|
||||
[[maybe_unused]] static const char* drmDetectAsahiSpecific(FFGPUResult* gpu, const char* name, [[maybe_unused]] FFstrbuf* buffer, [[maybe_unused]] const char* drmKey) {
|
||||
if (sscanf(name, "agx-t%lu", &gpu->deviceId) == 1) {
|
||||
ffStrbufSetStatic(&gpu->name, ffCPUAppleCodeToName((uint32_t) gpu->deviceId));
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ struct FFMtmlData {
|
||||
MtmlSystem* sys;
|
||||
} mtmlData;
|
||||
|
||||
FF_A_UNUSED static void shutdownMtml(void) {
|
||||
[[maybe_unused]] static void shutdownMtml(void) {
|
||||
mtmlData.ffmtmlLibraryShutDown(mtmlData.lib);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ static inline int pciReadConf(int fd, uint32_t bus, uint32_t device, uint32_t fu
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char* ffDetectGPUImpl(FF_A_UNUSED const FFGPUOptions* options, FFlist* gpus) {
|
||||
const char* ffDetectGPUImpl([[maybe_unused]] const FFGPUOptions* options, FFlist* gpus) {
|
||||
char pciDevPath[] = "/dev/pciXXX";
|
||||
|
||||
for (uint32_t idev = 0; idev <= 255; idev++) {
|
||||
|
||||
@@ -27,7 +27,7 @@ static inline int pciReadConf(int fd, uint8_t bus, uint8_t device, uint8_t func,
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char* detectByPci(FF_A_UNUSED const FFGPUOptions* options, FFlist* gpus) {
|
||||
const char* detectByPci([[maybe_unused]] const FFGPUOptions* options, FFlist* gpus) {
|
||||
char pciDevPath[] = "/dev/pci0";
|
||||
FF_AUTO_CLOSE_FD int pcifd = open(pciDevPath, O_RDONLY | O_CLOEXEC);
|
||||
if (pcifd < 0) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <libdevinfo.h>
|
||||
|
||||
static int walkDevTree(di_node_t node, FF_A_UNUSED di_minor_t minor, FFlist* gpus) {
|
||||
static int walkDevTree(di_node_t node, [[maybe_unused]] di_minor_t minor, FFlist* gpus) {
|
||||
int* vendorId;
|
||||
int* deviceId;
|
||||
if (di_prop_lookup_ints(DDI_DEV_T_ANY, node, "vendor-id", &vendorId) > 0 && di_prop_lookup_ints(DDI_DEV_T_ANY, node, "device-id", &deviceId) > 0) {
|
||||
@@ -43,7 +43,7 @@ static int walkDevTree(di_node_t node, FF_A_UNUSED di_minor_t minor, FFlist* gpu
|
||||
return DI_WALK_CONTINUE;
|
||||
}
|
||||
|
||||
const char* ffDetectGPUImpl(FF_A_UNUSED const FFGPUOptions* options, FFlist* gpus) {
|
||||
const char* ffDetectGPUImpl([[maybe_unused]] const FFGPUOptions* options, FFlist* gpus) {
|
||||
di_node_t rootNode = di_init("/", DINFOCPYALL);
|
||||
if (rootNode == DI_NODE_NIL) {
|
||||
return "di_init() failed";
|
||||
|
||||
@@ -230,7 +230,7 @@ static void closeDxgfd(void) {
|
||||
}
|
||||
}
|
||||
|
||||
FF_A_UNUSED static inline const char* ffDebugNtStatus(NTSTATUS status) {
|
||||
[[maybe_unused]] static inline const char* ffDebugNtStatus(NTSTATUS status) {
|
||||
return status < 0 ? strerror(-status) : "Success";
|
||||
}
|
||||
#endif
|
||||
@@ -407,7 +407,7 @@ ffGPUDetectWsl2
|
||||
const char* dllName;
|
||||
if (options->driverSpecific && getDriverSpecificDetectionFn(gpu->vendor.chars, &detectFn, &dllName)) {
|
||||
FF_DEBUG("Calling driver-specific detection function for vendor: %s, DLL: %s", gpu->vendor.chars, dllName);
|
||||
FF_A_UNUSED const char* error = detectFn(
|
||||
[[maybe_unused]] const char* error = detectFn(
|
||||
&(FFGpuDriverCondition) {
|
||||
.type = FF_GPU_DRIVER_CONDITION_TYPE_LUID |
|
||||
(deviceIds.DeviceIds.VendorID != -1u ? FF_GPU_DRIVER_CONDITION_TYPE_DEVICE_ID : 0) |
|
||||
@@ -613,7 +613,7 @@ ffGPUDetectWsl2
|
||||
#if _WIN32
|
||||
else if (ffIsWindows10OrGreater()) {
|
||||
const char* ffGPUDetectTypeWithDXCore(LUID adapterLuid, FFGPUResult * gpu);
|
||||
FF_A_UNUSED const char* error = ffGPUDetectTypeWithDXCore(adapter->AdapterLuid, gpu);
|
||||
[[maybe_unused]] const char* error = ffGPUDetectTypeWithDXCore(adapter->AdapterLuid, gpu);
|
||||
FF_DEBUG("DXCore GPU type detection result: %s", error ?: "Success");
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user