ridiculousfish / libdivide

Official git repository for libdivide: optimized integer division
http://libdivide.com
Other
1.09k stars 77 forks source link

error: a function declaration without a prototype is deprecated in all versions of C #105

Open thierry-FreeBSD opened 1 year ago

thierry-FreeBSD commented 1 year ago

This error is produced with recent clang (>= 15). Actually this is just a warning, but since -Werror,-Wstrict-prototype is set, it becomes an error:

FAILED: CMakeFiles/test_c99.dir/test/test_c99.c.o 
/usr/local/libexec/ccache/cc -DLIBDIVIDE_SSE2 -I/wrkdirs/usr/ports/math/libdivide/work/libdivide-5.0 -O2 -pipe  -fstack-protector-strong -fno-strict-aliasing -O2 -pipe  -fstack-protector-strong -fno-strict-aliasing  -DNDEBUG -Wall -Wextra -pedantic -Werror -fno-lax-vector-conversions -march=native -fno-vectorize -std=gnu99 -MD -MT CMakeFiles/test_c99.dir/test/test_c99.c.o -MF CMakeFiles/test_c99.dir/test/test_c99.c.o.d -o CMakeFiles/test_c99.dir/test/test_c99.c.o -c /wrkdirs/usr/ports/math/libdivide/work/libdivide-5.0/test/test_c99.c
/wrkdirs/usr/ports/math/libdivide/work/libdivide-5.0/test/test_c99.c:51:14: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
void test_u16() {
             ^
              void
/wrkdirs/usr/ports/math/libdivide/work/libdivide-5.0/test/test_c99.c:62:14: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
void test_s16() {
             ^
              void
/wrkdirs/usr/ports/math/libdivide/work/libdivide-5.0/test/test_c99.c:77:14: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
void test_u32() {
             ^
              void
/wrkdirs/usr/ports/math/libdivide/work/libdivide-5.0/test/test_c99.c:84:14: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
void test_s32() {
             ^
              void
/wrkdirs/usr/ports/math/libdivide/work/libdivide-5.0/test/test_c99.c:91:14: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
void test_u64() {
             ^
              void
/wrkdirs/usr/ports/math/libdivide/work/libdivide-5.0/test/test_c99.c:98:14: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
void test_s64() {
             ^
              void
6 errors generated.
kimwalisch commented 1 year ago

Thanks to the LLVM devs for causing useless work in downstream projects! Apparently this warning only applies to C99 through C17, from C23 on having a function declaration without a prototype is legal again (see: https://reviews.llvm.org/D122895)