Make cppcheck happy

This commit is contained in:
Thomas Klaehn 2019-07-23 15:42:56 +02:00
parent 501991058c
commit 2a528c0976
2 changed files with 6 additions and 7 deletions

View File

@ -37,7 +37,9 @@ C_FLAGS += -fpic
C_FLAGS += -O0 -g -Wall -Wextra -Werror C_FLAGS += -O0 -g -Wall -Wextra -Werror
CPP_FLAGS += $(addprefix -I, $(INCLUDES)) 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_SRCS = $(wildcard $(SRC_DIR)/*.c)
C_OBJS = $(patsubst $(SRC_DIR)%,$(OBJ_DIR)%,$(patsubst %.c,%.o,$(C_SRCS))) C_OBJS = $(patsubst $(SRC_DIR)%,$(OBJ_DIR)%,$(patsubst %.c,%.o,$(C_SRCS)))
@ -106,7 +108,7 @@ exec_unit_test: $(UNIT_TEST_TARGET)
.PHONY: check .PHONY: check
check: $(C_SRCS) check: $(C_SRCS)
$(CHECK) $(CPP_FLAGS) $(CHECK_FLAGS) $(C_SRCS) $(CHECK) $(CHECK_FLAGS) $(C_SRCS)
$(UNIT_TEST_TARGET): $(UNIT_TEST_OBJS) $(THIS_MAKEFILE) $(UNIT_TEST_TARGET): $(UNIT_TEST_OBJS) $(THIS_MAKEFILE)
@mkdir -p $(BIN_DIR)/$(UNIT_TEST_SRC_DIR) @mkdir -p $(BIN_DIR)/$(UNIT_TEST_SRC_DIR)

View File

@ -40,6 +40,7 @@ int i2c_close(const struct i2c_bb *i2c)
return res; return res;
} }
// cppcheck-suppress unusedFunction
int i2c_read(const struct i2c_bb *i2c, uint8_t slave_addr, char *buffer, unsigned int len) int i2c_read(const struct i2c_bb *i2c, uint8_t slave_addr, char *buffer, unsigned int len)
{ {
unsigned int i; 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; return (int)i;
} }
// cppcheck-suppress unusedFunction
int i2c_write(const struct i2c_bb *i2c, uint8_t slave_addr, const char *buffer, unsigned int len) int i2c_write(const struct i2c_bb *i2c, uint8_t slave_addr, const char *buffer, unsigned int len)
{ {
unsigned int i; 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; return (int)i;
} }
// cppcheck-suppress unusedFunction
static void start_condition(const struct i2c_bb *i2c) static void start_condition(const struct i2c_bb *i2c)
{ {
assert( NULL != i2c); assert( NULL != i2c);
@ -94,7 +94,6 @@ static void start_condition(const struct i2c_bb *i2c)
usleep(5); usleep(5);
} }
// cppcheck-suppress unusedFunction
static void stop_condition(const struct i2c_bb *i2c) static void stop_condition(const struct i2c_bb *i2c)
{ {
assert( NULL != i2c); assert( NULL != i2c);
@ -107,7 +106,6 @@ static void stop_condition(const struct i2c_bb *i2c)
usleep(5); usleep(5);
} }
// cppcheck-suppress unusedFunction
static bool write_byte(const struct i2c_bb *i2c, uint8_t byte) static bool write_byte(const struct i2c_bb *i2c, uint8_t byte)
{ {
uint8_t ack, i; uint8_t ack, i;
@ -124,7 +122,6 @@ static bool write_byte(const struct i2c_bb *i2c, uint8_t byte)
return (bool)(ack & 0x01); return (bool)(ack & 0x01);
} }
// cppcheck-suppress unusedFunction
static uint8_t read_byte(const struct i2c_bb *i2c, bool ack) static uint8_t read_byte(const struct i2c_bb *i2c, bool ack)
{ {
uint8_t res = 0, i; uint8_t res = 0, i;