From 8b3202fac0d35915728ff60f8d6da7403713b603 Mon Sep 17 00:00:00 2001 From: Bruno Raoult Date: Wed, 17 Apr 2024 08:21:20 +0200 Subject: [PATCH] add CFLAGS -Wshadow and -funroll-loops, fix related common-test.h --- .dir-locals.el | 2 +- Makefile | 4 +++- test/common-test.h | 14 +++++++------- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.dir-locals.el b/.dir-locals.el index 957ee03..6589692 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -1,3 +1,3 @@ ((nil . ((compile-command . (concat "make -C " (vc-root-dir) - " -k -j2 testing"))))) + " -k -j4 testing"))))) diff --git a/Makefile b/Makefile index 54d7162..4ccdd46 100644 --- a/Makefile +++ b/Makefile @@ -97,12 +97,14 @@ CFLAGS += -ginline-points # inlined funcs debu #CFLAGS += -mno-tbm # release -CFLAGS += -Ofast +CFLAGS += -O3 CFLAGS += -march=native CFLAGS += -flto +CFLAGS += -funroll-loops CFLAGS += -Wall CFLAGS += -Wextra +CFLAGS += -Wshadow CFLAGS += -Wmissing-declarations CFLAGS := $(strip $(CFLAGS)) diff --git a/test/common-test.h b/test/common-test.h index abe8560..ca63679 100644 --- a/test/common-test.h +++ b/test/common-test.h @@ -412,22 +412,22 @@ struct fentest { { __LINE__, 0, NULL, NULL } }; -static int cur = -1; +static int fentest_cur = -1; static char *next_fen(uint module) { - cur++; - while (fentest[cur].fen && !(fentest[cur].modules & module)) - cur++; - return fentest[cur].fen; + fentest_cur++; + while (fentest[fentest_cur].fen && !(fentest[fentest_cur].modules & module)) + fentest_cur++; + return fentest[fentest_cur].fen; } static __unused char* cur_comment() { - return fentest[cur].comment; + return fentest[fentest_cur].comment; } static __unused int cur_line() { - return fentest[cur].line; + return fentest[fentest_cur].line; }