1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-12-27 15:16:13 +00:00

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
This commit is contained in:
Dragorn421 2023-07-28 01:48:42 +02:00 committed by GitHub
parent 232fdb75d8
commit 5fa018106b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 12 deletions

View file

@ -14,8 +14,8 @@ from typing import List
# clang-format, clang-tidy and clang-apply-replacements default version # clang-format, clang-tidy and clang-apply-replacements default version
# Version 11 is used when available for more consistency between contributors # This specific version is used when available, for more consistency between contributors
CLANG_VER = 11 CLANG_VER = 14
# Clang-Format options (see .clang-format for rules applied) # Clang-Format options (see .clang-format for rules applied)
FORMAT_OPTS = "-i -style=file" 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(): def main():
parser = argparse.ArgumentParser(description="Format files in the codebase to enforce most style rules") 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("files", metavar="file", nargs="*")
parser.add_argument( parser.add_argument(
"-j", "-j",
@ -155,6 +161,13 @@ def main():
) )
args = parser.parse_args() 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() nb_jobs = args.jobs or multiprocessing.cpu_count()
if nb_jobs > 1: if nb_jobs > 1:
if CLANG_APPLY_REPLACEMENTS is None: if CLANG_APPLY_REPLACEMENTS is None:

View file

@ -2815,10 +2815,10 @@ Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 pos
overlayEntry->numLoaded = 0; overlayEntry->numLoaded = 0;
} }
actorInit = (void*)(uintptr_t)( actorInit = (void*)(uintptr_t)((overlayEntry->initInfo != NULL)
(overlayEntry->initInfo != NULL)
? (void*)((uintptr_t)overlayEntry->initInfo - ? (void*)((uintptr_t)overlayEntry->initInfo -
(intptr_t)((uintptr_t)overlayEntry->vramStart - (uintptr_t)overlayEntry->loadedRamAddr)) (intptr_t)((uintptr_t)overlayEntry->vramStart -
(uintptr_t)overlayEntry->loadedRamAddr))
: NULL); : NULL);
} }

View file

@ -213,10 +213,10 @@ void EffectSs_Spawn(PlayState* play, s32 type, s32 priority, void* initParams) {
osSyncPrintf(VT_RST); osSyncPrintf(VT_RST);
} }
initInfo = (void*)(uintptr_t)( initInfo = (void*)(uintptr_t)((overlayEntry->initInfo != NULL)
(overlayEntry->initInfo != NULL)
? (void*)((uintptr_t)overlayEntry->initInfo - ? (void*)((uintptr_t)overlayEntry->initInfo -
(intptr_t)((uintptr_t)overlayEntry->vramStart - (uintptr_t)overlayEntry->loadedRamAddr)) (intptr_t)((uintptr_t)overlayEntry->vramStart -
(uintptr_t)overlayEntry->loadedRamAddr))
: NULL); : NULL);
} }