warnless: drop parts of the read/write preprocessor hack (Windows)

The `#undef` hack is no longer necessary after changing the redifitions
to not map back to the original symbols.

This makes it unnecessary to repeat the redefinitions after compiling
`warnless.c` itself (in unity mode).

Which in turns makes it unnecessary to include `warnless.h` again, to
trigger such redefinition.

This also means that `read`/`write` are now redefined on Windows from
the first inclusion of `warnless.h`.

Also:
- tests/server: drop a repeat `warnless.h` include, that is unnecessary
  after this patch.
- tests/unit: drop repeat `warnless.h` include.
- tests/libtest: drop repeat `warnless.h` includes.
- tests/libtest: formatting.

Follow-up to 2f312a14da #17619
Follow-up to 84338c4de2 #12331
Follow-up to 6239146e93

Closes #17673
This commit is contained in:
Viktor Szakats 2025-06-19 14:41:34 +02:00
parent 6c1a7541fb
commit 0042770157
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
97 changed files with 20 additions and 96 deletions

View file

@ -35,11 +35,6 @@
#endif /* __INTEL_COMPILER && __unix__ */
#ifdef _WIN32
#undef read
#undef write
#endif
#include <limits.h>
#define CURL_MASK_UCHAR ((unsigned char)~0)
@ -295,7 +290,3 @@ size_t curlx_sitouz(int sinum)
# pragma warning(pop)
#endif
}
/* Ensure that warnless.h redefinitions continue to have an effect
in "unity" builds. */
#undef HEADER_CURL_WARNLESS_H_REDEFS

View file

@ -57,11 +57,6 @@ unsigned short curlx_uitous(unsigned int uinum);
size_t curlx_sitouz(int sinum);
#endif /* HEADER_CURL_WARNLESS_H */
#ifndef HEADER_CURL_WARNLESS_H_REDEFS
#define HEADER_CURL_WARNLESS_H_REDEFS
#ifdef _WIN32
#undef read
#define read(fd, buf, count) (ssize_t)_read(fd, buf, curlx_uztoui(count))
@ -69,4 +64,4 @@ size_t curlx_sitouz(int sinum);
#define write(fd, buf, count) (ssize_t)_write(fd, buf, curlx_uztoui(count))
#endif
#endif /* HEADER_CURL_WARNLESS_H_REDEFS */
#endif /* HEADER_CURL_WARNLESS_H */