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 include config.mk
OBJ = ${SRC:.c=.o} OBJ := $(SRC:.c=.o)
all: ${OBJ} ${OUT}
all: $(OBJ) $(OUT)
%.o: %.c %.o: %.c
${CC} -o $@ -c ${CFLAGS} $< $(CC) -o $@ -c $(CFLAGS) $<
clean: clean:
rm -f ${OBJ} ${OUT} rm -f $(OBJ) $(OUT)
ifneq (${OUT},) ifneq ($(OUT),)
${OUT}: ${OBJ} $(OUT): $(OBJ)
${CC} -o "$@" ${LDFLAGS} $^ $(CC) -o "$@" $(LDFLAGS) $^
endif endif
.PHONY: all clean .PHONY: all clean

View File

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