Skip to content

Commit 08248d5

Browse files
thesamesamHartmnt
authored andcommitted
FIX: Add void to functions with empty parameter list
Fixes -Wstrict-protoypes in renamenoise.h, denoise.c and attributes.m4 In preparation for C23. Fixes the following error if Clang 16 is cranked up to be stricter: ``` -warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes] +error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] ``` Original merge request: https://gitlab.xiph.org/xiph/rnnoise/-/merge_requests/3 Bug: https://bugs.gentoo.org/879709 Signed-off-by: Sam James <[email protected]>
1 parent 33c29d0 commit 08248d5

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

include/renamenoise.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ typedef struct ReNameNoiseModel ReNameNoiseModel;
5454
/**
5555
* Return the size of ReNameNoiseDenoiseState
5656
*/
57-
RENAMENOISE_EXPORT int renamenoise_get_size();
57+
RENAMENOISE_EXPORT int renamenoise_get_size(void);
5858

5959
/**
6060
* Return the number of samples processed by renamenoise_process_frame at a time
6161
*/
62-
RENAMENOISE_EXPORT int renamenoise_get_frame_size();
62+
RENAMENOISE_EXPORT int renamenoise_get_frame_size(void);
6363

6464
/**
6565
* Initializes a pre-allocated ReNameNoiseDenoiseState

m4/attributes.m4

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ AC_DEFUN([CC_CHECK_CFLAGS_SILENT], [
3939
AC_CACHE_VAL(AS_TR_SH([cc_cv_cflags_$1]),
4040
[ac_save_CFLAGS="$CFLAGS"
4141
CFLAGS="$CFLAGS $1"
42-
AC_LINK_IFELSE([AC_LANG_SOURCE([int main() { return 0; }])],
42+
AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return 0; }])],
4343
[eval "AS_TR_SH([cc_cv_cflags_$1])='yes'"],
4444
[eval "AS_TR_SH([cc_cv_cflags_$1])='no'"])
4545
CFLAGS="$ac_save_CFLAGS"
@@ -89,7 +89,7 @@ AC_DEFUN([CC_CHECK_LDFLAGS], [
8989
AS_TR_SH([cc_cv_ldflags_$1]),
9090
[ac_save_LDFLAGS="$LDFLAGS"
9191
LDFLAGS="$LDFLAGS $1"
92-
AC_LINK_IFELSE([AC_LANG_SOURCE([int main() { return 1; }])],
92+
AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return 1; }])],
9393
[eval "AS_TR_SH([cc_cv_ldflags_$1])='yes'"],
9494
[eval "AS_TR_SH([cc_cv_ldflags_$1])="])
9595
LDFLAGS="$ac_save_LDFLAGS"
@@ -165,16 +165,16 @@ AC_DEFUN([CC_CHECK_ATTRIBUTE], [
165165
AC_DEFUN([CC_ATTRIBUTE_CONSTRUCTOR], [
166166
CC_CHECK_ATTRIBUTE(
167167
[constructor],,
168-
[extern void foo();
169-
void __attribute__((constructor)) ctor() { foo(); }],
168+
[extern void foo(void);
169+
void __attribute__((constructor)) ctor(void) { foo(); }],
170170
[$1], [$2])
171171
])
172172

173173
AC_DEFUN([CC_ATTRIBUTE_DESTRUCTOR], [
174174
CC_CHECK_ATTRIBUTE(
175175
[destructor],,
176-
[extern void foo();
177-
void __attribute__((destructor)) dtor() { foo(); }],
176+
[extern void foo(void);
177+
void __attribute__((destructor)) dtor(void) { foo(); }],
178178
[$1], [$2])
179179
])
180180

@@ -195,7 +195,7 @@ AC_DEFUN([CC_ATTRIBUTE_FORMAT_ARG], [
195195
AC_DEFUN([CC_ATTRIBUTE_VISIBILITY], [
196196
CC_CHECK_ATTRIBUTE(
197197
[visibility_$1], [visibility("$1")],
198-
[void __attribute__((visibility("$1"))) $1_function() { }],
198+
[void __attribute__((visibility("$1"))) $1_function(void) { }],
199199
[$2], [$3])
200200
])
201201

@@ -306,7 +306,7 @@ AC_DEFUN([CC_ATTRIBUTE_ALIGNED], [
306306
CFLAGS="$CFLAGS $cc_cv_werror"
307307
for cc_attribute_align_try in 64 32 16 8 4 2; do
308308
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
309-
int main() {
309+
int main(void) {
310310
static char c __attribute__ ((aligned($cc_attribute_align_try))) = 0;
311311
return c;
312312
}])], [cc_cv_attribute_aligned=$cc_attribute_align_try; break])

src/denoise.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ void renamenoise_interp_band_gain(float *g, const float *bandE) {
165165

166166
ReNameNoiseCommonState renamenoise_common;
167167

168-
static void renamenoise_check_init() {
168+
static void renamenoise_check_init(void) {
169169
int i;
170170
if (renamenoise_common.init) return;
171171
renamenoise_common.kfft = renamenoise_fft_alloc_twiddles(2*RENAMENOISE_FRAME_SIZE, NULL, NULL, NULL, 0);
@@ -253,11 +253,11 @@ static void renamenoise_apply_window(float *x) {
253253
}
254254
}
255255

256-
int renamenoise_get_size() {
256+
int renamenoise_get_size(void) {
257257
return sizeof(ReNameNoiseDenoiseState);
258258
}
259259

260-
int renamenoise_get_frame_size() {
260+
int renamenoise_get_frame_size(void) {
261261
return RENAMENOISE_FRAME_SIZE;
262262
}
263263

0 commit comments

Comments
 (0)