diff --git a/c/.clang-format b/c/.clang-format new file mode 100644 index 0000000..4e18d0e --- /dev/null +++ b/c/.clang-format @@ -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 + +... diff --git a/c/.clang-tidy b/c/.clang-tidy new file mode 100644 index 0000000..d732db4 --- /dev/null +++ b/c/.clang-tidy @@ -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 diff --git a/c/Makefile b/c/Makefile index 30c7aca..5076965 100644 --- a/c/Makefile +++ b/c/Makefile @@ -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 diff --git a/c/config.mk b/c/config.mk index f285a7c..5690ec6 100644 --- a/c/config.mk +++ b/c/config.mk @@ -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 +=\ diff --git a/cxx/.clang-format b/cxx/.clang-format new file mode 100644 index 0000000..4e18d0e --- /dev/null +++ b/cxx/.clang-format @@ -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 + +... diff --git a/cxx/.clang-tidy b/cxx/.clang-tidy new file mode 100644 index 0000000..d732db4 --- /dev/null +++ b/cxx/.clang-tidy @@ -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 diff --git a/cxx/config.mk b/cxx/config.mk index 189d861..c6eb4a1 100644 --- a/cxx/config.mk +++ b/cxx/config.mk @@ -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