Update .clang-format to update the comment, macro and assignment formatting

This commit is contained in:
Maschell 2022-02-03 13:49:11 +01:00
parent e5ead1af44
commit 9e96647469
14 changed files with 78 additions and 81 deletions

View File

@ -2,7 +2,8 @@
BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: None
AlignConsecutiveAssignments: Consecutive
AlignConsecutiveMacros: AcrossEmptyLinesAndComments
AlignOperands: Align
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: false
@ -56,7 +57,7 @@ SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 0
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false

View File

@ -122,7 +122,7 @@ bool ElfUtils::elfLinkOne(char type, size_t offset, int32_t addend, uint32_t des
return false;
}
freeSlot->trampolin[0] = 0x3D600000 | ((((uint32_t) value) >> 16) & 0x0000FFFF);// lis r11, real_addr@h
freeSlot->trampolin[0] = 0x3D600000 | ((((uint32_t) value) >> 16) & 0x0000FFFF); // lis r11, real_addr@h
freeSlot->trampolin[1] = 0x616B0000 | (((uint32_t) value) & 0x0000ffff); // ori r11, r11, real_addr@l
freeSlot->trampolin[2] = 0x7D6903A6; // mtctr r11
freeSlot->trampolin[3] = 0x4E800420; // bctr

View File

@ -24,7 +24,6 @@
extern "C" {
#endif
// clang-format off
#define DYN_LINK_FUNCTION_NAME_LENGTH 351
#define DYN_LINK_IMPORT_NAME_LENGTH 50
@ -32,7 +31,6 @@ extern "C" {
#define DYN_LINK_IMPORT_LIST_LENGTH 50
#define DYN_LINK_TRAMPOLIN_LIST_LENGTH DYN_LINK_FUNCTION_LIST_LENGTH
// clang-format on
typedef struct _dyn_linking_function_t {
char functionName[DYN_LINK_FUNCTION_NAME_LENGTH + 1];
@ -47,7 +45,7 @@ typedef struct _dyn_linking_import_t {
typedef struct _dyn_linking_relocation_entry_t {
dyn_linking_function_t *functionEntry = nullptr;
dyn_linking_import_t *importEntry = nullptr;
void *destination = NULL;
void *destination = nullptr;
char type{};
size_t offset{};
int32_t addend{};

View File

@ -19,7 +19,6 @@
#include <cstdint>
// clang-format off
typedef enum RelocationTrampolinStatus {
RELOC_TRAMP_FREE = 0,
RELOC_TRAMP_FIXED = 1,
@ -31,7 +30,6 @@ typedef enum RelocationType {
RELOC_TYPE_FIXED = 0,
RELOC_TYPE_IMPORT = 1
} RelocationType;
// clang-format on
typedef struct relocation_trampolin_entry_t {
uint32_t trampolin[4];

View File

@ -17,11 +17,11 @@
#pragma once
#define KERN_SYSCALL_TBL_1 0xFFE84C70// unknown
#define KERN_SYSCALL_TBL_2 0xFFE85070// works with games
#define KERN_SYSCALL_TBL_3 0xFFE85470// works with loader
#define KERN_SYSCALL_TBL_4 0xFFEAAA60// works with home menu
#define KERN_SYSCALL_TBL_5 0xFFEAAE60// works with browser (previously KERN_SYSCALL_TBL)
#define KERN_SYSCALL_TBL_1 0xFFE84C70 // unknown
#define KERN_SYSCALL_TBL_2 0xFFE85070 // works with games
#define KERN_SYSCALL_TBL_3 0xFFE85470 // works with loader
#define KERN_SYSCALL_TBL_4 0xFFEAAA60 // works with home menu
#define KERN_SYSCALL_TBL_5 0xFFEAAE60 // works with browser (previously KERN_SYSCALL_TBL)
#ifdef __cplusplus
extern "C" {

View File

@ -95,7 +95,7 @@ extern "C" int _start(int argc, char **argv) {
if (memory_end == memory_start) {
break;
}
auto mem_ptr = &memory_end[1];// &memory_end + sizeof(MEMExpHeapBlock);
auto mem_ptr = &memory_end[1]; // &memory_end + sizeof(MEMExpHeapBlock);
free(mem_ptr);
leak_count++;
}

View File

@ -258,7 +258,7 @@ char *StringTools::str_replace(char *orig, char *rep, char *with) {
char *tmp; // varies
int len_rep; // length of rep (the string to remove)
int len_with; // length of with (the string to replace rep with)
int len_front;// distance between rep and end of last rep
int len_front; // distance between rep and end of last rep
int count; // number of replacements
// sanity checks and initialization
@ -268,7 +268,7 @@ char *StringTools::str_replace(char *orig, char *rep, char *with) {
len_rep = strlen(rep);
if (len_rep == 0) {
return NULL;
}// empty rep causes infinite loop during count
} // empty rep causes infinite loop during count
if (!with) {
with = (char *) "";
}
@ -296,7 +296,7 @@ char *StringTools::str_replace(char *orig, char *rep, char *with) {
len_front = ins - orig;
tmp = strncpy(tmp, orig, len_front) + len_front;
tmp = strcpy(tmp, with) + len_with;
orig += len_front + len_rep;// move to next "end of rep"
orig += len_front + len_rep; // move to next "end of rep"
}
strcpy(tmp, orig);
return result;

View File

@ -7,7 +7,7 @@
uint32_t moduleLogInit = false;
uint32_t cafeLogInit = false;
uint32_t udpLogInit = false;
#endif// DEBUG
#endif // DEBUG
void initLogging() {
#ifdef DEBUG
@ -15,7 +15,7 @@ void initLogging() {
cafeLogInit = WHBLogCafeInit();
udpLogInit = WHBLogUdpInit();
}
#endif// DEBUG
#endif // DEBUG
}
void deinitLogging() {
@ -32,5 +32,5 @@ void deinitLogging() {
WHBLogUdpDeinit();
udpLogInit = false;
}
#endif// DEBUG
#endif // DEBUG
}