Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/c-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
# Doesn't work on Windows.
- name: Clang Sanitizers
if: matrix.os != 'windows-latest'
run: make sanitize
run: CC=clang make sanitize

# Run static analyzer.
# Doesn't work on Windows.
Expand Down
18 changes: 12 additions & 6 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ifeq ($(PLATFORM),Darwin)
endif

# The base compiler flags. More can be added on command line.
CFLAGS += -I. -I../inc -O2 -Werror -Wno-gnu-folding-constant
CFLAGS += -I. -I../inc -O2
# Enable a bunch of optional warnings.
CFLAGS += \
-pedantic \
Expand All @@ -43,6 +43,7 @@ CFLAGS += \
-Winit-self \
-Winline \
-Winvalid-pch \
-Wmissing-braces \
-Wmissing-declarations \
-Wmissing-field-initializers \
-Wmissing-format-attribute \
Expand Down Expand Up @@ -75,13 +76,15 @@ CFLAGS += \

# Cross-platform compilation settings.
ifeq ($(PLATFORM),Windows)
CC = gcc
CC ?= gcc
CFLAGS += -D_CRT_SECURE_NO_WARNINGS
CFLAGS += -Wno-missing-braces -Wno-format
CFLAGS += -Wno-format
else
CC = clang
CC ?= clang
CFLAGS += -fPIC
CFLAGS += -Wmissing-braces -Wformat=2
ifeq ($(CC),clang)
CFLAGS += -Werror -Wno-gnu-folding-constant -Wformat=2
endif
endif

# Settings for blst.
Expand Down Expand Up @@ -219,7 +222,10 @@ sanitize_%: blst $(SOURCE_FILES) $(HEADER_FILES)
./$@; rm $@

.PHONY: sanitize
ifeq ($(PLATFORM),Darwin)
ifneq ($(CC),clang)
sanitize:
$(error sanitize requires CC=clang)
else ifeq ($(PLATFORM),Darwin)
sanitize: \
sanitize_address \
sanitize_undefined
Expand Down
2 changes: 1 addition & 1 deletion src/common/ec.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ typedef blst_p2 g2_t; /**< Internal G2 group element type. */

/** Deserialized form of the G1 identity/infinity point. */
static const g1_t G1_IDENTITY = {
{0L, 0L, 0L, 0L, 0L, 0L}, {0L, 0L, 0L, 0L, 0L, 0L}, {0L, 0L, 0L, 0L, 0L, 0L}
{{0L, 0L, 0L, 0L, 0L, 0L}}, {{0L, 0L, 0L, 0L, 0L, 0L}}, {{0L, 0L, 0L, 0L, 0L, 0L}}
};

////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
6 changes: 3 additions & 3 deletions src/common/fr.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@ typedef blst_fr fr_t; /**< Internal Fr field element type. */
////////////////////////////////////////////////////////////////////////////////////////////////////

/** The zero field element. */
static const fr_t FR_ZERO = {0L, 0L, 0L, 0L};
static const fr_t FR_ZERO = {{0L, 0L, 0L, 0L}};

/** This is 1 in blst's `blst_fr` limb representation. Crazy but true. */
static const fr_t FR_ONE = {
0x00000001fffffffeL, 0x5884b7fa00034802L, 0x998c4fefecbc4ff5L, 0x1824b159acc5056fL
{0x00000001fffffffeL, 0x5884b7fa00034802L, 0x998c4fefecbc4ff5L, 0x1824b159acc5056fL}
};

/** This used to represent a missing element. It's an invalid value. */
static const fr_t FR_NULL = {
0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL
{0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL}
};

////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
4 changes: 2 additions & 2 deletions src/eip7594/fft.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* printf("%#018llxL,\n", a.l[i]);
*/
static const fr_t RECOVERY_SHIFT_FACTOR = {
0x0000000efffffff1L, 0x17e363d300189c0fL, 0xff9c57876f8457b0L, 0x351332208fc5a8c4L
{0x0000000efffffff1L, 0x17e363d300189c0fL, 0xff9c57876f8457b0L, 0x351332208fc5a8c4L}
};

/**
Expand All @@ -48,7 +48,7 @@ static const fr_t RECOVERY_SHIFT_FACTOR = {
* printf("%#018llxL,\n", a.l[i]);
*/
static const fr_t INV_RECOVERY_SHIFT_FACTOR = {
0xdb6db6dadb6db6dcL, 0xe6b5824adb6cc6daL, 0xf8b356e005810db9L, 0x66d0f1e660ec4796L
{0xdb6db6dadb6db6dcL, 0xe6b5824adb6cc6daL, 0xf8b356e005810db9L, 0x66d0f1e660ec4796L}
};

////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion src/setup/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
* factor changes, this constant is no longer correct.
*/
static const fr_t ROOT_OF_UNITY = {
0xa33d279ff0ccffc9L, 0x41fac79f59e91972L, 0x065d227fead1139bL, 0x71db41abda03e055L
{0xa33d279ff0ccffc9L, 0x41fac79f59e91972L, 0x065d227fead1139bL, 0x71db41abda03e055L}
};

////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
Loading