ethereum / c-kzg-4844

A minimal implementation of the Polynomial Commitments API for EIP-4844 and EIP-7594, written in C.
Apache License 2.0
112 stars 105 forks source link

Enable pedantic warnings #371

Closed jtraglia closed 11 months ago

jtraglia commented 11 months ago

Last week I learned that -Wall and -Wextra doesn't enable all warnings; there's -Wpedantic too.

When enabled, it had the following warnings (treated as errors):

$ make
In file included from test_c_kzg_4844.c:5:
./tinytest.h:74:56: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
   74 | void tt_execute(const char* name, void (*test_function)())
      |                                                        ^
      |                                                         void
test_c_kzg_4844.c:783:25: error: binary integer literals are a GNU extension [-Werror,-Wgnu-binary-literal]
  783 |     uint32_t original = 0b00000000000000000000000000000000;
      |                         ^
test_c_kzg_4844.c:784:25: error: binary integer literals are a GNU extension [-Werror,-Wgnu-binary-literal]
  784 |     uint32_t reversed = 0b00000000000000000000000000000000;
      |                         ^
test_c_kzg_4844.c:789:25: error: binary integer literals are a GNU extension [-Werror,-Wgnu-binary-literal]
  789 |     uint32_t original = 0b10101000011111100000000000000010;
      |                         ^
test_c_kzg_4844.c:790:25: error: binary integer literals are a GNU extension [-Werror,-Wgnu-binary-literal]
  790 |     uint32_t reversed = 0b01000000000000000111111000010101;
      |                         ^
test_c_kzg_4844.c:795:25: error: binary integer literals are a GNU extension [-Werror,-Wgnu-binary-literal]
  795 |     uint32_t original = 0b11111111111111111111111111111111;
      |                         ^
test_c_kzg_4844.c:796:25: error: binary integer literals are a GNU extension [-Werror,-Wgnu-binary-literal]
  796 |     uint32_t reversed = 0b11111111111111111111111111111111;
      |                         ^
7 errors generated.
make: *** [test_c_kzg_4844] Error 1
jtraglia commented 11 months ago

Added these options to other bindings that compile their own C code too. For the java bindings, I needed to disable some of the warnings. It seems that the Windows system has an old version of gcc which doesn't like some things.