From cc4b9c8af3c881585223ced8274bcf425470313f Mon Sep 17 00:00:00 2001 From: LoRd_MuldeR Date: Tue, 20 Sep 2022 21:53:57 +0200 Subject: [PATCH] Enable the "-pedantic" option for GCC + fixed a few warnings. --- Makefile | 11 +++++++++-- frontend/src/test_data.c | 4 ++++ libslunkcrypt/src/slunkcrypt.c | 4 ++-- libslunkcrypt/src/version.h | 2 +- mk-release.sh | 5 +---- 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 84bf675..d5a7137 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,8 @@ STRIP ?= 0 CPU ?= 0 THREAD ?= 1 +$(info Options: DEBUG=$(DEBUG), NALYZE=$(NALYZE), ASAN=$(ASAN), STATIC=$(STATIC), FLTO=$(FLTO), FPGO=$(FPGO), STRIP=$(STRIP), CPU=$(CPU), THREAD=$(THREAD)) + # --------------------------------------------------------------------------- # Directories # --------------------------------------------------------------------------- @@ -25,7 +27,7 @@ SUBDIR_LIB := libslunkcrypt CONFIG = LDFLGS = -lpthread -CFLAGS = -I$(SUBDIR_LIB)/include -std=gnu99 -Wall +CFLAGS = -I$(SUBDIR_LIB)/include -std=gnu99 -Wall -pedantic ifneq (,$(firstword $(filter 32 64,$(CPU)))) CFLAGS += -m$(firstword $(CPU)) @@ -61,7 +63,12 @@ ifneq ($(NALYZE),0) CFLAGS += -fanalyzer endif -MACHINE := $(shell $(CC) -dumpmachine || echo unknown) +MACHINE := $(strip $(shell $(CC) -dumpmachine)) +ifeq (,$(MACHINE)) + $(error Failed to determine target machine, please check CC is working!) +else + $(info Target machine type: $(MACHINE)) +endif ifneq (,$(firstword $(filter %mingw32 %-windows-gnu %-cygwin %-cygnus,$(MACHINE)))) SUFFIX := .exe diff --git a/frontend/src/test_data.c b/frontend/src/test_data.c index 23e2d7c..27d243e 100644 --- a/frontend/src/test_data.c +++ b/frontend/src/test_data.c @@ -5,6 +5,10 @@ #include "test_data.h" +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Woverlength-strings" +#endif + // ========================================================================== // Test #1 // ========================================================================== diff --git a/libslunkcrypt/src/slunkcrypt.c b/libslunkcrypt/src/slunkcrypt.c index 7fa8383..2cc5a35 100644 --- a/libslunkcrypt/src/slunkcrypt.c +++ b/libslunkcrypt/src/slunkcrypt.c @@ -186,9 +186,9 @@ static int initialize_state(crypt_data_t *const data, const size_t thread_count, CHECK_ABORTED(); } - /* initialize up thread state */ + /* initialize thread state */ data->thread_data[0].reverse_mode = reverse_mode; - data->thread_data[0].wheel = data->wheel; + data->thread_data[0].wheel = (const uint8_t(*)[256]) data->wheel; data->thread_data[0].index_off = 0U; random_seed(&data->thread_data[0].random, nonce, 256U, passwd, passwd_len); for (i = 1U; i < thread_count; ++i) diff --git a/libslunkcrypt/src/version.h b/libslunkcrypt/src/version.h index d9c8c2c..d877711 100644 --- a/libslunkcrypt/src/version.h +++ b/libslunkcrypt/src/version.h @@ -8,6 +8,6 @@ #define LIB_VERSION_MAJOR 1 #define LIB_VERSION_MINOR 2 -#define LIB_VERSION_PATCH 0 +#define LIB_VERSION_PATCH 1 #endif diff --git a/mk-release.sh b/mk-release.sh index 62f53c3..f77b570 100755 --- a/mk-release.sh +++ b/mk-release.sh @@ -5,10 +5,7 @@ cd -- "$(dirname -- "${BASH_SOURCE[0]}")" function mk_slunk() { local command="make -B CC=/usr/local/musl/${1}/bin/musl-gcc STATIC=1 STRIP=1 FLTO=1" - if [ ! -z "${2}" ]; then - command="${command} ${2}" - fi - $BASH -x -c "${command}" + $BASH -x -c "${command}${2:+ ${2}}" cp -vf "frontend/bin/slunkcrypt" "out/slunkcrypt-${1}" }