curl/docs
Viktor Szakats 4497dbd9ac
clang-tidy: fixes and improvements
Fix bigger and smaller kinks in how clang-tidy is configured and used.
Sync behavior more between autotools and cmake, lib/src and tests. Bump
clang-tidy minimum version and prepare logic to allow using clang-tidy
to a fuller extent.

- move clang-tidy settings from builds to a new `.clang-tidy.yml`.
  To make it easy to see and edit checks at one place. Also to allow
  using the `--checks=` option internally to silence tests-specific
  checks. (clang-tidy does not support multiple `--check=` options via
  the command-line.)
  Use explicit `--config-file=` option to point to the configuration.
- .clang-tidy.yml: link to documentation.
- suppress `clang-diagnostic-nullability-extension` due to a false
  positive in libtests with `CURL_WERROR=ON` and `PICKY_COMPILER=OFF`.
- .clang-tidy.yml: enable `portability-*`, `misc-const-correctness`.
- drop `--quiet` clang-tidy option by default to make its working a bit
  more transparent. The extra output is minimial.
- consistently use double-dashes in clang-tidy command-line options.
  Supported by clang-tidy 9.0.0+ (2019-09-19). Before this patch single
  and double were used arbitrarily.
- src/tool_parsecfg: silence false positive `clang-analyzer-unix.Stream`.
  Seen with clang 18 + clang-tidy 19 and 20 (only with autotools.)
- INTERNALS: require clang-tidy 14.0.0+. For the `--config-file` option.
- INTERNALS: recommend clang-tidy 19.1.0+, to avoid bogus
  `clang-analyzer-valist.Uninitialized` warnings. (bug details below)

autotools:

- allow configuring the clang-tidy tool via `CLANG_TIDY` env.
  Also to use in GHA to point to a suffixed clang-tody tool.
- fix to pass CFLAGS to lib, src sources.
  (keep omitting them when using a non-clang compiler.)
- fix to pass `--warnings-as-errors=*` in quotes to avoid globbing.

cmake:

- fix to not pass an empty `-I` to clang-tidy.
- fix to pass CFLAGS (picky warnings) to clang-tidy for test sources.
  (keep omitting them when using a non-clang compiler.)
- fix to disable `clang-diagnostic-unused-function` for test sources.
  (tests have static entry points, which trigger this check when
  checking them as individidual sources.)
- fix forwarding `CURL_CLANG_TIDYFLAGS` to clang-tidy.
- force disable picky warnings when running clang-tidy with a non-clang
  compiler. To not pass these flags when checking lib and src.

CI:

- GHA/linux: avoid clang-tidy bug by upgrading to v19, and drop the
  workaround.
- GHA/linux: switch to clang from gcc in the clang-tidy job. Using gcc
  doesn't allow passing CFLAGS to clang-tidy, making it less effective.
  (My guess this was one factor contributing to this job often missing
  to find certain issues compared to GHA/macos.)

I recomment using clang-tidy with a clang compiler, preferably the same
version or one that's compatible. Other cases are best effort, and may
fail if a C flag is passed to clang-tidy that it does not understand.
Picky warnings are mostly omitted when using a non-clang compiler,
reducing its usefulness.

Details and reproducer for the v18 (and earlier) clang-tidy bug,
previously affecting the GHA/linux job:

clang-tidy <=18 emits false warnings way when passing multiple C sources
at once (as done with autotools):

```sh
cat > src1.c <<EOF
#include <string.h>
static void dummy(void *p) { memcmp(p, p, 0); }
EOF

cat > src2.c <<EOF
#include <stdarg.h>
void vafunc(int option, ...)
{
  va_list param;
  va_start(param, option);
  if(option)
    (void)va_arg(param, int);
  va_end(param);
}
EOF

/opt/homebrew/opt/llvm@18/bin/clang-tidy --checks=clang-analyzer-valist.Uninitialized src1.c src2.c

# src2.c:7:11: warning: va_arg() is called on an uninitialized va_list [clang-analyzer-valist.Uninitialized]
```

Follow-up to e86542038d #17047

Closes #20605
2026-02-19 00:02:11 +01:00
..
cmdline-opts docs: fix grammar nitpicks 2026-02-05 17:26:02 +01:00
examples build: fix -Wunused-macros warnings, and related tidy-ups 2026-02-19 00:00:48 +01:00
internals build: tidy up curl-specific fstat calls and stat struct type 2026-02-02 18:57:13 +01:00
libcurl easy: reset errorbuf on eyeballing success 2026-02-18 12:04:23 +01:00
tests tidy-up: Markdown, clang-format nits 2026-01-22 23:44:47 +01:00
.gitignore docs: add RELEASE-TOOLS.md.dist to .gitignore 2024-07-01 22:49:55 +02:00
ALTSVC.md docs: fold long lines 2025-12-11 11:42:28 +01:00
BINDINGS.md tidy-up: miscellaneous 2026-01-20 12:37:56 +01:00
BUG-BOUNTY.md BUG-BOUNTY.md: we stop the bug-bounty end of Jan 2026 2026-01-26 08:26:28 +01:00
BUGS.md BUG-BOUNTY.md: we stop the bug-bounty end of Jan 2026 2026-01-26 08:26:28 +01:00
CIPHERS-TLS12.md docs: update CIPHERS.md 2024-08-12 23:35:56 +02:00
CIPHERS.md tidy-up: update MS links, allow long URLs via checksrc 2025-09-20 11:49:23 +02:00
CMakeLists.txt tests: move test docs into /docs 2025-05-28 15:00:03 +02:00
CODE_OF_CONDUCT.md tidy-up: Markdown, clang-format nits 2026-01-22 23:44:47 +01:00
CODE_REVIEW.md docs: fix broken link in CODE_REVIEW.md 2025-06-21 10:32:06 +02:00
CONTRIBUTE.md tidy-up: miscellaneous 2026-01-15 13:06:13 +01:00
curl-config.md docs: minor edits to please the new spellchecker regime 2025-02-27 13:15:21 +01:00
CURL-DISABLE.md build: add build-level CURL_DISABLE_TYPECHECK options 2025-11-21 13:48:35 +01:00
CURLDOWN.md misc: fix typos 2025-07-12 08:59:44 +02:00
DEPRECATE.md tidy-up: miscellaneous 2026-01-20 12:37:56 +01:00
DISTROS.md docs: add LibreELEC to DISTROS.md 2026-01-26 12:12:05 -08:00
EARLY-RELEASE.md tidy-up: miscellaneous 2026-01-20 12:37:56 +01:00
ECH.md tidy-up: URLs 2025-12-09 00:19:10 +01:00
EXPERIMENTAL.md docs/EXPERIMENTAL.md: add a mention of HTTPSRR as experimental 2025-01-16 19:41:42 +01:00
FAQ.md BUG-BOUNTY.md: we stop the bug-bounty end of Jan 2026 2026-01-26 08:26:28 +01:00
FEATURES.md tidy-up: miscellaneous 2026-01-20 12:37:56 +01:00
GOVERNANCE.md BUG-BOUNTY.md: we stop the bug-bounty end of Jan 2026 2026-01-26 08:26:28 +01:00
HELP-US.md tidy-up: miscellaneous 2026-01-15 13:06:13 +01:00
HISTORY.md tidy-up: Markdown, clang-format nits 2026-01-22 23:44:47 +01:00
HSTS.md tidy-up: miscellaneous 2026-01-20 12:37:56 +01:00
HTTP-COOKIES.md tidy-up: Markdown, clang-format nits 2026-01-22 23:44:47 +01:00
HTTP3.md tidy-up: miscellaneous 2026-01-20 12:37:56 +01:00
HTTPSRR.md tidy-up: URLs 2025-09-23 00:34:46 +02:00
INFRASTRUCTURE.md BUG-BOUNTY.md: we stop the bug-bounty end of Jan 2026 2026-01-26 08:26:28 +01:00
INSTALL INSTALL: converted to markdown => INSTALL.md 2016-10-21 15:57:29 +02:00
INSTALL-CMAKE.md cmake: warn for invalid CURL_TARGET_WINDOWS_VERSION values 2026-02-13 00:24:49 +01:00
INSTALL.md tidy-up: miscellaneous 2026-01-20 12:37:56 +01:00
INTERNALS.md clang-tidy: fixes and improvements 2026-02-19 00:02:11 +01:00
IPFS.md IPFS.md: wrap long lines 2025-12-08 17:28:43 +01:00
KNOWN_BUGS.md tidy-up: miscellaneous 2026-01-15 13:06:13 +01:00
KNOWN_RISKS.md tidy-up: miscellaneous 2026-01-15 13:06:13 +01:00
MAIL-ETIQUETTE.md docs: remove dead URLs 2025-12-05 23:41:41 +01:00
Makefile.am tidy-up: miscellaneous 2026-01-15 13:06:13 +01:00
MANUAL.md tidy-up: miscellaneous 2026-01-15 13:06:13 +01:00
mk-ca-bundle.md mk-ca-bundle.md: the file format docs URL is permaredirected 2025-12-08 22:07:32 +01:00
options-in-versions tool_getparam: add --knownhosts 2025-10-06 13:41:22 +02:00
README.md reuse: add copyright + license info to individual docs/*.md files 2024-03-31 12:01:18 +02:00
RELEASE-PROCEDURE.md RELEASE-PROCEDURE.md: update future release dates 2026-01-26 12:28:25 +01:00
ROADMAP.md CI: add whitespace checker 2024-06-27 13:33:30 +02:00
runtests.md tidy-up: miscellaneous 2026-01-15 13:06:13 +01:00
RUSTLS.md tidy-up: URLs 2025-09-23 00:34:46 +02:00
SECURITY-ADVISORY.md tidy-up: miscellaneous 2026-01-20 12:37:56 +01:00
SPONSORS.md BUG-BOUNTY.md: we stop the bug-bounty end of Jan 2026 2026-01-26 08:26:28 +01:00
SSL-PROBLEMS.md tidy-up: Markdown, clang-format nits 2026-01-22 23:44:47 +01:00
SSLCERTS.md tidy-up: miscellaneous 2025-12-12 04:18:48 +01:00
testcurl.md tidy-up: Markdown, clang-format nits 2026-01-22 23:44:47 +01:00
THANKS THANKS: add contributors from 8.18.0 2026-01-07 07:56:22 +01:00
THANKS-filter RELEASE-NOTES: synced 2025-11-05 14:12:23 +01:00
TheArtOfHttpScripting.md tidy-up: miscellaneous 2026-01-20 12:37:56 +01:00
TODO.md docs: fix grammar nitpicks 2026-02-05 17:26:02 +01:00
URL-SYNTAX.md tidy-up: miscellaneous 2026-01-15 13:06:13 +01:00
VERSIONS.md tidy-up: Markdown, clang-format nits 2026-01-22 23:44:47 +01:00
VULN-DISCLOSURE-POLICY.md VULN-DISCLOSURE-POLICY.md: mention GitHub quirks 2026-02-09 12:42:36 +01:00
wcurl.md wcurl: import v2026.01.05 2026-01-06 10:12:31 +01:00

curl logo

Documentation

You find a mix of various documentation in this directory and subdirectories, using several different formats. Some of them are not ideal for reading directly in your browser.

If you would rather see the rendered version of the documentation, check out the curl website's documentation section for general curl stuff or the libcurl section for libcurl related documentation.