curl/src
Viktor Szakats 3829759bd0
build: enable missing OpenSSF-recommended warnings, with fixes
https://best.openssf.org/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++.html
as of 2023-11-29 [1].

Enable new recommended warnings (except `-Wsign-conversion`):

- enable `-Wformat=2` for clang (in both cmake and autotools).
- add `CURL_PRINTF()` internal attribute and mark functions accepting
  printf arguments with it. This is a copy of existing
  `CURL_TEMP_PRINTF()` but using `__printf__` to make it compatible
  with redefinting the `printf` symbol:
  https://gcc.gnu.org/onlinedocs/gcc-3.0.4/gcc_5.html#SEC94
- fix `CURL_PRINTF()` and existing `CURL_TEMP_PRINTF()` for
  mingw-w64 and enable it on this platform.
- enable `-Wimplicit-fallthrough`.
- enable `-Wtrampolines`.
- add `-Wsign-conversion` commented with a FIXME.
- cmake: enable `-pedantic-errors` the way we do it with autotools.
  Follow-up to d5c0351055 #2747
- lib/curl_trc.h: use `CURL_FORMAT()`, this also fixes it to enable format
  checks. Previously it was always disabled due to the internal `printf`
  macro.

Fix them:

- fix bug where an `set_ipv6_v6only()` call was missed in builds with
  `--disable-verbose` / `CURL_DISABLE_VERBOSE_STRINGS=ON`.
- add internal `FALLTHROUGH()` macro.
- replace obsolete fall-through comments with `FALLTHROUGH()`.
- fix fallthrough markups: Delete redundant ones (showing up as
  warnings in most cases). Add missing ones. Fix indentation.
- silence `-Wformat-nonliteral` warnings with llvm/clang.
- fix one `-Wformat-nonliteral` warning.
- fix new `-Wformat` and `-Wformat-security` warnings.
- fix `CURL_FORMAT_SOCKET_T` value for mingw-w64. Also move its
  definition to `lib/curl_setup.h` allowing use in `tests/server`.
- lib: fix two wrongly passed string arguments in log outputs.
  Co-authored-by: Jay Satiro
- fix new `-Wformat` warnings on mingw-w64.

[1] 56c0fde389/docs/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C%2B%2B.md

Closes #12489
2023-12-16 13:12:37 +00:00
..
.checksrc tool: use our own stderr variable 2023-09-28 10:50:56 +00:00
.gitignore
CMakeLists.txt base64: also build for curl 2023-10-04 23:22:16 +02:00
curl.rc curl.rc: switch out the copyright symbol for plain ASCII 2023-11-26 18:42:02 -05:00
Makefile.am autotools: accept linker flags via CURL_LDFLAGS_{LIB,BIN} 2023-11-14 13:39:34 +00:00
Makefile.inc curl: move IPFS code into src/tool_ipfs.[ch] 2023-11-07 07:42:28 +01:00
Makefile.mk Makefile.mk: drop Windows support 2023-12-16 13:12:22 +00:00
mkhelp.pl src/mkhelp: make generated code pass checksrc 2023-09-26 22:09:21 +00:00
slist_wc.c
slist_wc.h
tool_binmode.c
tool_binmode.h
tool_bname.c
tool_bname.h
tool_cb_dbg.c build: enable missing OpenSSF-recommended warnings, with fixes 2023-12-16 13:12:37 +00:00
tool_cb_dbg.h
tool_cb_hdr.c windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_cb_hdr.h
tool_cb_prg.c build: enable missing OpenSSF-recommended warnings, with fixes 2023-12-16 13:12:37 +00:00
tool_cb_prg.h
tool_cb_rea.c windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_cb_rea.h
tool_cb_see.c build: delete support bits for obsolete Windows compilers 2023-11-06 22:00:10 +00:00
tool_cb_see.h windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_cb_wrt.c windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_cb_wrt.h
tool_cfgable.c curl: add support for the IPFS protocols: 2023-09-23 11:02:10 +02:00
tool_cfgable.h curl: add support for the IPFS protocols: 2023-09-23 11:02:10 +02:00
tool_dirhie.c windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_dirhie.h tool: use errorf() for error output 2023-06-01 08:19:11 +02:00
tool_doswin.c windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_doswin.h windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_easysrc.c build: enable missing OpenSSF-recommended warnings, with fixes 2023-12-16 13:12:37 +00:00
tool_easysrc.h build: enable missing OpenSSF-recommended warnings, with fixes 2023-12-16 13:12:37 +00:00
tool_filetime.c windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_filetime.h windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_findfile.c windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_findfile.h windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_formparse.c build: enable missing OpenSSF-recommended warnings, with fixes 2023-12-16 13:12:37 +00:00
tool_formparse.h
tool_getparam.c build: enable missing OpenSSF-recommended warnings, with fixes 2023-12-16 13:12:37 +00:00
tool_getparam.h tool: add "variable" support 2023-07-31 11:51:34 +02:00
tool_getpass.c windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_getpass.h
tool_help.c curl: show ipfs and ipns as supported "protocols" 2023-12-15 14:03:44 +01:00
tool_help.h curl: add support for the IPFS protocols: 2023-09-23 11:02:10 +02:00
tool_helpers.c tool: add "variable" support 2023-07-31 11:51:34 +02:00
tool_helpers.h
tool_hugehelp.c.cvs
tool_hugehelp.h
tool_ipfs.c build: enable missing OpenSSF-recommended warnings, with fixes 2023-12-16 13:12:37 +00:00
tool_ipfs.h curl: move IPFS code into src/tool_ipfs.[ch] 2023-11-07 07:42:28 +01:00
tool_libinfo.c curl: add support for the IPFS protocols: 2023-09-23 11:02:10 +02:00
tool_libinfo.h curl: add support for the IPFS protocols: 2023-09-23 11:02:10 +02:00
tool_listhelp.c tool_listhelp: regenerated 2023-09-24 00:01:47 +02:00
tool_main.c windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_main.h tool: use our own stderr variable 2023-09-28 10:50:56 +00:00
tool_msgs.c build: enable missing OpenSSF-recommended warnings, with fixes 2023-12-16 13:12:37 +00:00
tool_msgs.h build: enable missing OpenSSF-recommended warnings, with fixes 2023-12-16 13:12:37 +00:00
tool_operate.c windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_operate.h lib: fix comment typos 2023-11-23 12:35:59 +01:00
tool_operhlp.c windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_operhlp.h
tool_paramhlp.c build: enable missing OpenSSF-recommended warnings, with fixes 2023-12-16 13:12:37 +00:00
tool_paramhlp.h
tool_parsecfg.c test459: fix for parallel runs 2023-11-28 14:23:06 +01:00
tool_parsecfg.h
tool_progress.c tool: use our own stderr variable 2023-09-28 10:50:56 +00:00
tool_progress.h
tool_sdecls.h windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_setopt.c build: enable missing OpenSSF-recommended warnings, with fixes 2023-12-16 13:12:37 +00:00
tool_setopt.h tool_setopt: remove unused function tool_setopt_flags 2023-09-26 17:55:11 -07:00
tool_setup.h windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_sleep.c windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_sleep.h
tool_stderr.c tool: use our own stderr variable 2023-09-28 10:50:56 +00:00
tool_stderr.h tool: use errorf() for error output 2023-06-01 08:19:11 +02:00
tool_strdup.c
tool_strdup.h
tool_urlglob.c build: enable missing OpenSSF-recommended warnings, with fixes 2023-12-16 13:12:37 +00:00
tool_urlglob.h tool_urlglob: use curl_off_t instead of longs 2023-05-31 08:14:41 +02:00
tool_util.c windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_util.h
tool_version.h
tool_vms.c
tool_vms.h
tool_writeout_json.c tool_writeout_json: fix JSON encoding of non-ascii bytes 2023-12-01 10:39:13 +01:00
tool_writeout_json.h tool: add "variable" support 2023-07-31 11:51:34 +02:00
tool_writeout.c tool: use our own stderr variable 2023-09-28 10:50:56 +00:00
tool_writeout.h lib: add CURLINFO_CONN_ID and CURLINFO_XFER_ID 2023-06-12 23:53:00 +02:00
tool_xattr.c build: add more picky warnings and fix them 2023-11-21 16:35:42 +00:00
tool_xattr.h
var.c misc: fix -Walloc-size warnings 2023-11-11 23:35:47 +01:00
var.h tidy-up: mostly whitespace nits 2023-08-31 23:02:10 +00:00