Add formatters and new things

This commit is contained in:
Alex D. 2022-03-29 13:55:31 +00:00
parent 1a3764a5d0
commit 146e51bae3
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
7 changed files with 160 additions and 27 deletions

61
c/.clang-format Normal file
View File

@ -0,0 +1,61 @@
---
Standard: Auto
Language: Cpp
BasedOnStyle: LLVM
ColumnLimit: 0
IndentWidth: 8
TabWidth: 8
UseTab: ForIndentation
AlignConsecutiveAssignments: true
AlignConsecutiveBitFields: true
AlignConsecutiveDeclarations: true
AlignConsecutiveMacros: true
AlignEscapedNewlines: Left
AlignOperands: AlignAfterOperator
AlignTrailingComments: true
AllowShortBlocksOnASingleLine: Always
AllowShortCaseLabelsOnASingleLine: true
AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Always
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: TopLevel
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakBeforeMultilineStrings: false
BinPackArguments: false
BinPackParameters: false
BreakBeforeBinaryOperators: All
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
BreakStringLiterals: false
BreakConstructorInitializers: AfterColon
IndentCaseLabels: true
IndentPPDirectives: None
IndentGotoLabels: true
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ContinuationIndentWidth: 2
Cpp11BracedListStyle: true
IncludeBlocks: Regroup
InsertTrailingCommas: Wrapped
PointerAlignment: Right
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: true
SpaceBeforeParens: Always
SpacesInConditionalStatement: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
...

6
c/.clang-tidy Normal file
View File

@ -0,0 +1,6 @@
---
Checks: 'performance-*,portability-*,readability-*,bugprone-*,concurrency-*,llvm-*,clang-analyzer-core.*,clang-analyzer-nullability.*,clang-analyzer-optin.portability.UnixAPI,clang-analyzer-security.*,clang-analyzer-unix.*,clang-analyzer-valist.*,clang-analyzer-apiModeling.*,cert-*-c,-readability-isolate-declaration,-readability-braces-around-statements,-readability-named-parameter'
WarningsAsErrors: ''
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
FormatStyle: file

View File

@ -1,18 +1,17 @@
.SUFFIXES:
include config.mk
OBJ = ${SRC:.c=.o}
all: ${OBJ} ${OUT}
OBJ := $(SRC:.c=.o)
all: $(OBJ) $(OUT)
%.o: %.c
${CC} -o $@ -c ${CFLAGS} $<
$(CC) -o $@ -c $(CFLAGS) $<
clean:
rm -f ${OBJ} ${OUT}
rm -f $(OBJ) $(OUT)
ifneq (${OUT},)
${OUT}: ${OBJ}
${CC} -o "$@" ${LDFLAGS} $^
ifneq ($(OUT),)
$(OUT): $(OBJ)
$(CC) -o "$@" $(LDFLAGS) $^
endif
.PHONY: all clean

View File

@ -1,28 +1,28 @@
# Defaults
CC = clang
DEBUG = 1
STATIC = 0
CC := clang
DEBUG := 1
STATIC := 0
LDFLAGS =
CFLAGS =\
-std=c99\
-Weverything\
-Wno-padded\
-Wno-disabled-macro-expansion\
LDFLAGS :=
CFLAGS :=\
-std=c99 \
-Weverything \
-Wno-padded \
-Wno-disabled-macro-expansion \
-pedantic
# Sources / Results
SRC =\
SRC :=\
src/project/main.c
LIBDIR =
LIB =\
LIBDIR :=
LIB :=\
c
INCDIR =\
src/project/
INCDIR :=\
src/
OUT = project
OUT := project
# Conditionals / Appends
LDFLAGS +=\

61
cxx/.clang-format Normal file
View File

@ -0,0 +1,61 @@
---
Standard: Auto
Language: Cpp
BasedOnStyle: LLVM
ColumnLimit: 0
IndentWidth: 8
TabWidth: 8
UseTab: ForIndentation
AlignConsecutiveAssignments: true
AlignConsecutiveBitFields: true
AlignConsecutiveDeclarations: true
AlignConsecutiveMacros: true
AlignEscapedNewlines: Left
AlignOperands: AlignAfterOperator
AlignTrailingComments: true
AllowShortBlocksOnASingleLine: Always
AllowShortCaseLabelsOnASingleLine: true
AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Always
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: TopLevel
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakBeforeMultilineStrings: false
BinPackArguments: false
BinPackParameters: false
BreakBeforeBinaryOperators: All
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
BreakStringLiterals: false
BreakConstructorInitializers: AfterColon
IndentCaseLabels: true
IndentPPDirectives: None
IndentGotoLabels: true
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ContinuationIndentWidth: 2
Cpp11BracedListStyle: true
IncludeBlocks: Regroup
InsertTrailingCommas: Wrapped
PointerAlignment: Right
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: true
SpaceBeforeParens: Always
SpacesInConditionalStatement: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
...

6
cxx/.clang-tidy Normal file
View File

@ -0,0 +1,6 @@
---
Checks: 'performance-*,portability-*,readability-*,bugprone-*,concurrency-*,llvm-*,clang-analyzer-core.*,clang-analyzer-nullability.*,clang-analyzer-optin.portability.UnixAPI,clang-analyzer-security.*,clang-analyzer-unix.*,clang-analyzer-valist.*,clang-analyzer-apiModeling.*,cert-*-c,-readability-isolate-declaration,-readability-braces-around-statements,-readability-named-parameter'
WarningsAsErrors: ''
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
FormatStyle: file

View File

@ -5,9 +5,9 @@ STATIC = 0
LDFLAGS =
CXXFLAGS =\
-Weverything\
-Wno-padded\
-Wno-disabled-macro-expansion\
-Weverything \
-Wno-padded \
-Wno-disabled-macro-expansion \
-pedantic
# Sources / Results