Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compilation errors caused by function declarations without parameters #23

Closed
wants to merge 1 commit into from

Conversation

ReVe1uv
Copy link

@ReVe1uv ReVe1uv commented Sep 11, 2024

This commit addresses the following compilation errors:

  • Warnings were raised due to function declarations without parameters, which are deprecated in all versions of C.
  • Functions such as cjose_get_alloc(), cjose_get_alloc3(), cjose_get_realloc(), cjose_get_realloc3(), cjose_get_dealloc(), and cjose_get_dealloc3() were declared without a void parameter.
  • Modified these declarations and definitions by adding void to indicate no parameters, as required by modern C standards.

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

…ters

This commit addresses the following compilation errors:
- Warnings were raised due to function declarations without parameters, which are deprecated in all versions of C.
- Functions such as `cjose_get_alloc()`, `cjose_get_alloc3()`, `cjose_get_realloc()`, `cjose_get_realloc3()`, `cjose_get_dealloc()`, and `cjose_get_dealloc3()` were declared without a `void` parameter.
- Modified these declarations and definitions by adding `void` to indicate no parameters, as required by modern C standards.

This change resolves the compilation errors when building with strict prototype checking (-Wstrict-prototypes).
@zandbelt
Copy link
Member

zandbelt commented Sep 11, 2024

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

@zandbelt zandbelt closed this Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants