addrinfo: add curl macro to avoid redefining foreign symbols

Before this patch curl code was redefining `getaddrinfo` and
`freeaddrinfo` system symbols to plug in its debug wrappers. This was
causing pains to avoid applying the redefinitions to system headers
defining these functions, and to the local debug wrappers. Especially
in unity builds. It also required workarounds for systems where these
symbols are already macros.

Introduce curl-namespaced macros for these functions and use them.
This allows to drop all workarounds and makes it work in all envs,
local targets and unity/bundle combinations.

Also drop GHA/windows workaround and use the same unity batch across
all jobs. Follow-up to 29e4eda631 #16272

Ref: #16272
Ref: 71cf0d1fca #14772
Ref: 3efba94f77 #14765
Ref: f7d5f47059 #14399

Closes #16274
This commit is contained in:
Viktor Szakats 2025-02-09 05:12:24 +01:00
parent 7241953ba5
commit de0693f249
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
11 changed files with 16 additions and 60 deletions

View file

@ -47,10 +47,6 @@ foreach(_target IN LISTS noinst_PROGRAMS)
if(WIN32)
set_property(TARGET ${_target_name} APPEND PROPERTY COMPILE_DEFINITIONS "CURL_STATICLIB")
endif()
# getaddrinfo/freeaddrinfo overrides break UNITY build by overriding them
# before including system headers. Server code doesn't need these overrides,
# so it's safe to disable them globally.
set_property(TARGET ${_target_name} APPEND PROPERTY COMPILE_DEFINITIONS "CURL_NO_GETADDRINFO_OVERRIDE")
set_target_properties(${_target_name} PROPERTIES
OUTPUT_NAME "${_target}"
PROJECT_LABEL "Test server ${_target}")

View file

@ -43,7 +43,6 @@ LIBS = $(BLANK_AT_MAKETIME)
if DOING_NATIVE_WINDOWS
AM_CPPFLAGS += -DCURL_STATICLIB
endif
AM_CPPFLAGS += -DCURL_NO_GETADDRINFO_OVERRIDE
# Makefile.inc provides neat definitions
include Makefile.inc

View file

@ -21,10 +21,6 @@
* SPDX-License-Identifier: curl
*
***************************************************************************/
#ifndef CURL_NO_GETADDRINFO_OVERRIDE
#define CURL_NO_GETADDRINFO_OVERRIDE
#endif
#include "server_setup.h"
/* Purpose