Skip to content

Commit

Permalink
curl.test.patch test improve patch with auto-detection
Browse files Browse the repository at this point in the history
  • Loading branch information
vszakats committed Nov 7, 2024
1 parent 471b7d1 commit 66cc851
Showing 1 changed file with 22 additions and 16 deletions.
38 changes: 22 additions & 16 deletions curl.test.patch
Original file line number Diff line number Diff line change
Expand Up @@ -170,32 +170,38 @@ index e8be5d0ccd9104..804cdebc648032 100644
#ifdef HAS_ALPN
--- a/lib/curl_setup.h
+++ b/lib/curl_setup.h
@@ -43,7 +43,10 @@
@@ -43,7 +43,7 @@
#include <_mingw.h>
#endif

-/* Workaround for Homebrew gcc 12.4.0, 13.3.0, 14.1.0 and newer (as of 14.1.0)
+/* Workaround for Homebrew gcc 12.4.0, 13.3.0, 14.1.0, 14.2.0.
+ Fixed it 14.2.0_1. We also omit the workaround for 14.2.0 because there
+ is now way to tall 14.2.0_1 and 14.2.0 apart, and the workaround breaks
+ the fixed 14.2.0_1 version.
+/* Workaround for Homebrew gcc 12.4.0, 13.3.0, 14.1.0, 14.2.0 (initial build)
that started advertising the `availability` attribute, which then gets used
by Apple SDK, but, in a way incompatible with gcc, resulting in misc errors
inside SDK headers, e.g.:
@@ -53,9 +56,13 @@
@@ -51,12 +51,19 @@
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. */
- 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 && \
+#if defined(__APPLE__) && \
+ !defined(__clang__) && \
+ defined(__GNUC__) && \
+ (__GNUC__ == 12 || \
+ __GNUC__ == 13 || \
+ (__GNUC__ == 14 && \
+ defined(__GNUC_MINOR__) && (__GNUC_MINOR__ <= 1))) && \
defined(__has_attribute)
- defined(__has_attribute)
+ Work it around by overriding the built-in feature-check macro used by the
+ headers to enable the problematic attributes. This makes the feature check
+ fail.
+ Fixed upstream in 14.2.0_1. Disable the workaround if the fix is detected.
+ */
+#if defined(__APPLE__) && \
+ !defined(__clang__) && \
+ !defined(CURL_NO_APPLE_AVAILABILITY_WORKAROUND) && \
+ defined(__GNUC__) && \
+ defined(__has_attribute) && \
+ (defined(CURL_APPLE_AVAILABILITY_WORKAROUND) || \
+ !defined(__has_feature) || \
+ !__has_feature(attribute_availability))
#define availability curl_pp_attribute_disabled
#endif

0 comments on commit 66cc851

Please sign in to comment.