1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
https://gitlab.xiph.org/xiph/rnnoise/-/merge_requests/3
From 027d4dae07f6968e63db179b2e4bbe69b0a0da40 Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Tue, 22 Nov 2022 02:59:20 +0000
Subject: [PATCH 1/2] m4: fix -Wstrict-protoypes
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]
```
Bug: https://bugs.gentoo.org/879709
Signed-off-by: Sam James <sam@gentoo.org>
--- a/m4/attributes.m4
+++ b/m4/attributes.m4
@@ -39,7 +39,7 @@ AC_DEFUN([CC_CHECK_CFLAGS_SILENT], [
AC_CACHE_VAL(AS_TR_SH([cc_cv_cflags_$1]),
[ac_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $1"
- AC_LINK_IFELSE([AC_LANG_SOURCE([int main() { return 0; }])],
+ AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return 0; }])],
[eval "AS_TR_SH([cc_cv_cflags_$1])='yes'"],
[eval "AS_TR_SH([cc_cv_cflags_$1])='no'"])
CFLAGS="$ac_save_CFLAGS"
@@ -89,7 +89,7 @@ AC_DEFUN([CC_CHECK_LDFLAGS], [
AS_TR_SH([cc_cv_ldflags_$1]),
[ac_save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $1"
- AC_LINK_IFELSE([AC_LANG_SOURCE([int main() { return 1; }])],
+ AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return 1; }])],
[eval "AS_TR_SH([cc_cv_ldflags_$1])='yes'"],
[eval "AS_TR_SH([cc_cv_ldflags_$1])="])
LDFLAGS="$ac_save_LDFLAGS"
@@ -165,16 +165,16 @@ AC_DEFUN([CC_CHECK_ATTRIBUTE], [
AC_DEFUN([CC_ATTRIBUTE_CONSTRUCTOR], [
CC_CHECK_ATTRIBUTE(
[constructor],,
- [extern void foo();
- void __attribute__((constructor)) ctor() { foo(); }],
+ [extern void foo(void);
+ void __attribute__((constructor)) ctor(void) { foo(); }],
[$1], [$2])
])
AC_DEFUN([CC_ATTRIBUTE_DESTRUCTOR], [
CC_CHECK_ATTRIBUTE(
[destructor],,
- [extern void foo();
- void __attribute__((destructor)) dtor() { foo(); }],
+ [extern void foo(void);
+ void __attribute__((destructor)) dtor(void) { foo(); }],
[$1], [$2])
])
@@ -195,7 +195,7 @@ AC_DEFUN([CC_ATTRIBUTE_FORMAT_ARG], [
AC_DEFUN([CC_ATTRIBUTE_VISIBILITY], [
CC_CHECK_ATTRIBUTE(
[visibility_$1], [visibility("$1")],
- [void __attribute__((visibility("$1"))) $1_function() { }],
+ [void __attribute__((visibility("$1"))) $1_function(void) { }],
[$2], [$3])
])
@@ -306,7 +306,7 @@ AC_DEFUN([CC_ATTRIBUTE_ALIGNED], [
CFLAGS="$CFLAGS $cc_cv_werror"
for cc_attribute_align_try in 64 32 16 8 4 2; do
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
- int main() {
+ int main(void) {
static char c __attribute__ ((aligned($cc_attribute_align_try))) = 0;
return c;
}])], [cc_cv_attribute_aligned=$cc_attribute_align_try; break])
GitLab
From a1a2194784443e55ad7b194a8d82860a8a25e1a2 Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Tue, 22 Nov 2022 03:30:17 +0000
Subject: [PATCH 2/2] Fix -Wstrict-prototypes
In preparation for C23.
Signed-off-by: Sam James <sam@gentoo.org>
--- a/include/rnnoise.h
+++ b/include/rnnoise.h
@@ -54,12 +54,12 @@ typedef struct RNNModel RNNModel;
/**
* Return the size of DenoiseState
*/
-RNNOISE_EXPORT int rnnoise_get_size();
+RNNOISE_EXPORT int rnnoise_get_size(void);
/**
* Return the number of samples processed by rnnoise_process_frame at a time
*/
-RNNOISE_EXPORT int rnnoise_get_frame_size();
+RNNOISE_EXPORT int rnnoise_get_frame_size(void);
/**
* Initializes a pre-allocated DenoiseState
--- a/src/denoise.c
+++ b/src/denoise.c
@@ -165,7 +165,7 @@ void interp_band_gain(float *g, const float *bandE) {
CommonState common;
-static void check_init() {
+static void check_init(void) {
int i;
if (common.init) return;
common.kfft = opus_fft_alloc_twiddles(2*FRAME_SIZE, NULL, NULL, NULL, 0);
@@ -253,11 +253,11 @@ static void apply_window(float *x) {
}
}
-int rnnoise_get_size() {
+int rnnoise_get_size(void) {
return sizeof(DenoiseState);
}
-int rnnoise_get_frame_size() {
+int rnnoise_get_frame_size(void) {
return FRAME_SIZE;
}
GitLab
|