Skip to content

Commit 9d71834

Browse files
committed
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/879707 Signed-off-by: Sam James <[email protected]>
1 parent 0a4cd79 commit 9d71834

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

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])

0 commit comments

Comments
 (0)