Enable the "-pedantic" option for GCC + fixed a few warnings.

This commit is contained in:
LoRd_MuldeR 2022-09-20 21:53:57 +02:00
parent 0c91cac7e4
commit cc4b9c8af3
Signed by: mulder
GPG Key ID: 2B5913365F57E03F
5 changed files with 17 additions and 9 deletions

View File

@ -12,6 +12,8 @@ STRIP ?= 0
CPU ?= 0 CPU ?= 0
THREAD ?= 1 THREAD ?= 1
$(info Options: DEBUG=$(DEBUG), NALYZE=$(NALYZE), ASAN=$(ASAN), STATIC=$(STATIC), FLTO=$(FLTO), FPGO=$(FPGO), STRIP=$(STRIP), CPU=$(CPU), THREAD=$(THREAD))
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Directories # Directories
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
@ -25,7 +27,7 @@ SUBDIR_LIB := libslunkcrypt
CONFIG = CONFIG =
LDFLGS = -lpthread 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)))) ifneq (,$(firstword $(filter 32 64,$(CPU))))
CFLAGS += -m$(firstword $(CPU)) CFLAGS += -m$(firstword $(CPU))
@ -61,7 +63,12 @@ ifneq ($(NALYZE),0)
CFLAGS += -fanalyzer CFLAGS += -fanalyzer
endif 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)))) ifneq (,$(firstword $(filter %mingw32 %-windows-gnu %-cygwin %-cygnus,$(MACHINE))))
SUFFIX := .exe SUFFIX := .exe

View File

@ -5,6 +5,10 @@
#include "test_data.h" #include "test_data.h"
#ifdef __GNUC__
# pragma GCC diagnostic ignored "-Woverlength-strings"
#endif
// ========================================================================== // ==========================================================================
// Test #1 // Test #1
// ========================================================================== // ==========================================================================

View File

@ -186,9 +186,9 @@ static int initialize_state(crypt_data_t *const data, const size_t thread_count,
CHECK_ABORTED(); CHECK_ABORTED();
} }
/* initialize up thread state */ /* initialize thread state */
data->thread_data[0].reverse_mode = reverse_mode; 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; data->thread_data[0].index_off = 0U;
random_seed(&data->thread_data[0].random, nonce, 256U, passwd, passwd_len); random_seed(&data->thread_data[0].random, nonce, 256U, passwd, passwd_len);
for (i = 1U; i < thread_count; ++i) for (i = 1U; i < thread_count; ++i)

View File

@ -8,6 +8,6 @@
#define LIB_VERSION_MAJOR 1 #define LIB_VERSION_MAJOR 1
#define LIB_VERSION_MINOR 2 #define LIB_VERSION_MINOR 2
#define LIB_VERSION_PATCH 0 #define LIB_VERSION_PATCH 1
#endif #endif

View File

@ -5,10 +5,7 @@ cd -- "$(dirname -- "${BASH_SOURCE[0]}")"
function mk_slunk() { function mk_slunk() {
local command="make -B CC=/usr/local/musl/${1}/bin/musl-gcc STATIC=1 STRIP=1 FLTO=1" local command="make -B CC=/usr/local/musl/${1}/bin/musl-gcc STATIC=1 STRIP=1 FLTO=1"
if [ ! -z "${2}" ]; then $BASH -x -c "${command}${2:+ ${2}}"
command="${command} ${2}"
fi
$BASH -x -c "${command}"
cp -vf "frontend/bin/slunkcrypt" "out/slunkcrypt-${1}" cp -vf "frontend/bin/slunkcrypt" "out/slunkcrypt-${1}"
} }