Mailing List Archive

compiler warnings
Please take a look at all the warnings compiling Exim 4.97
under FreeBSD 12 amd64. Are they all okay?

https://pkg-status.freebsd.org/beefy6/data/124amd64-default/b1d086ef272f/logs/exim-4.97.log

...
cc appendfile.c
cc autoreply.c
cc lmtp.c
lmtp.c:244:48: warning: invalid conversion specifier 'Y' [-Wformat-invalid-specifier]
DEBUG(D_transport|D_v) debug_printf(" LMTP>> %Y", &gs);
~^
1 warning generated.
cc pipe.c
cc queuefile.c
cc smtp.c
smtp.c:629:26: warning: invalid conversion specifier 'Y' [-Wformat-invalid-specifier]
log_write(0, LOG_MAIN, "%Y", message);
~^
smtp.c:941:60: warning: format specifies type 'int' but the argument has type 'long' [-Wformat]
debug_printf("ehlo-resp record is %d seconds old\n", time(NULL) - er->time_stamp);
~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~
%ld
2 warnings generated.
cc smtp_socks.c
cc tf_maildir.c
ar cq transports.a
ranlib transports.a

cc acl.c
cc base64.c
cc child.c
cc crypt16.c
cc daemon.c
daemon.c:268:41: warning: invalid conversion specifier 'Y' [-Wformat-invalid-specifier]
LOG_MAIN, "Connection from %Y refused: too many connections",
~^
daemon.c:287:43: warning: invalid conversion specifier 'Y' [-Wformat-invalid-specifier]
LOG_MAIN, "Connection from %Y refused: load average = %.2f",
~^
daemon.c:288:7: warning: format specifies type 'double' but the argument has type 'gstring *' (aka 'struct gstring *') [-Wformat]
whofrom, (double)load_average/1000.0);
^~~~~~~
daemon.c:288:16: warning: data argument not used by format string [-Wformat-extra-args]
whofrom, (double)load_average/1000.0);
^
daemon.c:308:22: warning: invalid conversion specifier 'Y' [-Wformat-invalid-specifier]
"failed for %Y: %s", whofrom, expand_string_message);
~^
daemon.c:308:30: warning: format specifies type 'char *' but the argument has type 'gstring *' (aka 'struct gstring *') [-Wformat]
"failed for %Y: %s", whofrom, expand_string_message);
~~ ^~~~~~~
daemon.c:308:39: warning: data argument not used by format string [-Wformat-extra-args]
"failed for %Y: %s", whofrom, expand_string_message);
~~~~~~~~~~~~~~~~~~~ ^
daemon.c:318:15: warning: invalid conversion specifier 'Y' [-Wformat-invalid-specifier]
"for %Y contains non-digit: %s", whofrom, expanded);
~^
daemon.c:318:42: warning: format specifies type 'char *' but the argument has type 'gstring *' (aka 'struct gstring *') [-Wformat]
"for %Y contains non-digit: %s", whofrom, expanded);
~~ ^~~~~~~
daemon.c:318:51: warning: data argument not used by format string [-Wformat-extra-args]
"for %Y contains non-digit: %s", whofrom, expanded);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
daemon.c:356:43: warning: invalid conversion specifier 'Y' [-Wformat-invalid-specifier]
LOG_MAIN, "Connection from %Y refused: too many connections "
~^
daemon.c:405:69: warning: invalid conversion specifier 'Y' [-Wformat-invalid-specifier]
log_write(L_smtp_connection, LOG_MAIN, "SMTP connection from %Y "
~^
daemon.c:406:43: warning: format specifies type 'unsigned long' but the argument has type 'gstring *' (aka 'struct gstring *') [-Wformat]
"Ci=%lu (TCP/IP connection count = %d)", whofrom, connection_id, smtp_accept_count);
~~~ ^~~~~~~
daemon.c:406:52: warning: format specifies type 'int' but the argument has type 'uint64_t' (aka 'unsigned long') [-Wformat]
"Ci=%lu (TCP/IP connection count = %d)", whofrom, connection_id, smtp_accept_count);
~~ ^~~~~~~~~~~~~
%lu
daemon.c:406:67: warning: data argument not used by format string [-Wformat-extra-args]
"Ci=%lu (TCP/IP connection count = %d)", whofrom, connection_id, smtp_accept_count);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
daemon.c:408:69: warning: invalid conversion specifier 'Y' [-Wformat-invalid-specifier]
log_write(L_smtp_connection, LOG_MAIN, "SMTP connection from %Y "
~^
daemon.c:409:36: warning: format specifies type 'int' but the argument has type 'gstring *' (aka 'struct gstring *') [-Wformat]
"(TCP/IP connection count = %d)", whofrom, smtp_accept_count);
~~ ^~~~~~~
daemon.c:409:45: warning: data argument not used by format string [-Wformat-extra-args]
"(TCP/IP connection count = %d)", whofrom, smtp_accept_count);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
daemon.c:614:43: warning: while loop has empty body [-Wempty-body]
while (waitpid(-1, NULL, WNOHANG) > 0);
^
daemon.c:614:43: note: put the semicolon on a separate line to silence this warning
19 warnings generated.
cc dbfn.c
cc debug.c
debug.c:442:34: warning: invalid conversion specifier 'Y' [-Wformat-invalid-specifier]
debug_printf_indent(" socket: %Y\n", g);
~^
1 warning generated.
cc deliver.c
deliver.c:1281:23: warning: invalid conversion specifier 'Y' [-Wformat-invalid-specifier]
log_write(0, flags, "%Y", g);
~^
deliver.c:1354:8: warning: invalid conversion specifier 'Y' [-Wformat-invalid-specifier]
"== %Y", g);
~^
deliver.c:1425:29: warning: invalid conversion specifier 'Y' [-Wformat-invalid-specifier]
log_write(0, LOG_MAIN, "** %Y", g);
~^
3 warnings generated.
cc directory.c
cc dns.c
cc drtables.c
cc enq.c
cc exim.c
cc expand.c
expand.c:3996:47: warning: invalid conversion specifier 'Y' [-Wformat-invalid-specifier]
debug_printf_indent("prvs: hash source is '%Y'\n", hash_source);
~^
expand.c:8037:50: warning: invalid conversion specifier 'Y' [-Wformat-invalid-specifier]
DEBUG(D_expand) debug_printf_indent("yield: '%Y'\n", yield);
~^
2 warnings generated.
cc filter.c
cc filtertest.c
cc globals.c
cc dkim.c
dkim.c:292:26: warning: invalid conversion specifier 'Y' [-Wformat-invalid-specifier]
log_write(0, LOG_MAIN, "%Y", logmsg);
~^
1 warning generated.
cc dkim_transport.c
cc dnsbl.c
cc hash.c
cc header.c
header.c:113:11: warning: invalid conversion specifier 'Y' [-Wformat-invalid-specifier]
"%.100Y ...", &gs);
~~~~~^
1 warning generated.
cc host.c
cc host_address.c
cc ip.c
cc log.c
log.c:961:18: warning: invalid conversion specifier 'Y' [-Wformat-invalid-specifier]
debug_printf("%Y\n", g);
~^
1 warning generated.
cc lss.c
cc match.c
cc md5.c
cc moan.c
cc os.c
cc parse.c
cc priv.c
cc proxy.c
cc queue.c
cc rda.c
cc readconf.c
cc receive.c
receive.c:4288:32: warning: invalid conversion specifier 'Y' [-Wformat-invalid-specifier]
log_write(0, LOG_MAIN, "%Y", g);
~^
receive.c:4354:7: warning: invalid conversion specifier 'Y' [-Wformat-invalid-specifier]
"%Y", g);
~^
2 warnings generated.
cc retry.c
cc rewrite.c
cc rfc2047.c
cc regex_cache.c
cc route.c
cc search.c
cc sieve.c
cc smtp_in.c
smtp_in.c:2697:15: warning: invalid conversion specifier 'Y' [-Wformat-invalid-specifier]
smtp_printf("%Y",
~^
smtp_in.c:2752:59: warning: invalid conversion specifier 'Y' [-Wformat-invalid-specifier]
"syntax or protocol errors (last command was \"%s\", %Y)",
~^
smtp_in.c:2754:5: warning: data argument not used by format string [-Wformat-extra-args]
s_connhad_log(NULL)
^
smtp_in.c:3212:22: warning: invalid conversion specifier 'Y' [-Wformat-invalid-specifier]
smtp_printf("%s %Y\r\n", FALSE, code, g);
~^
smtp_in.c:3212:43: warning: data argument not used by format string [-Wformat-extra-args]
smtp_printf("%s %Y\r\n", FALSE, code, g);
~~~~~~~~~~~ ^
smtp_in.c:3889:60: warning: invalid conversion specifier 'Y' [-Wformat-invalid-specifier]
"syntax or protocol errors (last command was \"%s\", %Y)",
~^
smtp_in.c:3891:6: warning: data argument not used by format string [-Wformat-extra-args]
s_connhad_log(NULL)
^
7 warnings generated.
cc smtp_out.c
smtp_out.c:173:9: warning: 4 enumeration values not handled in switch: 'TFO_NOT_USED', 'TFO_ATTEMPTED_DATA', 'TFO_USED_NODATA'... [-Wswitch]
switch (tcp_out_fastopen)
^
1 warning generated.
cc spool_in.c
cc spool_out.c
cc std-crypto.c
cc store.c
cc string.c
cc tls.c
In file included from tls.c:473:
./tls-openssl.c:2407:36: warning: invalid conversion specifier 'Y' [-Wformat-invalid-specifier]
log_write(0, LOG_MAIN, "TLS ALPN (%Y) rejected", g);
~^
1 warning generated.
cc tod.c
cc transport.c
transport.c:1509:21: warning: more '%' conversions than data arguments [-Wformat-insufficient-args]
"skipping wait-%s database update\n", tpname);
~^
1 warning generated.
cc tree.c
cc verify.c
cc environment.c
cc macro.c
cc local_scan.c
cc perl.c
cc malware.c
malware.c:684:11: warning: enumeration value 'M_DUMMY' not handled in switch [-Wswitch]
switch (scanent->scancode)
^
1 warning generated.
cc mime.c
cc regex.c
cc spam.c
cc spool_mbox.c
cc arc.c
cc bmi_spam.c
cc dane.c
cc dcc.c
cc dmarc.c
cc imap_utf7.c
cc spf.c
cc utf8.c
cc xclient.c
cc version.c
cc -o exim
/usr/bin/strip exim

>>> exim binary built


--
## 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/
Re: compiler warnings [ In reply to ]
On 16/11/2023 18:11, Lena--- via Exim-dev wrote:
> lmtp.c:244:48: warning: invalid conversion specifier 'Y' [-Wformat-invalid-specifier]
> DEBUG(D_transport|D_v) debug_printf(" LMTP>> %Y", &gs);

"invalid format specifier" does not understand that printf-like functions
might support their own formats. One could argue that marking the functions
as being printf-like is the error... but it is also biting support for
"extensible format support" in the standard libraries. I'm not sure
what the right answer is, here.

Meantime, the "%Y" conversion specifie
is supported by the Exim printf-like functions. And used.
I suggest you should turn that -W "feature" of the compiler off.



-- > smtp_out.c:173:9: warning: 4 enumeration values not handled in switch: 'TFO_NOT_USED', 'TFO_ATTEMPTED_DATA', 'TFO_USED_NODATA'... [-Wswitch]
> switch (tcp_out_fastopen)

Please, tell your compiler to comle 'C' rather than some other language.
--
Cheers,
Jeremy


--
## 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/