build: fix -Wunused-macros warnings, and related tidy-ups

- fix internal macro `AN_APPLE_OS` reused between sources without
  resetting it. It may potentially have left the system sha256
  function unused.
- fix to define `WOLFSSL_OPTIONS_IGNORE_SYS` so that it always applies
  to wolfSSL headers, also during feature detection.
- md4, md5, sha256: simplify fallback logic.
- delete 20+ unused macros.
- scope or move macros to avoid `-Wunused-macros` warnings.
- examples: delete unused code.

The warning detects macros defined but not used within the same C
source. It does not warn for macros defined in headers. It also works
with unity builds, but to a lesser extent.

Closes #20593
This commit is contained in:
Viktor Szakats 2026-02-13 17:05:36 +01:00
parent 633ec719d5
commit 5fa5cb3825
No known key found for this signature in database
28 changed files with 105 additions and 161 deletions

View file

@ -27,8 +27,6 @@
#ifdef _WIN32
# include <tlhelp32.h>
# undef PATH_MAX
# define PATH_MAX MAX_PATH
#elif !defined(__DJGPP__) || (__DJGPP__ < 2) /* DJGPP 2.0 has _use_lfn() */
# define CURL_USE_LFN(f) 0 /* long filenames never available */
#elif defined(__DJGPP__)
@ -552,12 +550,12 @@ CURLcode FindWin32CACert(struct OperationConfig *config,
{
CURLcode result = CURLE_OK;
DWORD res_len;
TCHAR buf[PATH_MAX];
TCHAR buf[MAX_PATH];
TCHAR *ptr = NULL;
buf[0] = TEXT('\0');
res_len = SearchPath(NULL, bundle_file, NULL, PATH_MAX, buf, &ptr);
res_len = SearchPath(NULL, bundle_file, NULL, MAX_PATH, buf, &ptr);
if(res_len > 0) {
curlx_free(config->cacert);
config->cacert = curlx_convert_tchar_to_UTF8(buf);

View file

@ -369,8 +369,6 @@ static ParameterError addvariable(const char *name,
return PARAM_NO_MEM;
}
#define MAX_FILENAME 10000
ParameterError setvariable(const char *input)
{
const char *name;