mirror of
https://github.com/curl/curl.git
synced 2026-04-15 01:21:44 +03:00
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
This commit is contained in:
parent
1e1ec7f6c2
commit
5fa2d8320c
27 changed files with 201 additions and 63 deletions
|
|
@ -90,11 +90,15 @@
|
|||
/* Disable Visual Studio warnings: 4127 "conditional expression is constant" */
|
||||
#pragma warning(disable:4127)
|
||||
/* Avoid VS2005 and upper complaining about portable C functions. */
|
||||
#ifndef _CRT_NONSTDC_NO_DEPRECATE
|
||||
#define _CRT_NONSTDC_NO_DEPRECATE /* for strdup(), write(), etc. */
|
||||
#ifndef _CRT_NONSTDC_NO_DEPRECATE /* mingw-w64 v2+. MS SDK ~10+/~VS2017+. */
|
||||
#define _CRT_NONSTDC_NO_DEPRECATE /* for close(), fileno(), strdup(),
|
||||
unlink(), etc. */
|
||||
#endif
|
||||
#ifndef _CRT_SECURE_NO_DEPRECATE
|
||||
#define _CRT_SECURE_NO_DEPRECATE /* for fopen(), getenv(), etc. */
|
||||
#ifndef _CRT_SECURE_NO_WARNINGS
|
||||
#define _CRT_SECURE_NO_WARNINGS /* for __sys_errlist, __sys_nerr, _wfopen(),
|
||||
_wopen(), freopen(), getenv(), gmtime(),
|
||||
sprintf(), strcpy(), wcscpy(), wcsncpy()
|
||||
in tests: localtime(), open(), sscanf() */
|
||||
#endif
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue