From 88141b67fd59169b65c2ebe1aeacc0bab0f8a22c Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Fri, 27 Dec 2024 16:57:41 +0800 Subject: [PATCH] Add warnings --- Makefile | 10 +++++++--- src/framework/core.c | 6 +++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index aa132af..ddcdb9c 100644 --- a/Makefile +++ b/Makefile @@ -6,10 +6,10 @@ # Contributors : Yangmoooo # | # Created On : <2023-08-28> -# Last Modified : <2024-12-14> +# Last Modified : <2024-12-27> # -------------------------------------------------------------- -CFLAGS = -Iinclude -Ilib # -Wall +CFLAGS += -Iinclude -Ilib # -Wall # 只有Windows会定义该变量 ifeq ($(OS), Windows_NT) @@ -22,13 +22,17 @@ ifeq ($(shell uname), Linux) CFLAGS += -static endif +override WARN += -Wall -Wextra -Wno-unused-variable -Wno-unused-function -Wno-missing-braces -Wno-misleading-indentation \ + -Wno-missing-field-initializers -Wno-unused-parameter -Wno-sign-compare +_C_Warning_Flags := $(WARN) + Target = chsrc CI_Build_Name = chsrc #======================= all: - @$(CC) src/chsrc-main.c $(CFLAGS) -o $(Target) + @$(CC) src/chsrc-main.c $(CFLAGS) $(_C_Warning_Flags) -o $(Target) @echo; echo Compile done using \'$(CC)\' $(CFLAGS) CI: all diff --git a/src/framework/core.c b/src/framework/core.c index cae9759..0c52cce 100644 --- a/src/framework/core.c +++ b/src/framework/core.c @@ -561,7 +561,7 @@ get_max_ele_idx_in_dbl_ary (double *array, int size) void measure_speed_for_every_source (Source_t sources[], int size, double speed_records[]) { - bool get_measured[size]; /* 是否真正执行了测速 */ + // bool get_measured[size]; /* 是否真正执行了测速 */ int get_measured_n = 0; /* 测速了几个 */ char *measure_msgs[size]; @@ -587,7 +587,7 @@ measure_speed_for_every_source (Source_t sources[], int size, double speed_recor speed = 0; speed_records[i] = speed; - get_measured[i] = false; + // get_measured[i] = false; measure_msgs[i] = NULL; } @@ -613,7 +613,7 @@ measure_speed_for_every_source (Source_t sources[], int size, double speed_recor /* 不测速的 Provider */ speed = 0; } - get_measured[i] = false; + // get_measured[i] = false; speed_records[i] = speed; const char *msg = CliOpt_InEnglish ? provider->abbr : provider->name;