Add warnings

This commit is contained in:
Aoran Zeng 2024-12-27 16:57:41 +08:00
parent 1ab8b7c8e5
commit 88141b67fd
No known key found for this signature in database
GPG Key ID: 8F8BA8488E10ED98
2 changed files with 10 additions and 6 deletions

View File

@ -6,10 +6,10 @@
# Contributors : Yangmoooo <yangmoooo@outlook.com> # Contributors : Yangmoooo <yangmoooo@outlook.com>
# | # |
# Created On : <2023-08-28> # Created On : <2023-08-28>
# Last Modified : <2024-12-14> # Last Modified : <2024-12-27>
# -------------------------------------------------------------- # --------------------------------------------------------------
CFLAGS = -Iinclude -Ilib # -Wall CFLAGS += -Iinclude -Ilib # -Wall
# 只有Windows会定义该变量 # 只有Windows会定义该变量
ifeq ($(OS), Windows_NT) ifeq ($(OS), Windows_NT)
@ -22,13 +22,17 @@ ifeq ($(shell uname), Linux)
CFLAGS += -static CFLAGS += -static
endif 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 Target = chsrc
CI_Build_Name = chsrc CI_Build_Name = chsrc
#======================= #=======================
all: 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) @echo; echo Compile done using \'$(CC)\' $(CFLAGS)
CI: all CI: all

View File

@ -561,7 +561,7 @@ get_max_ele_idx_in_dbl_ary (double *array, int size)
void void
measure_speed_for_every_source (Source_t sources[], int size, double speed_records[]) 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; /* 测速了几个 */ int get_measured_n = 0; /* 测速了几个 */
char *measure_msgs[size]; char *measure_msgs[size];
@ -587,7 +587,7 @@ measure_speed_for_every_source (Source_t sources[], int size, double speed_recor
speed = 0; speed = 0;
speed_records[i] = speed; speed_records[i] = speed;
get_measured[i] = false; // get_measured[i] = false;
measure_msgs[i] = NULL; measure_msgs[i] = NULL;
} }
@ -613,7 +613,7 @@ measure_speed_for_every_source (Source_t sources[], int size, double speed_recor
/* 不测速的 Provider */ /* 不测速的 Provider */
speed = 0; speed = 0;
} }
get_measured[i] = false; // get_measured[i] = false;
speed_records[i] = speed; speed_records[i] = speed;
const char *msg = CliOpt_InEnglish ? provider->abbr : provider->name; const char *msg = CliOpt_InEnglish ? provider->abbr : provider->name;