summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDragorn421 <Dragorn421@users.noreply.github.com>2023-07-28 01:48:42 +0200
committerGitHub <noreply@github.com>2023-07-27 19:48:42 -0400
commit5fa018106bde15d414047a38ddac162323739419 (patch)
treeba01b82ae2df7c5faebcb9c3e7d47d267b77ccb3
parent232fdb75d88854d41d6cf0a132e0dd16b69b0f9f (diff)
Prefer clang-format-14 (#1517)
* Change preferred clang version to 14 (for formatting) * Add `--show-paths` arg to format.py for printing paths to clang-* binaries used * Run formatter (clang-format-14) * run formatter
-rwxr-xr-xformat.py17
-rw-r--r--src/code/z_actor.c10
-rw-r--r--src/code/z_effect_soft_sprite.c10
3 files changed, 25 insertions, 12 deletions
diff --git a/format.py b/format.py
index 826a70783..51b7b6ac7 100755
--- a/format.py
+++ b/format.py
@@ -14,8 +14,8 @@ from typing import List
# clang-format, clang-tidy and clang-apply-replacements default version
-# Version 11 is used when available for more consistency between contributors
-CLANG_VER = 11
+# This specific version is used when available, for more consistency between contributors
+CLANG_VER = 14
# Clang-Format options (see .clang-format for rules applied)
FORMAT_OPTS = "-i -style=file"
@@ -144,6 +144,12 @@ def format_files(src_files: List[str], extra_files: List[str], nb_jobs: int):
def main():
parser = argparse.ArgumentParser(description="Format files in the codebase to enforce most style rules")
+ parser.add_argument(
+ "--show-paths",
+ dest="show_paths",
+ action="store_true",
+ help="Print the paths to the clang-* binaries used",
+ )
parser.add_argument("files", metavar="file", nargs="*")
parser.add_argument(
"-j",
@@ -155,6 +161,13 @@ def main():
)
args = parser.parse_args()
+ if args.show_paths:
+ import shutil
+
+ print("CLANG_FORMAT ->", shutil.which(CLANG_FORMAT))
+ print("CLANG_TIDY ->", shutil.which(CLANG_TIDY))
+ print("CLANG_APPLY_REPLACEMENTS ->", shutil.which(CLANG_APPLY_REPLACEMENTS))
+
nb_jobs = args.jobs or multiprocessing.cpu_count()
if nb_jobs > 1:
if CLANG_APPLY_REPLACEMENTS is None:
diff --git a/src/code/z_actor.c b/src/code/z_actor.c
index d7cd85e3e..04b8bbd7f 100644
--- a/src/code/z_actor.c
+++ b/src/code/z_actor.c
@@ -2815,11 +2815,11 @@ Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 pos
overlayEntry->numLoaded = 0;
}
- actorInit = (void*)(uintptr_t)(
- (overlayEntry->initInfo != NULL)
- ? (void*)((uintptr_t)overlayEntry->initInfo -
- (intptr_t)((uintptr_t)overlayEntry->vramStart - (uintptr_t)overlayEntry->loadedRamAddr))
- : NULL);
+ actorInit = (void*)(uintptr_t)((overlayEntry->initInfo != NULL)
+ ? (void*)((uintptr_t)overlayEntry->initInfo -
+ (intptr_t)((uintptr_t)overlayEntry->vramStart -
+ (uintptr_t)overlayEntry->loadedRamAddr))
+ : NULL);
}
objBankIndex = Object_GetIndex(&play->objectCtx, actorInit->objectId);
diff --git a/src/code/z_effect_soft_sprite.c b/src/code/z_effect_soft_sprite.c
index afd563da2..55a1245a3 100644
--- a/src/code/z_effect_soft_sprite.c
+++ b/src/code/z_effect_soft_sprite.c
@@ -213,11 +213,11 @@ void EffectSs_Spawn(PlayState* play, s32 type, s32 priority, void* initParams) {
osSyncPrintf(VT_RST);
}
- initInfo = (void*)(uintptr_t)(
- (overlayEntry->initInfo != NULL)
- ? (void*)((uintptr_t)overlayEntry->initInfo -
- (intptr_t)((uintptr_t)overlayEntry->vramStart - (uintptr_t)overlayEntry->loadedRamAddr))
- : NULL);
+ initInfo = (void*)(uintptr_t)((overlayEntry->initInfo != NULL)
+ ? (void*)((uintptr_t)overlayEntry->initInfo -
+ (intptr_t)((uintptr_t)overlayEntry->vramStart -
+ (uintptr_t)overlayEntry->loadedRamAddr))
+ : NULL);
}
if (initInfo->init == NULL) {