]> git.ipfire.org Git - thirdparty/curl.git/commit
build: tidy-up MSVC CRT warning suppression macros
authorViktor Szakats <commit@vsz.me>
Tue, 21 Oct 2025 09:51:02 +0000 (11:51 +0200)
committerViktor Szakats <commit@vsz.me>
Mon, 17 Nov 2025 23:49:26 +0000 (00:49 +0100)
commit5fa2d8320c4196435c1d554b06dfdcca73824dec
tree810c6f561ee9912283031ccc9bd483addd8d02c6
parent1e1ec7f6c2864abef038822077e5e6a7f4e47cbb
build: tidy-up MSVC CRT warning suppression macros

- curl_setup.h: replace `_CRT_SECURE_NO_DEPRECATE` with
  `_CRT_SECURE_NO_WARNINGS`, which seems to be the preferred,
  more recent macro for this. Also syncing with libssh2.
  They are equivalent for curl sources with the supported compilers.
- cmake: stop setting `_CRT_SECURE_NO_DEPRECATE` globally for examples.
- examples: suppress CRT deprecation warnings on a per-file basis.
  To make it work when compiling examples out of curl's build systems.
  Use `_CRT_SECURE_NO_WARNINGS`.
- examples: document the functions requiring `_CRT_SECURE_NO_WARNINGS`.
- examples/block_ip: delete superfluous `_CRT_SECURE_NO_WARNINGS`.
- examples/block_ip: limit `_CRT_NONSTDC_NO_DEPRECATE` to MSVC.
- examples/log_failed_transfers: fix to set `_CRT_SECURE_NO_WARNINGS`
  before headers and limit to MSVC.
- curl_setup.h: document which SDKs support `_CRT_NONSTDC_NO_DEPRECATE`.

Closes #19175
27 files changed:
docs/examples/CMakeLists.txt
docs/examples/anyauthput.c
docs/examples/block_ip.c
docs/examples/chkspeed.c
docs/examples/cookie_interface.c
docs/examples/externalsocket.c
docs/examples/fileupload.c
docs/examples/ftp-wildcard.c
docs/examples/ftpget.c
docs/examples/ftpgetinfo.c
docs/examples/ftpgetresp.c
docs/examples/ftpsget.c
docs/examples/ftpupload.c
docs/examples/ftpuploadresume.c
docs/examples/hsts-preload.c
docs/examples/http2-download.c
docs/examples/http2-serverpush.c
docs/examples/http2-upload.c
docs/examples/httpput.c
docs/examples/log_failed_transfers.c
docs/examples/sepheaders.c
docs/examples/sftpget.c
docs/examples/sftpuploadresume.c
docs/examples/simplessl.c
docs/examples/synctime.c
docs/examples/url2file.c
lib/curl_setup.h