curl/src
Viktor Szakats 84338c4de2
build: add more picky warnings and fix them
Enable more picky compiler warnings. I've found these options in the
nghttp3 project when implementing the CMake quick picky warning
functionality for it [1].

`-Wunused-macros` was too noisy to keep around, but fixed a few issues
it revealed while testing.

- autotools: reflect the more precisely-versioned clang warnings.
  Follow-up to 033f8e2a08 #12324
- autotools: sync between clang and gcc the way we set `no-multichar`.
- autotools: avoid setting `-Wstrict-aliasing=3` twice.
- autotools: disable `-Wmissing-noreturn` for MSYS gcc targets [2].
  It triggers in libtool-generated stub code.

- lib/timeval: delete a redundant `!MSDOS` guard from a `WIN32` branch.

- lib/curl_setup.h: delete duplicate declaration for `fileno`.
  Added in initial commit ae1912cb0d
  (1999-12-29). This suggests this may not be needed anymore, but if
  it does, we may restore this for those specific (non-Windows) systems.
- lib: delete unused macro `FTP_BUFFER_ALLOCSIZE` since
  c1d6fe2aaa.
- lib: delete unused macro `isxdigit_ascii` since
  f65f750742.
- lib/mqtt: delete unused macro `MQTT_HEADER_LEN`.
- lib/multi: delete unused macro `SH_READ`/`SH_WRITE`.
- lib/hostip: add `noreturn` function attribute via new `CURL_NORETURN`
  macro.
- lib/mprintf: delete duplicate declaration for `Curl_dyn_vprintf`.
- lib/rand: fix `-Wunreachable-code` and related fallouts [3].
- lib/setopt: fix `-Wunreachable-code-break`.
- lib/system_win32 and lib/timeval: fix double declarations for
  `Curl_freq` and `Curl_isVistaOrGreater` in CMake UNITY mode [4].
- lib/warnless: fix double declarations in CMake UNITY mode [5].
  This was due to force-disabling the header guard of `warnless.h` to
  to reapply it to source code coming after `warnless.c` in UNITY
  builds. This reapplied declarations too, causing the warnings.
  Solved by adding a header guard for the lines that actually need
  to be reapplied.
- lib/vauth/digest: fix `-Wunreachable-code-break` [6].
- lib/vssh/libssh2: fix `-Wunreachable-code-break` and delete redundant
  block.
- lib/vtls/sectransp: fix `-Wunreachable-code-break` [7].
- lib/vtls/sectransp: suppress `-Wunreachable-code`.
  Detected in `else` branches of dynamic feature checks, with results
  known at compile-time, e.g.
  ```c
  if(SecCertificateCopySubjectSummary)  /* -> true */
  ```
  Likely fixable as a separate micro-project, but given SecureTransport
  is deprecated anyway, let's just silence these locally.
- src/tool_help: delete duplicate declaration for `helptext`.
- src/tool_xattr: fix `-Wunreachable-code`.
- tests: delete duplicate declaration for `unitfail` [8].
- tests: delete duplicate declaration for `strncasecompare`.
- tests/libtest: delete duplicate declaration for `gethostname`.
  Originally added in 687df5c8c3
  (2010-08-02).
  Got complicated later: c49e9683b8
  If there are still systems around with warnings, we may restore the
  prototype, but limited for those systems.
- tests/lib2305: delete duplicate declaration for
  `libtest_debug_config`.
- tests/h2-download: fix `-Wunreachable-code-break`.

[1] a70edb08e9/cmake/PickyWarningsC.cmake
[2] https://ci.appveyor.com/project/curlorg/curl/builds/48553586/job/3qkgjauiqla5fj45?fullLog=true#L1675
[3] https://github.com/curl/curl/actions/runs/6880886309/job/18716044703?pr=12331#step:7:72
    https://github.com/curl/curl/actions/runs/6883016087/job/18722707368?pr=12331#step:7:109
[4] https://ci.appveyor.com/project/curlorg/curl/builds/48555101/job/9g15qkrriklpf1ut#L204
[5] https://ci.appveyor.com/project/curlorg/curl/builds/48555101/job/9g15qkrriklpf1ut#L218
[6] https://github.com/curl/curl/actions/runs/6880886309/job/18716042927?pr=12331#step:7:290
[7] https://github.com/curl/curl/actions/runs/6891484996/job/18746659406?pr=12331#step:9:1193
[8] https://github.com/curl/curl/actions/runs/6882803986/job/18722082562?pr=12331#step:33:1870

Closes #12331
2023-11-21 16:35:42 +00:00
..
.checksrc tool: use our own stderr variable 2023-09-28 10:50:56 +00:00
.gitignore copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
CMakeLists.txt base64: also build for curl 2023-10-04 23:22:16 +02:00
curl.rc copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01: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 copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
mkhelp.pl src/mkhelp: make generated code pass checksrc 2023-09-26 22:09:21 +00:00
slist_wc.c copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
slist_wc.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_binmode.c copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_binmode.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_bname.c copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_bname.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_cb_dbg.c tool: use our own stderr variable 2023-09-28 10:50:56 +00:00
tool_cb_dbg.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_cb_hdr.c tool: support bold headers in Windows 2023-11-16 03:47:18 -05:00
tool_cb_hdr.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_cb_prg.c tool: use our own stderr variable 2023-09-28 10:50:56 +00:00
tool_cb_prg.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_cb_rea.c curl: count uploaded data to stop at the originally given size 2023-06-01 13:43:28 +02:00
tool_cb_rea.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_cb_see.c build: delete support bits for obsolete Windows compilers 2023-11-06 22:00:10 +00:00
tool_cb_see.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_cb_wrt.c tool_cb_wrt: fix write output for very old Windows versions 2023-10-15 14:43:11 -04:00
tool_cb_wrt.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
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 tidy-up: use more example domains 2023-09-29 18:25:56 +00:00
tool_dirhie.h tool: use errorf() for error output 2023-06-01 08:19:11 +02:00
tool_doswin.c tool: support bold headers in Windows 2023-11-16 03:47:18 -05:00
tool_doswin.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_easysrc.c tool: remove exclamation marks from error/warning messages 2023-06-01 08:19:21 +02:00
tool_easysrc.h tool_easysrc.h: correct easysrc_perform for CURL_DISABLE_LIBCURL_OPTION 2023-07-09 18:50:16 +02:00
tool_filetime.c tool_filetime: make -z work with file dates before 1970 2023-09-03 17:45:19 +02:00
tool_filetime.h tool_filetime: make -z work with file dates before 1970 2023-09-03 17:45:19 +02:00
tool_findfile.c cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
tool_findfile.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_formparse.c tool: remove exclamation marks from error/warning messages 2023-06-01 08:19:21 +02:00
tool_formparse.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_getparam.c tool_getparam: limit --rate to be smaller than number of ms 2023-10-14 23:05:54 +02:00
tool_getparam.h tool: add "variable" support 2023-07-31 11:51:34 +02:00
tool_getpass.c tool: use our own stderr variable 2023-09-28 10:50:56 +00:00
tool_getpass.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_help.c build: add more picky warnings and fix them 2023-11-21 16:35:42 +00: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 copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_hugehelp.c.cvs copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_hugehelp.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_ipfs.c IPFS: bugfixes 2023-11-11 23:28:13 +01: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 build: always revert #pragma GCC diagnostic after use 2023-11-18 11:16:32 +00:00
tool_main.h tool: use our own stderr variable 2023-09-28 10:50:56 +00:00
tool_msgs.c tool: use our own stderr variable 2023-09-28 10:50:56 +00:00
tool_msgs.h tool: use errorf() for error output 2023-06-01 08:19:11 +02:00
tool_operate.c misc: fix -Walloc-size warnings 2023-11-11 23:35:47 +01:00
tool_operate.h curl: count uploaded data to stop at the originally given size 2023-06-01 13:43:28 +02:00
tool_operhlp.c checksrc: disallow spaces before labels 2023-05-18 20:45:04 +02:00
tool_operhlp.h tool_operate: Fix error codes on bad URL & OOM 2023-02-07 08:20:04 +01:00
tool_paramhlp.c tool_paramhlp: improve str2num(): avoid unnecessary call to strlen() 2023-08-27 17:55:05 +02:00
tool_paramhlp.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_parsecfg.c tool: use our own stderr variable 2023-09-28 10:50:56 +00:00
tool_parsecfg.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_progress.c tool: use our own stderr variable 2023-09-28 10:50:56 +00:00
tool_progress.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_sdecls.h tool_cb_wrt: fix invalid unicode for windows console 2023-08-01 03:28:12 -04:00
tool_setopt.c tool_setopt: remove unused function tool_setopt_flags 2023-09-26 17:55:11 -07:00
tool_setopt.h tool_setopt: remove unused function tool_setopt_flags 2023-09-26 17:55:11 -07:00
tool_setup.h tool: support bold headers in Windows 2023-11-16 03:47:18 -05:00
tool_sleep.c copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_sleep.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
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 copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_strdup.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_urlglob.c tool_urlglob: fix build for old gcc versions 2023-10-15 14:39:42 -04:00
tool_urlglob.h tool_urlglob: use curl_off_t instead of longs 2023-05-31 08:14:41 +02:00
tool_util.c cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
tool_util.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_version.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_vms.c copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_vms.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_writeout_json.c tool: add "variable" support 2023-07-31 11:51:34 +02: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 copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
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