Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mostly SDK-related changes, including __DARWIN_C_LEVEL stuff #92

Merged
merged 13 commits into from
Jul 21, 2024

Conversation

fhgwright
Copy link
Contributor

See the individual commit messages for more details.

Tested on:

Mac OS X 10.4.11 8S165, PPC, Xcode 2.5 8M2558
Mac OS X 10.4.11 8S2167, i386, Xcode 2.5 8M2558
Mac OS X 10.5.8 9L31a, PPC, Xcode 3.1.4 9M2809
Mac OS X 10.5.8 9L31a, i386, Xcode 3.1.4 9M2809
Mac OS X 10.5.8 9L31a, x86_64, Xcode 3.1.4 9M2809
Mac OS X 10.5.8 9L31a, PPC (i386 Rosetta), Xcode 3.1.4 9M2809
Mac OS X 10.6.8 10K549, i386, Xcode 3.2.6 10M2518
Mac OS X 10.6.8 10K549, x86_64, Xcode 3.2.6 10M2518
Mac OS X 10.6.8 10K549, PPC (i386 Rosetta), Xcode 3.2.6 10M2518
Mac OS X 10.7.5 11G63, x86_64, Xcode 4.6.3 4H1503
OS X 10.8.5 12F2560, x86_64, Xcode 5.1.1 5B1008
OS X 10.9.5 13F1911, x86_64, Xcode 6.2 6C131e
OS X 10.10.5 14F2511, x86_64, Xcode 7.2 7C68
OS X 10.11.6 15G22010, x86_64, Xcode 8.1 8B62
macOS 10.12.6 16G2136, x86_64, Xcode 9.2 9C40b
macOS 10.13.6 17G14042, x86_64, Xcode 10.1 10B61
macOS 10.14.6 18G9323, x86_64, Xcode 11.3.1 11C505
macOS 10.15.7 19H15, x86_64, Xcode 12.4 12D4e
macOS 11.7.10 20G1427, x86_64, Xcode 13.2.1 13C100
macOS 11.7.10 20G1427, arm64, Xcode 13.2.1 13C100
macOS 12.7.5 21H1222, x86_64, Xcode 14.2 14C18
macOS 12.7.5 21H1222, arm64, Xcode 14.2 14C18
macOS 13.6.7 22G720, arm64, Xcode 15.2 15C500b
macOS 14.5 23F79, arm64, Xcode 15.4 15F31d

The checksdkversion and darwin_c_all tests were run on all combinations of OS/CPU and SDK, excluding cases where the SDK is incompatible with the CPU. The main test suite was run on all OS/CPU/SDK combinations where the SDK version is no earlier than the OS version, again excluding CPU-incompatible SDKs.

This makes the hack to handle "earlier" SDKs conditional on providing
MACPORTS_LEGACY_MIN_EARLY_SDK_ALLOWED to specify the earliest such
SDK supported.  See the comments for more details.

Also adds code to ensure that the required version macros are defined
in 11.x+ SDKs, even with _POSIX_C_SOURCE defined.  See the comments
for more details.

Also adds another if/elif entry for the upcoming OS/SDK version.

TESTED:
Builds and passes tests on all platforms, including allowable "later"
mismatched SDK cases.  The checksdkversion test passes in both
"earlier" and "later" cases, with "earlier" only being recognized when
allowed by the new option.
This makes the sdkversion.h->AvailabilityMacros.h->Availability.h path
behave more like some programs might expect.  Because it now allows
the include, AvailabilityInternal.h also needs the fix for the
"recursion" case.

TESTED:
Builds and passes tests on all platforms, including with mismatched
SDK cases where allowed.
This is needed to ensure that the __DARWIN_C_* definitions are
available with SDKs prior to 10.7.

Also adds a test for the effects of __DARWIN_C_LEVEL, initially just
as a test that the three macros are defined.

Also adds a new manual test, which simply reports the values of the
relevant macros.

Re: https://trac.macports.org/ticket/69688

TESTED:
Test fails without the new sys/cdefs.h, and passes with it.
Manual test reports as expected.
This reworks the flags that interact with __DARWIN_C_LEVEL
conditionals, to allow proper testing with different SDKs.

Re: https://trac.macports.org/ticket/69867

Also fixes a warning and cleans up some whitespace in sys/stat.h.

TESTED:
Builds and passes tests on all platforms, including with allowable
mismatched SDK cases.
Some constant definitions were wrapped in #ifndef/#endif to defend
against the possibility of building with a later SDK that provided
those definitions.  But in cases where a proper SDK version
conditional is used, this is redundant.

TESTED:
Builds and passes tests on all platforms, including with allowable
mismatched SDK cases.
The assumed SDK version derived from the OS version may include
the minor component, which wasn't being handled correctly.

Also fixes a couple of warnings.

TESTED:
No longer gives false errors with nonzero minor versions.
No longer generates warnings in -Weverything mode.
Also corrects misnamed feature flag for lchmod().

Also removes unnecessary feature flags for AI_NUMERICSERV and
PTHREAD_RWLOCK_*.

Also removes unnecessary #includes where not needed for unnecessary
feature flags.

Also renames guard macro in dirfuncs_compat.h to avoid confusion with
feature flags.

Re: https://trac.macports.org/ticket/69867

TESTED:
Builds and passes tests on all platforms, including with allowable
mismatched SDK cases.
TESTED:
Builds and passes tests on all platforms.
The old method of deriving sysconf wrapper needs from ifndefs was
incompatible with SDK flexibility.  This sets up the usual SDK/lib
flags, referenced to the appropriate OS versions (and the i386 fix).

See: https://trac.macports.org/ticket/69867

TESTED:
Builds and passes tests on all platforms.
Also adds a tool to extract the macro list from an SDK.

Closes: https://trac.macports.org/ticket/69867

TESTED:
Builds and passes tests on all platforms.
Version macros are absent where appropriate in the darwin_c tests.
This reduces the output in the success case to a single line, unless
the -v option is given.
This adds conditionals on __DARWIN_C_LEVEL matching the ones in the
SDK headers that provide the relevant functions.  These conditionals
exist to allow building against an older version of the standard,
without risk of collisions between recently added functions and
same-named functions in the project.  This change extends that
behavior to the functions provided by legacy-support.

Since sys/stdio.h is unavailable prior to 10.7, our sys/stdio.h
includes sys/cdefs.h in that case to get the __DARWIN_C_* defs.

Closes: https://trac.macports.org/ticket/69688

Also makes a couple of cosmetic cleanups to affected headers.

TESTED:
Builds and passes tests on all platforms, including the new tests for
the various __DARWIN_C_LEVEL cases.
See: https://trac.macports.org/ticket/69688

TESTED:
Without the fixes, all tests get expected errors with the given SDK
selection.  With the fixes, all tests pass in all cases.
@fhgwright
Copy link
Contributor Author

@mascguy
This should be the last round with widespread (albeit systematic) changes, since it completes the rework of the feature flags and also adds all the __DARWIN_C_LEVEL stuff.

@fhgwright fhgwright mentioned this pull request Jul 16, 2024
@fhgwright
Copy link
Contributor Author

@mascguy
Any chance of getting this merged in the near future? #93 has conflicts (not entirely git-detectable) with it, and I have another (much simpler) to come shortly.

@mascguy
Copy link
Member

mascguy commented Jul 21, 2024

@mascguy
Any chance of getting this merged in the near future? #93 has conflicts (not entirely git-detectable) with it, and I have another (much simpler) to come shortly.

I'm not able to review this as thoroughly as I'd like, given the number of changes. But looks good based on a cursory scan.

@mascguy mascguy merged commit e7ff5e4 into macports:master Jul 21, 2024
@fhgwright fhgwright deleted the darwin_c branch July 21, 2024 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants