cJSON
[Ported from github.com/DaveGamble/cJSON] Fix: heap-use-after-free in merge_patch when patch is subtree of target (#1065)
Brought by drakestapleton
cJSON / tests / unity / extras / fixture / test / Makefile
| 1 | CC = gcc |
| 2 | ifeq ($(shell uname -s), Darwin) |
| 3 | CC = clang |
| 4 | endif |
| 5 | #DEBUG = -O0 -g |
| 6 | CFLAGS += -std=c99 -pedantic -Wall -Wextra -Werror |
| 7 | CFLAGS += $(DEBUG) |
| 8 | DEFINES = -D UNITY_OUTPUT_CHAR=UnityOutputCharSpy_OutputChar |
| 9 | DEFINES += -D UNITY_OUTPUT_CHAR_HEADER_DECLARATION=UnityOutputCharSpy_OutputChar\(int\) |
| 10 | SRC = ../src/unity_fixture.c \ |
| 11 | ../../../src/unity.c \ |
| 12 | unity_fixture_Test.c \ |
| 13 | unity_fixture_TestRunner.c \ |
| 14 | unity_output_Spy.c \ |
| 15 | main/AllTests.c |
| 16 | |
| 17 | INC_DIR = -I../src -I../../../src/ |
| 18 | BUILD_DIR = ../build |
| 19 | TARGET = ../build/fixture_tests.exe |
| 20 | |
| 21 | all: default noStdlibMalloc 32bits |
| 22 | |
| 23 | default: $(BUILD_DIR) |
| 24 | $(CC) $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET) -D UNITY_SUPPORT_64 |
| 25 | @ echo "default build" |
| 26 | ./$(TARGET) |
| 27 | |
| 28 | 32bits: $(BUILD_DIR) |
| 29 | $(CC) $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET) -m32 |
| 30 | @ echo "32bits build" |
| 31 | ./$(TARGET) |
| 32 | |
| 33 | noStdlibMalloc: $(BUILD_DIR) |
| 34 | $(CC) $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET) -D UNITY_EXCLUDE_STDLIB_MALLOC |
| 35 | @ echo "build with noStdlibMalloc" |
| 36 | ./$(TARGET) |
| 37 | |
| 38 | C89: CFLAGS += -D UNITY_EXCLUDE_STDINT_H # C89 did not have type 'long long', <stdint.h> |
| 39 | C89: $(BUILD_DIR) |
| 40 | $(CC) $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET) -std=c89 && ./$(TARGET) |
| 41 | $(CC) $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET) -D UNITY_EXCLUDE_STDLIB_MALLOC -std=c89 |
| 42 | ./$(TARGET) |
| 43 | |
| 44 | $(BUILD_DIR): |
| 45 | mkdir -p $(BUILD_DIR) |
| 46 | |
| 47 | clean: |
| 48 | rm -f $(TARGET) $(BUILD_DIR)/*.gc* |
| 49 | |
| 50 | cov: $(BUILD_DIR) |
| 51 | cd $(BUILD_DIR) && \ |
| 52 | $(CC) $(DEFINES) $(foreach i, $(SRC), ../test/$(i)) $(INC_DIR) -o $(TARGET) -fprofile-arcs -ftest-coverage |
| 53 | rm -f $(BUILD_DIR)/*.gcda |
| 54 | ./$(TARGET) > /dev/null ; ./$(TARGET) -v > /dev/null |
| 55 | cd $(BUILD_DIR) && \ |
| 56 | gcov unity_fixture.c | head -3 |
| 57 | grep '###' $(BUILD_DIR)/unity_fixture.c.gcov -C2 || true # Show uncovered lines |
| 58 | |
| 59 | # These extended flags DO get included before any target build runs |
| 60 | CFLAGS += -Wbad-function-cast |
| 61 | CFLAGS += -Wcast-qual |
| 62 | CFLAGS += -Wconversion |
| 63 | CFLAGS += -Wformat=2 |
| 64 | CFLAGS += -Wmissing-prototypes |
| 65 | CFLAGS += -Wold-style-definition |
| 66 | CFLAGS += -Wpointer-arith |
| 67 | CFLAGS += -Wshadow |
| 68 | CFLAGS += -Wstrict-overflow=5 |
| 69 | CFLAGS += -Wstrict-prototypes |
| 70 | CFLAGS += -Wswitch-default |
| 71 | CFLAGS += -Wundef |
| 72 | CFLAGS += -Wno-error=undef # Warning only, this should not stop the build |
| 73 | CFLAGS += -Wunreachable-code |
| 74 | CFLAGS += -Wunused |
| 75 | CFLAGS += -fstrict-aliasing |