diff --git a/lib/curl_setup.h b/lib/curl_setup.h index dd8dddf702..a418f0a6a6 100644 --- a/lib/curl_setup.h +++ b/lib/curl_setup.h @@ -40,6 +40,23 @@ #include <_mingw.h> #endif +/* Workaround for Homebrew gcc 12.4.0, 13.3.0, 14.1.0 and newer (as of 14.1.0) + that started advertising the `availability` attribute, which then gets used + by Apple SDK, but, in a way incompatible with gcc, resulting in a misc + errors inside SDK headers, e.g.: + error: attributes should be specified before the declarator in a function + definition + error: expected ',' or '}' before + Followed by missing declarations. + Fix it by overriding the built-in feature-check macro used by the headers + to enable the problematic attributes. This makes the feature check fail. */ +#if defined(__APPLE__) && \ + !defined(__clang__) && \ + defined(__GNUC__) && __GNUC__ >= 12 && \ + defined(__has_attribute) +#define availability curl_pp_attribute_disabled +#endif + /* * Disable Visual Studio warnings: * 4127 "conditional expression is constant" diff --git a/lib/macos.c b/lib/macos.c index 70393b4bf7..205d30db32 100644 --- a/lib/macos.c +++ b/lib/macos.c @@ -30,17 +30,7 @@ #include "macos.h" -/* Certain Apple SDK v13.0+ headers are incompatible with the GCC compiler. - As a workaround, use a minimal header and define the function we need, - to avoid hitting those incompatibilities when compiling with GCC. */ -#if defined(__clang__) #include -#else -#include -typedef const struct CF_BRIDGED_TYPE(id) __SCDynamicStore * SCDynamicStoreRef; -CFDictionaryRef __nullable -SCDynamicStoreCopyProxies(SCDynamicStoreRef __nullable store); -#endif CURLcode Curl_macos_init(void) {