Skip to content

Commit

Permalink
curl.test.patch test improve patch with auto-detection 3
Browse files Browse the repository at this point in the history
  • Loading branch information
vszakats committed Nov 7, 2024
1 parent 8ee43eb commit f0605f3
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions curl.test.patch
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ index e8be5d0ccd9104..804cdebc648032 100644
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.:
@@ -51,14 +51,23 @@
@@ -51,13 +51,17 @@
definition
error: expected ',' or '}' before
Followed by missing declarations.
Expand All @@ -188,24 +188,18 @@ index e8be5d0ccd9104..804cdebc648032 100644
-#if defined(__APPLE__) && \
- !defined(__clang__) && \
- defined(__GNUC__) && __GNUC__ >= 12 && \
- 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.
+ fail. Fixed in 14.2.0_1. Disable the workaround if the fix is detected.
+ */
+#if defined(__APPLE__) && \
+ !defined(__clang__) && \
+ defined(__GNUC__) && \
+ defined(__has_attribute) && \
+ !defined(CURL_NO_APPLE_AVAILABILITY_WORKAROUND)
+/* Separate #if to make it compile with some non-Apple gcc compilers */
+#if defined(CURL_APPLE_AVAILABILITY_WORKAROUND) || \
+ !defined(__has_feature) || \
+ !__has_feature(attribute_availability)
#define availability curl_pp_attribute_disabled
+#if defined(__APPLE__) && !defined(__clang__) && defined(__GNUC__) && \
defined(__has_attribute)
-#define availability curl_pp_attribute_disabled
+# if !defined(__has_feature)
+# define availability curl_pp_attribute_disabled
+# elif !__has_feature(attribute_availability)
+# define availability curl_pp_attribute_disabled
+# endif
#endif
+#endif

#if defined(__APPLE__)
#include <sys/types.h>

0 comments on commit f0605f3

Please sign in to comment.