<pre style='margin:0'>
Christopher Nielsen (mascguy) pushed a commit to branch master
in repository macports-legacy-support.
</pre>
<p><a href="https://github.com/macports/macports-legacy-support/commit/1bb5b6aaabdf67dcd1848589d6d254d35922aa8e">https://github.com/macports/macports-legacy-support/commit/1bb5b6aaabdf67dcd1848589d6d254d35922aa8e</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit 1bb5b6aaabdf67dcd1848589d6d254d35922aa8e
</span>Author: Fred Wright <fw@fwright.net>
AuthorDate: Fri May 9 19:30:04 2025 -0700
<span style='display:block; white-space:pre;color:#404040;'> Availability[Internal].h: Avoid lingering dummy __has*().
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> The leftover default dummy definition of __has_include() was preventing
</span><span style='display:block; white-space:pre;color:#404040;'> the special workaround in MacTypes.h from working correctly. This
</span><span style='display:block; white-space:pre;color:#404040;'> removes both dummy __has*() definitions after their use.
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> However, Availability.h was relying on these leftover defaults to
</span><span style='display:block; white-space:pre;color:#404040;'> function correctly, so we add similar logic to its wrapper.
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Both of these have now gotten complicated enough to justify guard macros.
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> TESTED:
</span><span style='display:block; white-space:pre;color:#404040;'> Passes all tests, including new allheaders tests.
</span>---
include/Availability.h | 50 ++++++++++++++++++++++++++++++++++++++----
include/AvailabilityInternal.h | 27 +++++++++++++++++++----
2 files changed, 69 insertions(+), 8 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/include/Availability.h b/include/Availability.h
</span><span style='display:block; white-space:pre;color:#808080;'>index 336a5b0..9bdc58b 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/include/Availability.h
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/include/Availability.h
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -1,5 +1,5 @@
</span> /*
<span style='display:block; white-space:pre;background:#ffe0e0;'>- * Copyright (c) 2024 Frederick H. G. Wright II <fw@fwright.net>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * Copyright (c) 2025 Frederick H. G. Wright II <fw@fwright.net>
</span> *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -14,14 +14,30 @@
</span> * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
<span style='display:block; white-space:pre;background:#e0ffe0;'>+#ifndef _MACPORTS_AVAILABILITY_H_
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#define _MACPORTS_AVAILABILITY_H_
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> /*
* This is a wrapper header for Availability.h, to handle its absence in
* the 10.4 SDK. In that case, we provide a substitute; otherwise we
* just pass through the SDK header.
*
<span style='display:block; white-space:pre;background:#ffe0e0;'>- * We don't bother with a guard macro, since all we do here is include
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- * other headers which have their own guard macros, and we don't define
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- * anything here.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * We also provide a dummy definition of __has_include() when the compiler
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * doesn't provide it and we're using a 10.14+ SDK, which uses it here
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * without checking. It would probably be OK to do this for all SDKs,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * but for safety we limit it to the relevant cases. Note that this has
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * to be done *before* the include_next.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ *
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * A similar issue exists with __has_builtin() in the 14.x+ SDK. In this
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * case, the offending code attempts to handle the missing feature by
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * including a defined() condition, but that doesn't actually work because
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * the intrinsic needs to be parseable before evaluating the boolean.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * So we again provide a default when needed.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ *
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * For both of the above, we only temporarily provide the dummy definitions
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * during the include_next, to avoid confusing other includes, such as the
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * __has_include() mess in MacTypes.h. We use header-specific flag macros
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * for this, to avoid nesting issues.
</span> *
* There'a complication in the case where AvailabilityMacros.h (included by
* sdkversion.h) #includes Availability.h (currently in 10.9+ SDKs). In that
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -35,8 +51,34 @@
</span> /* Do our SDK-related setup */
#include <_macports_extras/sdkversion.h>
<span style='display:block; white-space:pre;background:#e0ffe0;'>+#ifdef __MPLS_SDK_MAJOR
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#if __MPLS_SDK_MAJOR >= 101400 && !defined(__has_include)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#define __has_include(x) 0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#define __MPLS_DUMMY_HAS_INCLUDE_AVAIL
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#if __MPLS_SDK_MAJOR >= 140000 && !defined(__has_builtin)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#define __has_builtin(x) 0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#define __MPLS_DUMMY_HAS_BUILTIN_AVAIL
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#endif /* __MPLS_SDK_MAJOR */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> #if defined(__MPLS_SDK_MAJOR) && __MPLS_SDK_MAJOR < 1050
#include <_macports_extras/tiger_only/Availability.h>
#else
#include_next <Availability.h>
#endif
<span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#ifdef __MPLS_DUMMY_HAS_INCLUDE_AVAIL
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#undef __has_include
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#undef __MPLS_DUMMY_HAS_INCLUDE_AVAIL
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#ifdef __MPLS_DUMMY_HAS_BUILTIN_AVAIL
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#undef __has_include
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#undef __MPLS_DUMMY_HAS_BUILTIN_AVAIL
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#endif /* _MACPORTS_AVAILABILITY_H_ */
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/include/AvailabilityInternal.h b/include/AvailabilityInternal.h
</span><span style='display:block; white-space:pre;color:#808080;'>index a0e532d..e5efc49 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/include/AvailabilityInternal.h
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/include/AvailabilityInternal.h
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -1,5 +1,5 @@
</span> /*
<span style='display:block; white-space:pre;background:#ffe0e0;'>- * Copyright (c) 2024 Frederick H. G. Wright II <fw@fwright.net>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * Copyright (c) 2025 Frederick H. G. Wright II <fw@fwright.net>
</span> *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -14,14 +14,14 @@
</span> * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
<span style='display:block; white-space:pre;background:#e0ffe0;'>+#ifndef _MACPORTS_AVAILABILITY_INTERNAL_H_
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#define _MACPORTS_AVAILABILITY_INTERNAL_H_
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> /*
* This is a wrapper header for AvailabilityInternal.h, to handle its absence
* from the 10.4 SDK. In that case, we provide a substitute; otherwise we
* just pass through the SDK header.
*
<span style='display:block; white-space:pre;background:#ffe0e0;'>- * We don't bother with a guard macro, since the included headers will
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- * handle that.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- *
</span> * We also provide a dummy definition of __has_include() when the compiler
* doesn't provide it and we're using a 10.14+ SDK, which uses it here
* without checking. It would probably be OK to do this for all SDKs,
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -34,6 +34,11 @@
</span> * the intrinsic needs to be parseable before evaluating the boolean.
* So we again provide a default when needed.
*
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ * For both of the above, we only temporarily provide the dummy definitions
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * during the include_next, to avoid confusing other includes, such as the
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * __has_include() mess in MacTypes.h. We use header-specific flag macros
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * for this, to avoid nesting issues.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ *
</span> * There'a complication in the case where AvailabilityMacros.h (included by
* sdkversion.h) #includes Availability.h (currently in 10.9+ SDKs). In that
* case, the sdkversion.h #include below does nothing due to its guard
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -50,10 +55,12 @@
</span>
#if __MPLS_SDK_MAJOR >= 101400 && !defined(__has_include)
#define __has_include(x) 0
<span style='display:block; white-space:pre;background:#e0ffe0;'>+#define __MPLS_DUMMY_HAS_INCLUDE_AVAIL_INT
</span> #endif
#if __MPLS_SDK_MAJOR >= 140000 && !defined(__has_builtin)
#define __has_builtin(x) 0
<span style='display:block; white-space:pre;background:#e0ffe0;'>+#define __MPLS_DUMMY_HAS_BUILTIN_AVAIL_INT
</span> #endif
#endif /* __MPLS_SDK_MAJOR */
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -63,3 +70,15 @@
</span> #else
#include_next <AvailabilityInternal.h>
#endif
<span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#ifdef __MPLS_DUMMY_HAS_INCLUDE_AVAIL_INT
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#undef __has_include
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#undef __MPLS_DUMMY_HAS_INCLUDE_AVAIL_INT
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#ifdef __MPLS_DUMMY_HAS_BUILTIN_AVAIL_INT
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#undef __has_include
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#undef __MPLS_DUMMY_HAS_BUILTIN_AVAIL_INT
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#endif /* _MACPORTS_AVAILABILITY_INTERNAL_H_ */
</span></pre><pre style='margin:0'>
</pre>