-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move tests, fix overflow with I/O due to non null terminated magic st…
…ring
- Loading branch information
Showing
7 changed files
with
69 additions
and
20 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
CC = gcc | ||
CFLAGS = -g -Wall -O0 -std=c11 -Wextra -Wwrite-strings \ | ||
-Wno-parentheses -Wpedantic -Warray-bounds -Wconversion -Wstrict-prototypes -Wnewline-eof | ||
|
||
# Test for leaks with llvm | ||
# Apple clang does not support sanitize | ||
ifeq ($(CHECKLEAK),1) | ||
CC=/opt/homebrew/opt/llvm/bin/clang | ||
CFLAGS += -fsanitize=address -fsanitize=leak | ||
endif | ||
#LDFLAGS = -lm | ||
|
||
SOURCES=$(wildcard ./*.c ../src/*.c) | ||
OBJECTS=$(patsubst %.c, %.o, $(SOURCES)) # list *.c -> *.o | ||
TARGET = bin | ||
|
||
all: test | ||
|
||
# The first target defined in the makefile is the one | ||
# used when make is invoked with no argument. Given the definitions | ||
# above, this Makefile file will build the one named TARGET and | ||
# assume that it depends on all the named OBJECTS files. | ||
$(TARGET) : $(OBJECTS) | ||
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) | ||
|
||
|
||
# Phony means not a "real" target, it doesn't build anything | ||
# The phony target "clean" is used to remove all compiled object files. | ||
|
||
test: $(OBJECTS) | ||
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) | ||
@echo | ||
@echo ------------------ TEST ------------------ | ||
@./test | ||
@echo | ||
-@$(MAKE) -s clean | ||
|
||
.PHONY: clean check | ||
.SILENT: clean | ||
clean: | ||
rm -rf build $(OBJECTS) $(TESTS) $(TARGET) test | ||
find . -name "*.gc*" -exec rm {} \; | ||
rm -rf `find . -name "*.dSYM" -print` # Remove XCode junk | ||
|
||
|
||
check: | ||
@echo Files with pontentially dangerous functions. | ||
@egrep '[^_.>a-zA-Z0-9] (str(n?cpy|n?cat|xfrm|n?dup|str|pbrk|tok|_)\ | ||
|stpn?cpy|a?sn?printf|byte_)' $(SOURCES) || true |
Binary file not shown.
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
File renamed without changes.