OpenIDC / cjose

C library implementing the Javascript Object Signing and Encryption (JOSE)
MIT License
16 stars 6 forks source link

Fix compilation errors caused by function declarations without parameters #23

Closed ReVe1uv closed 2 months ago

ReVe1uv commented 2 months ago

This commit addresses the following compilation errors:

This change resolves the compilation errors when building with strict prototype checking (-Wstrict-prototypes).

[ 1871s] In file included from util.c:10: [ 1871s] ../include/cjose/util.h:112:33: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] [ 1871s] 112 | cjose_alloc_fn_t cjose_get_alloc(); [ 1871s] | ^ [ 1871s] | void [ 1871s] ../include/cjose/util.h:122:35: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] [ 1871s] 122 | cjose_alloc3_fn_t cjose_get_alloc3(); [ 1871s] | ^ [ 1871s] | void [ 1871s] ../include/cjose/util.h:130:37: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] [ 1871s] 130 | cjose_realloc_fn_t cjose_get_realloc(); [ 1871s] | ^ [ 1871s] | void [ 1871s] ../include/cjose/util.h:140:39: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] [ 1871s] 140 | cjose_realloc3_fn_t cjose_get_realloc3(); [ 1871s] | ^ [ 1871s] | void [ 1871s] ../include/cjose/util.h:148:37: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] [ 1871s] 148 | cjose_dealloc_fn_t cjose_get_dealloc(); [ 1871s] | ^ [ 1871s] | void [ 1871s] ../include/cjose/util.h:158:39: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] [ 1871s] 158 | cjose_dealloc3_fn_t cjose_get_dealloc3(); [ 1871s] | ^ [ 1871s] | void [ 1871s] util.c:49:31: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] [ 1871s] 49 | static void cjose_apply_allocs() [ 1871s] | ^ [ 1871s] | void [ 1871s] util.c:86:33: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] [ 1871s] 86 | cjose_alloc_fn_t cjose_get_alloc() { return (!_alloc) ? malloc : _alloc; } [ 1871s] | ^ [ 1871s] | void [ 1871s] util.c:87:35: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] [ 1871s] 87 | cjose_alloc3_fn_t cjose_get_alloc3() { return (!_alloc3) ? cjose_alloc3_default : _alloc3; } [ 1871s] | ^ [ 1871s] | void [ 1871s] util.c:89:37: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] [ 1871s] 89 | cjose_realloc_fn_t cjose_get_realloc() { return (!_realloc) ? realloc : _realloc; } [ 1871s] | ^ [ 1871s] | void [ 1871s] util.c:90:39: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] [ 1871s] 90 | cjose_realloc3_fn_t cjose_get_realloc3() { return (!_realloc3) ? cjose_realloc3_default : _realloc3; } [ 1871s] | ^ [ 1871s] | void [ 1871s] util.c:92:37: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] [ 1871s] 92 | cjose_dealloc_fn_t cjose_get_dealloc() { return (!_dealloc) ? free : _dealloc; } [ 1871s] | ^ [ 1871s] | void [ 1871s] util.c:93:39: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] [ 1871s] 93 | cjose_dealloc3_fn_t cjose_get_dealloc3() { return (!_dealloc3) ? cjose_dealloc3_default : _dealloc3; } [ 1871s] | ^ [ 1871s] | void [ 1871s] 13 errors generated. [ 1871s] make[1]: *** [Makefile:510: libcjose_la-util.lo] Error 1

zandbelt commented 2 months ago

the declarations have already been adapted in https://github.com/OpenIDC/cjose/pull/19/files ; your PR seems to modify the actual function calls as well, at least in util.c which is not portable, see e.g.: https://github.com/ReVe1uv/cjose/actions/runs/10804403268/job/29969808517