Mailing List Archive

[Bug 3053] New: local_scan - C23 will not support passing arguments to a function without a prototype
https://bugs.exim.org/show_bug.cgi?id=3053

Bug ID: 3053
Summary: local_scan - C23 will not support passing arguments to
a function without a prototype
Product: Exim
Version: 4.97
Hardware: x86
OS: Linux
Status: NEW
Severity: bug
Priority: medium
Component: Unfiled
Assignee: unallocated@exim.org
Reporter: exim@aitchison.me.uk
CC: exim-dev@lists.exim.org

clang, from version 15, warns that our local_scan function call will break C23.
GCCv13 and clang-18 both abort when compiling readconf.c with option
'--std=c23'
(this is not the default language version fo either compiler).




# clang-15 -Wno-dangling-else -Wno-format -Wno-format-extra-args
-Wno-format-insufficient-args -Wno-format-invalid-specifier
-Wno-misleading-indentation -Wno-missing-field-initializers -c readconf.c
readconf.c:2359:7: warning: passing arguments to a function without a prototype
is deprecated in all versions of C and is not supported in C2x
[-Wdeprecated-non-prototype]
fn(name, s, 0);
^
readconf.c:2700:13: warning: passing arguments to a function without a
prototype is deprecated in all versions of C and is not supported in C2x
[-Wdeprecated-non-prototype]
ol->v.fn(name, NULL, no_labels ? opt_fn_print :
opt_fn_print|opt_fn_print_label);
^
2 warnings generated.
eximtest@warden:~/git/Exim/exim/src/build-Linux-x86_64$




clang-18 --std=c23 -Wno-dangling-else -Wno-format -Wno-format-extra-args
-Wno-format-insufficient-args -Wno-format-invalid-specifier
-Wno-misleading-indentation -Wno-missing-field-initializers -c readconf.c
readconf.c:329:57: error: incompatible function pointer types initializing
'void (*)(void)' with an expression of type 'void (*)(const uschar *, const
uschar *, unsigned int)' (aka 'void (*)(const unsigned char *, const unsigned
char *, unsigned int)') [-Wincompatible-function-pointer-types]
329 | { "smtp_receive_timeout", opt_func, {.fn =
&fn_smtp_receive_timeout} },
|
^~~~~~~~~~~~~~~~~~~~~~~~
readconf.c:2359:8: error: too many arguments to function call, expected 0, have
3
2359 | fn(name, s, 0);
| ~~ ^~~~~~~~~~
readconf.c:2700:14: error: too many arguments to function call, expected 0,
have 3
2700 | ol->v.fn(name, NULL, no_labels ? opt_fn_print :
opt_fn_print|opt_fn_print_label);
| ~~~~~~~~
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 errors generated.


gcc-13 --std=c2x -Wno-dangling-else -Wno-format -Wno-format-extra-args
-Wno-misleading-indentation -Wno-missing-field-initializers -c readconf.c
readconf.c:329:57: warning: initialization of ‘void (*)(void)’ from
incompatible pointer type ‘void (*)(const uschar *, const uschar *, unsigned
int)’ {aka ‘void (*)(const unsigned char *, const unsigned char *, unsigned
int)’} [-Wincompatible-pointer-types]
329 | { "smtp_receive_timeout", opt_func, {.fn =
&fn_smtp_receive_timeout} },
| ^
readconf.c:329:57: note: (near initialization for
‘optionlist_config[200].v.fn’)
readconf.c: In function ‘readconf_handle_option’:
readconf.c:2359:5: error: too many arguments to function ‘fn’
2359 | fn(name, s, 0);
| ^~
readconf.c: In function ‘print_ol’:
readconf.c:2700:5: error: too many arguments to function ‘ol->v.fn’
2700 | ol->v.fn(name, NULL, no_labels ? opt_fn_print :
opt_fn_print|opt_fn_print_label);
| ^~

--
You are receiving this mail because:
You are on the CC list for the bug.

--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-dev.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-dev-unsubscribe@lists.exim.org
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/