From 7d1db093bc3af0d4252bf7c613c8d2a8d7d935b4 Mon Sep 17 00:00:00 2001 From: Johnny Richard Date: Fri, 14 Apr 2023 21:23:49 +0200 Subject: build: Enable warning and debug CFLAGS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After enabling the warning flags, the compiler was firing the following warnings: warning: implicit declaration of function ‘strdup’; did you mean ‘strcmp’? [-Wimplicit-function-declaration] token->value = strdup("("); ^~~~~~ strcmp warning: assignment to ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion] token->value = strdup("("); ^ In order to fix these warnings above, I have decided to replace *strdup* and *strndup* by *strcpy* and *strncpy* functions. Signed-off-by: Johnny Richard --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 2cd62a2..f2aa236 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ TARGET := pipac SRC_DIR := src BUILD_DIR := build +CFLAGS := -Wall -Wextra -pedantic -std=c11 -ggdb SRCS := $(wildcard $(SRC_DIR)/*.c) OBJS := $(patsubst $(SRC_DIR)/%.c, $(BUILD_DIR)/%.o, $(SRCS)) @@ -9,7 +10,7 @@ OBJS := $(patsubst $(SRC_DIR)/%.c, $(BUILD_DIR)/%.o, $(SRCS)) all: $(TARGET) $(TARGET): $(BUILD_DIR) $(OBJS) - $(CC) $(OBJS) -o $(TARGET) $(CFLAGS) + $(CC) $(CFLAGS) $(OBJS) -o $(TARGET) $(BUILD_DIR): @mkdir -p $@ -- cgit v1.2.3