Skip to content

Commit 2b66122

Browse files
GaryOderNichtsMaschell
authored andcommitted
Add .clang-format
Co-authored-by: Maschell <Maschell@gmx.de>
1 parent fa650f9 commit 2b66122

12 files changed

Lines changed: 144 additions & 42 deletions

File tree

.clang-format

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
---
2+
BasedOnStyle: LLVM
3+
AccessModifierOffset: -3
4+
AlignAfterOpenBracket: Align
5+
AlignConsecutiveAssignments: AcrossEmptyLinesAndComments
6+
AlignConsecutiveMacros: AcrossEmptyLinesAndComments
7+
AlignOperands: Align
8+
AllowAllArgumentsOnNextLine: false
9+
AllowAllConstructorInitializersOnNextLine: false
10+
AllowAllParametersOfDeclarationOnNextLine: false
11+
AllowShortBlocksOnASingleLine: Always
12+
AllowShortCaseLabelsOnASingleLine: false
13+
AllowShortFunctionsOnASingleLine: All
14+
AllowShortIfStatementsOnASingleLine: Always
15+
AllowShortLambdasOnASingleLine: All
16+
AllowShortLoopsOnASingleLine: true
17+
AlwaysBreakAfterReturnType: All
18+
AlwaysBreakTemplateDeclarations: Yes
19+
AttributeMacros:
20+
- asm
21+
- WUT_FORMAT_PRINTF
22+
BinPackParameters: false
23+
BreakBeforeBraces: Custom
24+
BraceWrapping:
25+
AfterCaseLabel: false
26+
AfterClass: true
27+
AfterControlStatement: Never
28+
AfterEnum: true
29+
AfterExternBlock: false
30+
AfterStruct: true
31+
AfterFunction: true
32+
AfterNamespace: true
33+
AfterUnion: true
34+
BeforeCatch: false
35+
BeforeElse: false
36+
IndentBraces: false
37+
SplitEmptyFunction: false
38+
SplitEmptyRecord: true
39+
BreakBeforeBinaryOperators: None
40+
BreakBeforeTernaryOperators: true
41+
BreakConstructorInitializers: AfterColon
42+
BreakInheritanceList: BeforeColon
43+
ColumnLimit: 0
44+
CompactNamespaces: false
45+
ConstructorInitializerIndentWidth: 3
46+
ContinuationIndentWidth: 3
47+
FixNamespaceComments: true
48+
IncludeBlocks: Preserve
49+
IncludeCategories:
50+
# Include wut headers first
51+
- Regex: '^[<|"]wut'
52+
Priority: 1
53+
- Regex: '^<'
54+
Priority: 2
55+
- Regex: '^"'
56+
Priority: 3
57+
IndentAccessModifiers: false
58+
IndentCaseLabels: true
59+
IndentPPDirectives: None
60+
IndentWidth: 3
61+
KeepEmptyLinesAtTheStartOfBlocks: true
62+
MaxEmptyLinesToKeep: 2
63+
NamespaceIndentation: None
64+
ObjCSpaceAfterProperty: false
65+
ObjCSpaceBeforeProtocolList: true
66+
PackConstructorInitializers: BinPack
67+
PointerAlignment: Right
68+
ReflowComments: false
69+
SeparateDefinitionBlocks: Leave
70+
SpaceAfterCStyleCast: false
71+
SpaceAfterLogicalNot: false
72+
SpaceAfterTemplateKeyword: false
73+
SpaceBeforeAssignmentOperators: true
74+
SpaceBeforeCpp11BracedList: false
75+
SpaceBeforeCtorInitializerColon: true
76+
SpaceBeforeInheritanceColon: true
77+
SpaceBeforeParens: ControlStatements
78+
SpaceBeforeRangeBasedForLoopColon: true
79+
SpaceInEmptyParentheses: false
80+
SpacesBeforeTrailingComments: 1
81+
SpacesInAngles: false
82+
SpacesInCStyleCastParentheses: false
83+
SpacesInContainerLiterals: false
84+
SpacesInParentheses: false
85+
SpacesInSquareBrackets: false
86+
TabWidth: 4
87+
TypenameMacros:
88+
- BOOL
89+
- RPLWRAP
90+
UseTab: Never

include/coreinit/exit.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
extern "C" {
1212
#endif
1313

14+
// clang-format off
1415
void
1516
RPLWRAP(exit)(int code);
17+
// clang-format on
1618

1719
void
1820
_Exit(int code);

include/coreinit/filesystem_fsa.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#pragma once
2-
3-
#include "wut.h"
2+
#include <wut.h>
43
#include "filesystem.h"
54

65
#ifdef __cplusplus

include/nn/acp/title.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,11 @@ ACPGetTitleIdOfMainApplication(ACPTitleId* titleId);
249249
* @param metaXml must be aligned to 0x40
250250
* @return ACP_RESULT_SUCCESS on success
251251
*/
252+
// clang-format off
252253
ACPResult
253254
RPLWRAP(ACPGetTitleMetaXml)(ACPTitleId titleId,
254255
ACPMetaXml *metaXml);
256+
// clang-format on
255257

256258
/**
257259
* Gets the MetaXML for a given title id
@@ -269,10 +271,12 @@ ACPGetTitleMetaXml(ACPTitleId titleId,
269271
return RPLWRAP(ACPGetTitleMetaXml)(titleId, metaXml);
270272
}
271273

274+
// clang-format off
272275
ACPResult
273276
RPLWRAP(ACPGetTitleSaveMetaXml)(uint64_t titleId,
274277
ACPMetaXml* metaXml,
275278
ACPDeviceType deviceType);
279+
// clang-format on
276280

277281
/**
278282
* Gets the save dir MetaXML for a given title id

include/nn/hpad/hpad.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,12 @@ HPADShutdown(void);
176176
* \return
177177
* The amount of buffers read or a negative value on error.
178178
*/
179+
// clang-format off
179180
int32_t
180181
RPLWRAP(HPADRead)(HPADChan chan,
181182
HPADStatus *buffers,
182183
int32_t count);
184+
// clang-format on
183185

184186
/**
185187
* Reads status buffers from a specified HPAD channel.

include/nn/nets2/somemopt.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,13 @@ somemopt(SOMemOptRequest request,
5757
uint32_t size,
5858
SOMemOptFlags flags);
5959

60+
// clang-format off
6061
int
6162
RPLWRAP(somemopt)(SOMemOptRequest request,
6263
void *buffer,
6364
uint32_t size,
6465
SOMemOptFlags flags);
66+
// clang-format on
6567

6668
#ifdef __cplusplus
6769
}

include/nsysnet/_netdb.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
extern "C" {
1212
#endif
1313

14+
// clang-format off
15+
1416
struct hostent *
1517
RPLWRAP(gethostbyaddr)(const void *addr,
1618
size_t len,
@@ -50,6 +52,8 @@ RPLWRAP(get_h_errno)(void);
5052
const char *
5153
RPLWRAP(gai_strerror)(int ecode);
5254

55+
// clang-format on
56+
5357
#ifdef __cplusplus
5458
}
5559
#endif

include/nsysnet/_socket.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ socket_lib_init();
4747
void
4848
socket_lib_finish();
4949

50+
// clang-format off
51+
5052
int
5153
RPLWRAP(accept)(int sockfd,
5254
struct sockaddr *addr,
@@ -151,6 +153,8 @@ RPLWRAP(inet_pton)(int af,
151153
int
152154
RPLWRAP(socketlasterr)();
153155

156+
// clang-format on
157+
154158
#ifdef __cplusplus
155159
}
156160
#endif

include/nsysnet/netconfig.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#pragma once
22

33
#include <wut.h>
4-
#include <wut_rplwrap.h>
54
#include <stdint.h>
65
#include <sys/time.h>
76
#include <sys/types.h>

libraries/wutdevoptab/devoptab_fsa.cpp

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,33 @@
11
#include "devoptab_fsa.h"
22
#include <cstdio>
33

4-
static devoptab_t
5-
__wut_fsa_devoptab =
6-
{
7-
.name = "fs",
8-
.structSize = sizeof(__wut_fsa_file_t),
9-
.open_r = __wut_fsa_open,
10-
.close_r = __wut_fsa_close,
11-
.write_r = __wut_fsa_write,
12-
.read_r = __wut_fsa_read,
13-
.seek_r = __wut_fsa_seek,
14-
.fstat_r = __wut_fsa_fstat,
15-
.stat_r = __wut_fsa_stat,
16-
.unlink_r = __wut_fsa_unlink,
17-
.chdir_r = __wut_fsa_chdir,
18-
.rename_r = __wut_fsa_rename,
19-
.mkdir_r = __wut_fsa_mkdir,
20-
.dirStateSize = sizeof(__wut_fsa_dir_t),
21-
.diropen_r = __wut_fsa_diropen,
22-
.dirreset_r = __wut_fsa_dirreset,
23-
.dirnext_r = __wut_fsa_dirnext,
24-
.dirclose_r = __wut_fsa_dirclose,
25-
.statvfs_r = __wut_fsa_statvfs,
26-
.ftruncate_r = __wut_fsa_ftruncate,
27-
.fsync_r = __wut_fsa_fsync,
28-
.deviceData = nullptr,
29-
.chmod_r = __wut_fsa_chmod,
30-
.rmdir_r = __wut_fsa_rmdir,
31-
.lstat_r = __wut_fsa_stat,
32-
};
4+
static devoptab_t __wut_fsa_devoptab = {
5+
.name = "fs",
6+
.structSize = sizeof(__wut_fsa_file_t),
7+
.open_r = __wut_fsa_open,
8+
.close_r = __wut_fsa_close,
9+
.write_r = __wut_fsa_write,
10+
.read_r = __wut_fsa_read,
11+
.seek_r = __wut_fsa_seek,
12+
.fstat_r = __wut_fsa_fstat,
13+
.stat_r = __wut_fsa_stat,
14+
.unlink_r = __wut_fsa_unlink,
15+
.chdir_r = __wut_fsa_chdir,
16+
.rename_r = __wut_fsa_rename,
17+
.mkdir_r = __wut_fsa_mkdir,
18+
.dirStateSize = sizeof(__wut_fsa_dir_t),
19+
.diropen_r = __wut_fsa_diropen,
20+
.dirreset_r = __wut_fsa_dirreset,
21+
.dirnext_r = __wut_fsa_dirnext,
22+
.dirclose_r = __wut_fsa_dirclose,
23+
.statvfs_r = __wut_fsa_statvfs,
24+
.ftruncate_r = __wut_fsa_ftruncate,
25+
.fsync_r = __wut_fsa_fsync,
26+
.deviceData = nullptr,
27+
.chmod_r = __wut_fsa_chmod,
28+
.rmdir_r = __wut_fsa_rmdir,
29+
.lstat_r = __wut_fsa_stat,
30+
};
3331

3432

3533
__wut_fsa_device_t __wut_fsa_device_data = {};

0 commit comments

Comments
 (0)