From 707c75131c7683f4a85b27e56af9eb7cf9902e3f Mon Sep 17 00:00:00 2001 From: Thomas Klaehn Date: Mon, 15 Jul 2019 13:27:17 +0200 Subject: [PATCH] Expand compiler flags for static code analysis --- .vscode/tasks.json | 14 ++++++++++---- Makefile | 2 +- src/gpio.c | 2 +- src/main.c | 2 +- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 728b284..0f8ec0a 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -8,9 +8,12 @@ "type":"shell", "command": "make all -j4", "problemMatcher": { - "base": "gcc", + "base": "$gcc", "owner": "gcc", - "fileLocation":"absolute" + "fileLocation": [ + "relative", + "${workspaceFolder}" + ] }, "group": { "kind": "build", @@ -22,9 +25,12 @@ "type":"shell", "command": "make clean -j4", "problemMatcher": { - "base": "gcc", + "base": "$gcc", "owner": "gcc", - "fileLocation":"absolute" + "fileLocation": [ + "relative", + "${workspaceFolder}" + ] }, "group": { "kind": "build", diff --git a/Makefile b/Makefile index 7c87113..6977947 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ LIBS := ftdi endif LD_FLAGS := -C_FLAGS := -O0 -g +C_FLAGS := -O0 -g -Wall -Wextra -Werror CPP_FLAGS := $(addprefix -I, $(INCLUDES)) C_SRCS = $(wildcard $(SRC_DIR)/*.c) diff --git a/src/gpio.c b/src/gpio.c index f8da101..c39f8d0 100644 --- a/src/gpio.c +++ b/src/gpio.c @@ -108,7 +108,7 @@ int gpio_read(const struct gpio *gpio, unsigned int *value) int gpio_write(const struct gpio *gpio, unsigned int value) { int res; - unsigned char mask; + unsigned char mask = gpio->ftdi_dev->status_mask; if(NULL == gpio) { return EXIT_FAILURE; diff --git a/src/main.c b/src/main.c index d4950bc..6dcdc34 100644 --- a/src/main.c +++ b/src/main.c @@ -31,7 +31,7 @@ static const struct gpio gpio_2 = { .ftdi_dev = &ftdi_obj, }; -int main(int argc, char *argv[]) +int main(void) { int res, cnt; unsigned int value;