Enable pedantic warnings (#371)

* Enable pedantic warnings

* Make same change in other places

* Disable some warnings in java bindings
This commit is contained in:
Justin Traglia 2023-10-10 07:21:14 -05:00 committed by GitHub
parent a1d0380305
commit 456c3d8fab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 12 additions and 12 deletions

View File

@ -42,7 +42,7 @@ FIELD_ELEMENTS_PER_BLOB ?= 4096
INCLUDE_DIRS = ../../src ../../blst/bindings
TARGETS = ckzg.c ../../src/c_kzg_4844.c ../../blst/$(BLST_OBJ)
CFLAGS += -O2 -Wall -Wextra -shared
CFLAGS += -O2 -Wall -Wextra -Wpedantic -shared
CFLAGS += -DFIELD_ELEMENTS_PER_BLOB=$(FIELD_ELEMENTS_PER_BLOB)
CFLAGS += ${addprefix -I,${INCLUDE_DIRS}}
BLST_BUILDSCRIPT_FLAGS += -D__BLST_PORTABLE__

View File

@ -61,7 +61,7 @@ all: build test benchmark
.PHONY: build
build:
mkdir -p ${LIBRARY_FOLDER}
${CLANG_EXECUTABLE} ${CC_FLAGS} ${CLANG_FLAGS} ${OPTIMIZATION_LEVEL} -Wall -Wno-missing-braces ${addprefix -I,${INCLUDE_DIRS}} -I"${JAVA_HOME}/include" -I"${JAVA_HOME}/include/${JNI_INCLUDE_FOLDER}" -DFIELD_ELEMENTS_PER_BLOB=${FIELD_ELEMENTS_PER_BLOB} -o ${LIBRARY_FOLDER}/${LIBRARY_RESOURCE} ${TARGETS}
${CLANG_EXECUTABLE} ${CC_FLAGS} ${CLANG_FLAGS} ${OPTIMIZATION_LEVEL} -Wall -Wextra -Wpedantic -Werror -Wno-missing-braces -Wno-unused-parameter -Wno-format ${addprefix -I,${INCLUDE_DIRS}} -I"${JAVA_HOME}/include" -I"${JAVA_HOME}/include/${JNI_INCLUDE_FOLDER}" -DFIELD_ELEMENTS_PER_BLOB=${FIELD_ELEMENTS_PER_BLOB} -o ${LIBRARY_FOLDER}/${LIBRARY_RESOURCE} ${TARGETS}
.PHONY: test
test:

View File

@ -7,7 +7,7 @@ static const char *TRUSTED_SETUP_NOT_LOADED = "Trusted Setup is not loaded.";
KZGSettings *settings;
void reset_trusted_setup()
void reset_trusted_setup(void)
{
if (settings)
{

View File

@ -7,7 +7,7 @@ CC = clang
FIELD_ELEMENTS_PER_BLOB ?= 4096
CFLAGS += -I../inc
CFLAGS += -Wall -Wextra -Werror -O0
CFLAGS += -Wall -Wextra -Wpedantic -Werror -O0
CFLAGS += -DFIELD_ELEMENTS_PER_BLOB=$(FIELD_ELEMENTS_PER_BLOB)
CFLAGS += -g -fsanitize=fuzzer

View File

@ -25,7 +25,7 @@ FIELD_ELEMENTS_PER_BLOB ?= 4096
# The base compiler flags. More can be added on command line.
CFLAGS += -I../inc
CFLAGS += -DFIELD_ELEMENTS_PER_BLOB=$(FIELD_ELEMENTS_PER_BLOB)
CFLAGS += -O2 -Wall -Wextra
CFLAGS += -O2 -Wall -Wextra -Wpedantic
# Cross-platform compilation settings.
ifeq ($(PLATFORM),Windows)

View File

@ -780,20 +780,20 @@ static void test_reverse_bits__succeeds_round_trip(void) {
}
static void test_reverse_bits__succeeds_all_bits_are_zero(void) {
uint32_t original = 0b00000000000000000000000000000000;
uint32_t reversed = 0b00000000000000000000000000000000;
uint32_t original = 0;
uint32_t reversed = 0;
ASSERT_EQUALS(reverse_bits(original), reversed);
}
static void test_reverse_bits__succeeds_some_bits_are_one(void) {
uint32_t original = 0b10101000011111100000000000000010;
uint32_t reversed = 0b01000000000000000111111000010101;
uint32_t original = 2826829826;
uint32_t reversed = 1073774101;
ASSERT_EQUALS(reverse_bits(original), reversed);
}
static void test_reverse_bits__succeeds_all_bits_are_one(void) {
uint32_t original = 0b11111111111111111111111111111111;
uint32_t reversed = 0b11111111111111111111111111111111;
uint32_t original = 4294967295;
uint32_t reversed = 4294967295;
ASSERT_EQUALS(reverse_bits(original), reversed);
}

View File

@ -71,7 +71,7 @@ const char* tt_current_expression = NULL;
const char* tt_current_file = NULL;
int tt_current_line = 0;
void tt_execute(const char* name, void (*test_function)())
void tt_execute(const char* name, void (*test_function)(void))
{
tt_current_test_failed = 0;
test_function();