Global: replaces __attribute__ to C23 [[attribute]]

This commit is contained in:
李通洲
2026-07-10 21:13:03 +08:00
parent ba18705d2e
commit 61656a1a7a
229 changed files with 619 additions and 648 deletions
+13 -13
View File
@@ -15,7 +15,7 @@
#include <ctype.h>
#include <string.h>
FF_A_COLD
[[gnu::cold]]
static void printCommandFormatHelpJson(void) {
yyjson_mut_doc* doc = yyjson_mut_doc_new(nullptr);
yyjson_mut_val* root = yyjson_mut_obj(doc);
@@ -50,7 +50,7 @@ static void printCommandFormatHelpJson(void) {
yyjson_mut_doc_free(doc);
}
FF_A_COLD
[[gnu::cold]]
static void printCommandFormatHelp(const char* command) {
FF_STRBUF_AUTO_DESTROY type = ffStrbufCreateNS((uint32_t) (strlen(command) - strlen("-format")), command);
ffStrbufLowerCase(&type);
@@ -87,7 +87,7 @@ static void printCommandFormatHelp(const char* command) {
fprintf(stderr, "Error: Module '%s' is not supported\n", type.chars);
}
FF_A_COLD
[[gnu::cold]]
static void printFullHelp() {
fputs("Fastfetch is a neofetch-like tool for fetching system information and displaying them in a pretty way\n\n", stdout);
if (!instance.config.display.pipe) {
@@ -194,7 +194,7 @@ For detailed information on logo options, module configuration, and formatting,
https://github.com/fastfetch-cli/fastfetch/wiki/Configuration");
}
FF_A_COLD
[[gnu::cold]]
static bool printSpecificCommandHelp(const char* command) {
yyjson_doc* doc = yyjson_read(FASTFETCH_DATATEXT_JSON_HELP, strlen(FASTFETCH_DATATEXT_JSON_HELP), YYJSON_READ_NOFLAG);
assert(doc);
@@ -305,7 +305,7 @@ static bool printSpecificCommandHelp(const char* command) {
return false;
}
FF_A_COLD
[[gnu::cold]]
static void printCommandHelp(const char* command) {
if (command == nullptr) {
printFullHelp();
@@ -318,7 +318,7 @@ static void printCommandHelp(const char* command) {
}
}
FF_A_COLD
[[gnu::cold]]
static void listAvailablePresets(bool pretty) {
FF_LIST_FOR_EACH (FFstrbuf, path, instance.state.platform.dataDirs) {
ffStrbufAppendS(path, "fastfetch/presets/");
@@ -333,7 +333,7 @@ static void listAvailablePresets(bool pretty) {
}
}
FF_A_COLD
[[gnu::cold]]
static void listAvailableLogos(void) {
FF_LIST_FOR_EACH (FFstrbuf, path, instance.state.platform.dataDirs) {
ffStrbufAppendS(path, "fastfetch/logos/");
@@ -341,7 +341,7 @@ static void listAvailableLogos(void) {
}
}
FF_A_COLD
[[gnu::cold]]
static void listConfigPaths(void) {
FF_LIST_FOR_EACH (FFstrbuf, folder, instance.state.platform.configDirs) {
bool exists = false;
@@ -353,7 +353,7 @@ static void listConfigPaths(void) {
}
}
FF_A_COLD
[[gnu::cold]]
static void listDataPaths(void) {
FF_LIST_FOR_EACH (FFstrbuf, folder, instance.state.platform.dataDirs) {
ffStrbufAppendS(folder, "fastfetch/");
@@ -361,7 +361,7 @@ static void listDataPaths(void) {
}
}
FF_A_COLD
[[gnu::cold]]
static void listModules(bool pretty) {
unsigned count = 0;
for (int i = 0; i <= 'Z' - 'A'; ++i) {
@@ -431,7 +431,7 @@ static bool parseJsoncFile(FFdata* data, const char* path, yyjson_read_flag flg)
return true;
}
FF_A_COLD
[[gnu::cold]]
static void generateConfigFile(FFdata* data, bool force, const char* filePath, bool fullConfig) {
if (data->resultDoc) {
fprintf(stderr, "Error: duplicated `--gen-config` or `--format json` flags found\n");
@@ -569,7 +569,7 @@ static void optionParseConfigFile(FFdata* data, const char* key, const char* val
exit(414);
}
FF_A_COLD
[[gnu::cold]]
static void printVersion() {
FFVersionResult* result = &ffVersionResult;
printf("%s %s%s%s (%s)\n", result->projectName, result->version, result->versionTweak, result->debugMode ? "-debug" : "", result->architecture);
@@ -809,7 +809,7 @@ static void run(FFdata* data) {
}
}
FF_A_COLD
[[gnu::cold]]
static void writeConfigFile(FFdata* data) {
const FFstrbuf* filename = &data->genConfigPath;