-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from Decompollaborate/develop
1.0.1
- Loading branch information
Showing
33 changed files
with
507 additions
and
220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
IndentWidth: 4 | ||
Language: Cpp | ||
UseTab: Never | ||
ColumnLimit: 160 | ||
PointerAlignment: Right | ||
BreakBeforeBraces: Attach | ||
SpaceAfterCStyleCast: false | ||
Cpp11BracedListStyle: false | ||
IndentCaseLabels: true | ||
BinPackArguments: true | ||
BinPackParameters: true | ||
AlignAfterOpenBracket: Align | ||
AlignOperands: true | ||
BreakBeforeTernaryOperators: true | ||
BreakBeforeBinaryOperators: None | ||
AllowShortBlocksOnASingleLine: true | ||
AllowShortIfStatementsOnASingleLine: false | ||
AllowShortLoopsOnASingleLine: false | ||
AllowShortCaseLabelsOnASingleLine: false | ||
AllowShortFunctionsOnASingleLine: false | ||
AlignEscapedNewlines: Left | ||
AlignTrailingComments: true | ||
SortIncludes: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Checks: 'readability-*,-readability-magic-numbers,clang-diagnostic-*,clang-analyzer-*,-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,bugprone*,-bugprone-branch-clone,modernize*,performance*,portability*,diagnostic-*,analyzer-*,misc*,-misc-no-recursion' | ||
WarningsAsErrors: '' | ||
HeaderFilterRegex: '(src|include)\/.*\.h$' | ||
FormatStyle: 'file' | ||
CheckOptions: | ||
# Require argument names to match exactly (instead of allowing a name to be a prefix/suffix of another) | ||
# Note: 'true' is expected by clang-tidy 12+ but '1' is used for compatibility with older versions | ||
- key: readability-inconsistent-declaration-parameter-name.Strict | ||
value: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# Build options can be changed by modifying the makefile or by building with 'make SETTING=value'. | ||
DEBUG ?= 0 | ||
WERROR ?= 0 | ||
ASAN ?= 0 | ||
EXPERIMENTAL ?= 0 | ||
|
||
CC := clang | ||
IINC := -I include | ||
CSTD := -std=c11 | ||
CFLAGS := | ||
LDFLAGS := | ||
WARNINGS := -Wall -Wextra | ||
# WARNINGS := -Wall -Wextra -Wpedantic -Wpadded # binary constants :s | ||
WARNINGS += -Werror=implicit-function-declaration -Werror=incompatible-pointer-types -Werror=vla -Werror=switch -Werror=implicit-fallthrough -Werror=unused-function -Werror=unused-parameter -Werror=shadow | ||
|
||
ifeq ($(CC),gcc) | ||
WARNINGS += -Wno-cast-function-type | ||
endif | ||
|
||
ifeq ($(DEBUG),0) | ||
OPTFLAGS := -O2 -g | ||
else | ||
OPTFLAGS := -O0 -g3 | ||
CFLAGS += -DDEVELOPMENT=1 | ||
endif | ||
|
||
ifneq ($(WERROR),0) | ||
WARNINGS += -Werror | ||
endif | ||
|
||
ifneq ($(ASAN),0) | ||
CFLAGS += -fsanitize=address -fsanitize=pointer-compare -fsanitize=pointer-subtract -fsanitize=undefined | ||
endif | ||
|
||
ifneq ($(EXPERIMENTAL),0) | ||
CFLAGS += -DEXPERIMENTAL | ||
endif | ||
|
||
|
||
SRC_DIRS := $(shell find src -type d) | ||
C_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.c)) | ||
H_FILES := $(foreach dir,$(IINC),$(wildcard $(dir)/**/*.h)) | ||
O_FILES := $(foreach f,$(C_FILES:.c=.o),build/$f) | ||
DEP_FILES := $(O_FILES:%.o=%.d) | ||
|
||
|
||
# create build directories | ||
$(shell mkdir -p $(foreach dir,$(SRC_DIRS),build/$(dir))) | ||
|
||
|
||
#### Main Targets ### | ||
|
||
all: tests | ||
|
||
clean: | ||
$(RM) -rf build | ||
|
||
distclean: clean | ||
$(RM) -rf dist rabbitizer.egg-info .mypy_cache | ||
|
||
format: | ||
clang-format-11 -i -style=file $(C_FILES) | ||
|
||
tidy: | ||
clang-tidy-11 -p . --fix --fix-errors $(C_FILES) $(H_FILES) -- $(CSTD) $(OPTFLAGS) $(IINC) $(WARNINGS) $(CFLAGS) | ||
|
||
tests: build/test.elf | ||
|
||
.PHONY: all clean distclean format tidy tests | ||
.DEFAULT_GOAL := all | ||
.SECONDARY: | ||
|
||
|
||
#### Various Recipes #### | ||
|
||
build/%.elf: %.c $(O_FILES) | ||
$(CC) -MMD $(CSTD) $(OPTFLAGS) $(IINC) $(WARNINGS) $(CFLAGS) $(LDFLAGS) -o $@ $^ | ||
|
||
build/%.o: %.c | ||
# The -MMD flags additionaly creates a .d file with the same name as the .o file. | ||
$(CC) -MMD -c $(CSTD) $(OPTFLAGS) $(IINC) $(WARNINGS) $(CFLAGS) -o $@ $< | ||
|
||
|
||
-include $(DEP_FILES) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.