diff --git a/Makefile b/Makefile index 6133446..c242dc2 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,9 @@ C_FLAGS += -fpic C_FLAGS += -O0 -g -Wall -Wextra -Werror CPP_FLAGS += $(addprefix -I, $(INCLUDES)) -CHECK_FLAGS = --enable=all --template=gcc --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr --force + +CHECK_FLAGS = $(addprefix -I,$(filter-out $(PREFIX)/include/,$(INCLUDES))) +CHECK_FLAGS += --enable=all --template=gcc --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr --force C_SRCS = $(wildcard $(SRC_DIR)/*.c) C_OBJS = $(patsubst $(SRC_DIR)%,$(OBJ_DIR)%,$(patsubst %.c,%.o,$(C_SRCS))) @@ -106,7 +108,7 @@ exec_unit_test: $(UNIT_TEST_TARGET) .PHONY: check check: $(C_SRCS) - $(CHECK) $(CPP_FLAGS) $(CHECK_FLAGS) $(C_SRCS) + $(CHECK) $(CHECK_FLAGS) $(C_SRCS) $(UNIT_TEST_TARGET): $(UNIT_TEST_OBJS) $(THIS_MAKEFILE) @mkdir -p $(BIN_DIR)/$(UNIT_TEST_SRC_DIR) diff --git a/src/i2c.c b/src/i2c.c index 8748063..8e8e56e 100644 --- a/src/i2c.c +++ b/src/i2c.c @@ -40,6 +40,7 @@ int i2c_close(const struct i2c_bb *i2c) return res; } +// cppcheck-suppress unusedFunction int i2c_read(const struct i2c_bb *i2c, uint8_t slave_addr, char *buffer, unsigned int len) { unsigned int i; @@ -59,6 +60,7 @@ int i2c_read(const struct i2c_bb *i2c, uint8_t slave_addr, char *buffer, unsigne return (int)i; } +// cppcheck-suppress unusedFunction int i2c_write(const struct i2c_bb *i2c, uint8_t slave_addr, const char *buffer, unsigned int len) { unsigned int i; @@ -79,8 +81,6 @@ int i2c_write(const struct i2c_bb *i2c, uint8_t slave_addr, const char *buffer, return (int)i; } - -// cppcheck-suppress unusedFunction static void start_condition(const struct i2c_bb *i2c) { assert( NULL != i2c); @@ -94,7 +94,6 @@ static void start_condition(const struct i2c_bb *i2c) usleep(5); } -// cppcheck-suppress unusedFunction static void stop_condition(const struct i2c_bb *i2c) { assert( NULL != i2c); @@ -107,7 +106,6 @@ static void stop_condition(const struct i2c_bb *i2c) usleep(5); } -// cppcheck-suppress unusedFunction static bool write_byte(const struct i2c_bb *i2c, uint8_t byte) { uint8_t ack, i; @@ -124,7 +122,6 @@ static bool write_byte(const struct i2c_bb *i2c, uint8_t byte) return (bool)(ack & 0x01); } -// cppcheck-suppress unusedFunction static uint8_t read_byte(const struct i2c_bb *i2c, bool ack) { uint8_t res = 0, i;