Added stricter error checks by the compiler, and adapted all impacted code.

Primarily -
* Added "static" to static functions.
* Added proper signature with "void" to functions without arguments.
* Marked unused arguments with "(void)".
* Removed entirely unused static functions.
* Added "const" to preserve const-correctness.
* Added function prototypes for external functions.
This commit is contained in:
nimrodz
2015-01-18 00:32:47 +02:00
parent af40e7901d
commit b389c71e71
20 changed files with 130 additions and 87 deletions

View File

@ -21,6 +21,28 @@ endif
UNITY_ROOT=../..
C_COMPILER=gcc
CFLAGS = -std=c99
CFLAGS += -Wall
CFLAGS += -Wextra
CFLAGS += -Werror
CFLAGS += -Wpointer-arith
CFLAGS += -Wcast-align
CFLAGS += -Wwrite-strings
CFLAGS += -Wswitch-default
CFLAGS += -Wunreachable-code
CFLAGS += -Winit-self
CFLAGS += -Wlogical-op
CFLAGS += -Wmissing-field-initializers
CFLAGS += -Wno-unknown-pragmas
CFLAGS += -Wjump-misses-init
CFLAGS += -Wstrict-prototypes
CFLAGS += -Wundef
CFLAGS += -Wunsafe-loop-optimizations
CFLAGS += -Wold-style-definition
CFLAGS += -Wmissing-prototypes
CFLAGS += -Wmissing-declarations
TARGET_BASE1=all_tests
TARGET1 = $(TARGET_BASE1)$(TARGET_EXTENSION)
SRC_FILES1=\
@ -41,7 +63,7 @@ all: clean default
default:
# ruby auto/generate_test_runner.rb test/TestProductionCode.c test/test_runners/TestProductionCode_Runner.c
# ruby auto/generate_test_runner.rb test/TestProductionCode2.c test/test_runners/TestProductionCode2_Runner.c
$(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES1) -o $(TARGET1)
$(C_COMPILER) $(CFLAGS) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES1) -o $(TARGET1)
./$(TARGET1)
clean:

View File

@ -3,6 +3,8 @@
char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction)
{
(void)Poor;
(void)LittleFunction;
//Since There Are No Tests Yet, This Function Could Be Empty For All We Know.
// Which isn't terribly useful... but at least we put in a TEST_IGNORE so we won't forget
return (char*)0;