From a6a70bb7e68e006c7e043c9106229041ff5c621a Mon Sep 17 00:00:00 2001 From: Rangi <35663410+Rangi42@users.noreply.github.com> Date: Fri, 20 Nov 2026 23:58:53 -0500 Subject: [PATCH] Format code with clang-format 21 (#2247) Use `ubuntu-latest` not `ubuntu-slim` for check-format.yml; `ubuntu-slim` is still Ubuntu 24.04 with clang-format 18. --- .github/workflows/check-format.yml | 2 +- include/itertools.hpp | 32 ++++++++++++++------------ src/asm/fstack.cpp | 36 +++++++++++++++++------------- src/asm/main.cpp | 6 +++-- src/gfx/main.cpp | 9 +++++--- src/gfx/reverse.cpp | 6 +++-- src/version.cpp | 6 +++-- 7 files changed, 58 insertions(+), 39 deletions(-) diff --git a/.github/workflows/check-format.yml b/.github/workflows/check-format.yml index 05fa0b34..99ea08de 100644 --- a/.github/workflows/check-format.yml +++ b/.github/workflows/check-format.yml @@ -13,7 +13,7 @@ env: jobs: check-format: - runs-on: ubuntu-slim + runs-on: ubuntu-latest steps: - name: Checkout repo uses: actions/checkout@v7 diff --git a/include/itertools.hpp b/include/itertools.hpp index 5c7177ca..b0f37ab1 100644 --- a/include/itertools.hpp +++ b/include/itertools.hpp @@ -155,23 +155,27 @@ public: : _containers(std::forward(containers)...) {} auto begin() { - return ZipIterator(std::apply( - [](auto &&...containers) { - using std::begin; - return std::make_tuple(begin(containers)...); - }, - _containers - )); + return ZipIterator( + std::apply( + [](auto &&...containers) { + using std::begin; + return std::make_tuple(begin(containers)...); + }, + _containers + ) + ); } auto end() { - return ZipIterator(std::apply( - [](auto &&...containers) { - using std::end; - return std::make_tuple(end(containers)...); - }, - _containers - )); + return ZipIterator( + std::apply( + [](auto &&...containers) { + using std::end; + return std::make_tuple(end(containers)...); + }, + _containers + ) + ); } }; diff --git a/src/asm/fstack.cpp b/src/asm/fstack.cpp index 7f303e83..f2c99798 100644 --- a/src/asm/fstack.cpp +++ b/src/asm/fstack.cpp @@ -292,11 +292,13 @@ static void newFileContext(std::string const &filePath, bool isQuiet, bool updat macroArgs = oldContext.macroArgs; } - Context &context = contextStack.emplace(Context{ - .fileInfo = fileInfo, - .uniqueIDStr = uniqueIDStr, - .macroArgs = macroArgs, - }); + Context &context = contextStack.emplace( + Context{ + .fileInfo = fileInfo, + .uniqueIDStr = uniqueIDStr, + .macroArgs = macroArgs, + } + ); context.lexerState.setFileAsNextState(filePath, updateStateNow); } @@ -329,11 +331,13 @@ static void fileInfo->parent = oldContext.fileInfo; fileInfo->lineNo = lexer_GetLineNo(); - Context &context = contextStack.emplace(Context{ - .fileInfo = fileInfo, - .uniqueIDStr = std::make_shared(), // Create a new, not-yet-generated ID - .macroArgs = macroArgs, - }); + Context &context = contextStack.emplace( + Context{ + .fileInfo = fileInfo, + .uniqueIDStr = std::make_shared(), // Create a new, not-yet-generated ID + .macroArgs = macroArgs, + } + ); context.lexerState.setViewAsNextState("MACRO", macro.getMacro(), macro.fileLine); } @@ -355,11 +359,13 @@ static Context & fileInfo->parent = oldContext.fileInfo; fileInfo->lineNo = reptLineNo; - Context &context = contextStack.emplace(Context{ - .fileInfo = fileInfo, - .uniqueIDStr = std::make_shared(), // Create a new, not-yet-generated ID - .macroArgs = oldContext.macroArgs, - }); + Context &context = contextStack.emplace( + Context{ + .fileInfo = fileInfo, + .uniqueIDStr = std::make_shared(), // Create a new, not-yet-generated ID + .macroArgs = oldContext.macroArgs, + } + ); context.lexerState.setViewAsNextState("REPT", span, reptLineNo); diff --git a/src/asm/main.cpp b/src/asm/main.cpp index 1a59eb99..96d845dd 100644 --- a/src/asm/main.cpp +++ b/src/asm/main.cpp @@ -537,8 +537,10 @@ int main(int argc, char *argv[]) { if (localOptions.dependFileName) { if (!options.targetFileName) { - fatal("Dependency files can only be created if a target file is specified with either " - "'-o', '-MQ' or '-MT'"); + fatal( + "Dependency files can only be created if a target file is specified with either " + "'-o', '-MQ' or '-MT'" + ); } if (*localOptions.dependFileName == "-") { diff --git a/src/gfx/main.cpp b/src/gfx/main.cpp index 4f5570ce..bde022c3 100644 --- a/src/gfx/main.cpp +++ b/src/gfx/main.cpp @@ -649,11 +649,14 @@ int main(int argc, char *argv[]) { if (localOptions.groupOutputs) { if (!localOptions.autoAny()) { - warnx("Grouping outputs ('-O') is enabled, but without any automatic output paths " - "('-A', '-P', '-Q', or '-T')"); + warnx( + "Grouping outputs ('-O') is enabled, but without any automatic output paths " + "('-A', '-P', '-Q', or '-T')" + ); } if (options.output.empty()) { - warnx("Grouping outputs ('-O') is enabled, but without an output tile data file ('-o')" + warnx( + "Grouping outputs ('-O') is enabled, but without an output tile data file ('-o')" ); } } diff --git a/src/gfx/reverse.cpp b/src/gfx/reverse.cpp index f89c753c..2e34f495 100644 --- a/src/gfx/reverse.cpp +++ b/src/gfx/reverse.cpp @@ -285,8 +285,10 @@ void reverse() { } grayscale = true; } else if (options.palSpecType == Options::EMBEDDED) { - warnx("An embedded palette was requested, but no palette file was specified; ignoring " - "request"); + warnx( + "An embedded palette was requested, but no palette file was specified; ignoring " + "request" + ); grayscale = true; } else if (options.hasExplicitPalSpec()) { palettes = std::move(options.palSpec); // We won't be using it again. diff --git a/src/version.cpp b/src/version.cpp index 5c8f139c..83ec75ae 100644 --- a/src/version.cpp +++ b/src/version.cpp @@ -45,10 +45,12 @@ char const *get_package_version_string() { } // Fallback if version string can't be obtained from Git #ifndef PACKAGE_VERSION_RC - return "v" EXPAND_AND_STR(PACKAGE_VERSION_MAJOR) "." EXPAND_AND_STR(PACKAGE_VERSION_MINOR + return "v" EXPAND_AND_STR(PACKAGE_VERSION_MAJOR) "." EXPAND_AND_STR( + PACKAGE_VERSION_MINOR ) "." EXPAND_AND_STR(PACKAGE_VERSION_PATCH); #else - return "v" EXPAND_AND_STR(PACKAGE_VERSION_MAJOR) "." EXPAND_AND_STR(PACKAGE_VERSION_MINOR + return "v" EXPAND_AND_STR(PACKAGE_VERSION_MAJOR) "." EXPAND_AND_STR( + PACKAGE_VERSION_MINOR ) "." EXPAND_AND_STR(PACKAGE_VERSION_PATCH) "-rc" EXPAND_AND_STR(PACKAGE_VERSION_RC); #endif }