From c3f286ff72933a722bb4a0a60ad58bde07364423 Mon Sep 17 00:00:00 2001 From: Maschell Date: Fri, 17 Mar 2023 16:34:51 +0100 Subject: [PATCH] Format via clang format --- .clang-format | 67 ++++++++++++++++++++++++++++++++++++++++ .github/workflows/ci.yml | 8 +++++ .github/workflows/pr.yml | 8 +++++ README.md | 3 ++ source/main.cpp | 8 ++--- 5 files changed, 90 insertions(+), 4 deletions(-) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..56cc685 --- /dev/null +++ b/.clang-format @@ -0,0 +1,67 @@ +# Generated from CLion C/C++ Code Style settings +BasedOnStyle: LLVM +AccessModifierOffset: -4 +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: Consecutive +AlignConsecutiveMacros: AcrossEmptyLinesAndComments +AlignOperands: Align +AllowAllArgumentsOnNextLine: false +AllowAllConstructorInitializersOnNextLine: false +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine: Always +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: All +AllowShortIfStatementsOnASingleLine: Always +AllowShortLambdasOnASingleLine: All +AllowShortLoopsOnASingleLine: true +AlwaysBreakAfterReturnType: None +AlwaysBreakTemplateDeclarations: Yes +BreakBeforeBraces: Custom +BraceWrapping: + AfterCaseLabel: false + AfterClass: false + AfterControlStatement: Never + AfterEnum: false + AfterFunction: false + AfterNamespace: false + AfterUnion: false + BeforeCatch: false + BeforeElse: false + IndentBraces: false + SplitEmptyFunction: false + SplitEmptyRecord: true +BreakBeforeBinaryOperators: None +BreakBeforeTernaryOperators: true +BreakConstructorInitializers: BeforeColon +BreakInheritanceList: BeforeColon +ColumnLimit: 0 +CompactNamespaces: false +ContinuationIndentWidth: 8 +IndentCaseLabels: true +IndentPPDirectives: None +IndentWidth: 4 +KeepEmptyLinesAtTheStartOfBlocks: true +MaxEmptyLinesToKeep: 2 +NamespaceIndentation: All +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: true +PointerAlignment: Right +ReflowComments: false +SpaceAfterCStyleCast: true +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: false +SpaceBeforeAssignmentOperators: true +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatements +SpaceBeforeRangeBasedForLoopColon: true +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: false +SpacesInCStyleCastParentheses: false +SpacesInContainerLiterals: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +TabWidth: 4 +UseTab: Never diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ea0fb3c..41a12a9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,8 +6,16 @@ on: - main jobs: + clang-format: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - name: clang-format + run: | + docker run --rm -v ${PWD}:/src ghcr.io/wiiu-env/clang-format:13.0.0-2 -r ./src build-binary: runs-on: ubuntu-18.04 + needs: clang-format steps: - uses: actions/checkout@v2 - name: build binary diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 0413d45..2783996 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -3,8 +3,16 @@ name: CI-PR on: [pull_request] jobs: + clang-format: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - name: clang-format + run: | + docker run --rm -v ${PWD}:/src ghcr.io/wiiu-env/clang-format:13.0.0-2 -r ./src build-binary: runs-on: ubuntu-18.04 + needs: clang-format steps: - uses: actions/checkout@v2 - name: build binary diff --git a/README.md b/README.md index f235e0d..8ea6931 100644 --- a/README.md +++ b/README.md @@ -12,3 +12,6 @@ docker run -it --rm -v ${PWD}:/project loggingmodule-builder make # make clean docker run -it --rm -v ${PWD}:/project loggingmodule-builder make clean ``` +## Format the code via docker + +`docker run --rm -v ${PWD}:/src ghcr.io/wiiu-env/clang-format:13.0.0-2 -r ./src -i` diff --git a/source/main.cpp b/source/main.cpp index e0b9165..93033d6 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -1,13 +1,13 @@ -#include #include +#include WUMS_MODULE_EXPORT_NAME("homebrew_logging"); -#define OSConsoleWriteEx ((void (*)( uint32_t, uint32_t, const char *, size_t))(0x101C400 + 0x10cf0)) +#define OSConsoleWriteEx ((void (*)(uint32_t, uint32_t, const char *, size_t))(0x101C400 + 0x10cf0)) bool WUMSLogWrite(const char *str, size_t size) { - OSConsoleWriteEx(0xFFFFFFFF, 0xFFFFFFFF, str, size); - return true; + OSConsoleWriteEx(0xFFFFFFFF, 0xFFFFFFFF, str, size); + return true; } WUMS_EXPORT_FUNCTION(WUMSLogWrite); \ No newline at end of file