Skip to content

warnless: replace read()/write() wrapper functions with macros (Windows)#17619

Closed
vszakats wants to merge 1 commit intocurl:masterfrom
vszakats:w-warnless-replace-func-with-macro
Closed

warnless: replace read()/write() wrapper functions with macros (Windows)#17619
vszakats wants to merge 1 commit intocurl:masterfrom
vszakats:w-warnless-replace-func-with-macro

Conversation

@vszakats
Copy link
Member

@vszakats vszakats commented Jun 14, 2025

Map them to _read()/_write() (with underscore) to avoid recursive
mapping and to use the non-compatibility naming on Windows.

https://learn.microsoft.com/cpp/c-runtime-library/reference/read
https://learn.microsoft.com/cpp/c-runtime-library/reference/write

Follow-up to 6239146

@vszakats vszakats added Windows Windows-specific tidy-up labels Jun 14, 2025
@vszakats vszakats changed the title warnless: replace read/write function wrappers with macros (Windows) warnless: replace read()/write() function wrappers with macros (Windows) Jun 14, 2025
@vszakats vszakats changed the title warnless: replace read()/write() function wrappers with macros (Windows) warnless: replace read()/write() wrapper functions with macros (Windows) Jun 15, 2025
@vszakats vszakats closed this in 2f312a1 Jun 15, 2025
@vszakats vszakats deleted the w-warnless-replace-func-with-macro branch June 15, 2025 00:03
vszakats added a commit to vszakats/curl that referenced this pull request Jun 19, 2025
vszakats added a commit to vszakats/curl that referenced this pull request Jun 19, 2025
vszakats added a commit that referenced this pull request Jun 19, 2025
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 2f312a1 #17619
Follow-up to 84338c4 #12331
Follow-up to 6239146

Closes #17673
denandz pushed a commit to denandz/curl that referenced this pull request Jun 21, 2025
…indows)

Map them to `_read()`/`_write()` (with underscore) to avoid recursive
mapping and to use the non-compatibility naming on Windows.

https://learn.microsoft.com/cpp/c-runtime-library/reference/read
https://learn.microsoft.com/cpp/c-runtime-library/reference/write

Follow-up to 6239146

Closes curl#17619
denandz pushed a commit to denandz/curl that referenced this pull request Jun 21, 2025
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 2f312a1 curl#17619
Follow-up to 84338c4 curl#12331
Follow-up to 6239146

Closes curl#17673
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tidy-up Windows Windows-specific

Development

Successfully merging this pull request may close these issues.

1 participant