Opened 7 months ago

Closed 4 months ago

Last modified 3 months ago

#69688 closed defect (fixed)

legacy-support headers don't honor __DARWIN_C_LEVEL

Reported by: fhgwright (Fred Wright) Owned by: fhgwright (Fred Wright)
Priority: Low Milestone:
Component: ports Version: 2.9.3
Keywords: Cc: mascguy (Christopher Nielsen)
Port: legacy-support

Description

Many Apple headers condition many definitions on __DARWIN_C_LEVEL. This allows projects to specify a particular POSIX standard, and avoid definitions from newer standards that may collide with the project's own definitions. The legacy-support headers fail to do this. It only matters when the project has conflicting definitions, which may never have happened so far. Hence, this is low priority, but worth fixing at some point.

Change History (6)

comment:1 Changed 4 months ago by fhgwright (Fred Wright)

In b8e7f9837011e31fc99e666a892aee21468ec5c1/macports-legacy-support (master):

Add sys/cdefs.h wrapper, and tests.

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: #69688

TESTED:
Test fails without the new sys/cdefs.h, and passes with it.
Manual test reports as expected.

comment:2 Changed 4 months ago by fhgwright (Fred Wright)

Resolution: fixed
Status: assignedclosed

In beb746704fad6db0223fed77ca68a3ab9712fb5f/macports-legacy-support (master):

Add DARWIN_C_LEVEL conditionals.

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: #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.

comment:3 Changed 4 months ago by fhgwright (Fred Wright)

In e7ff5e479c43e5aa3b8b9e97bf049706d0b23837/macports-legacy-support (master):

Implement DARWIN_C_LEVEL test cases.

See: #69688

TESTED:
Without the fixes, all tests get expected errors with the given SDK
selection. With the fixes, all tests pass in all cases.

comment:4 Changed 4 months ago by fhgwright (Fred Wright)

In bd4acde3ef5abb100c78e3ffe9df7c73a01f63e3/macports-ports (master):

legacy-support-devel: Update to latest master

  • Adds appropriate DARWIN_C_LEVEL conditionals, as in SDK headers. Re: #69688
  • Completes rework for "mismatched" SDK compatibility. Re: #69867
  • Makes clockid_t an enum, matching SDK behavior.
  • Makes mildly invasive support for "earlier" SDKs a non-default option.

TESTED:
Tested both normal and -devel versions on 10.4-10.5 ppc, 10.5-10.6 ppc
(i386 Rosetta), 10.4-10.6 i386, 10.4-12.x x86_64, and 11.x-14.x arm64.
Builds on all tested platforms except 10.4 ppc +universal.
Passes all tests in all buildable cases.

comment:5 Changed 4 months ago by fhgwright (Fred Wright)

In a16240162b34f3a69eab8c529bd6bef7d25d51df/macports-ports (master):

legacy-support-devel: Update to latest master.

Since the previous legacy-support-devel:

  • Adds SLIST_REMOVE_AFTER, SLIST_HEAD_INITIALIZER Re: #69890
  • Adds fgetattrlist()

In the previous legacy-support-devel, since v1.2.4:

  • Adds optional security wrapper for stpncpy(). Re: #69878
  • Moves renameat() prototype to the proper header location.
  • Fixes incorrect CLOCK_UPTIME_RAW_APPROX definition
  • Eliminates spurious fmemopen() in OSes that don't need it
  • Adds appropriate DARWIN_C_LEVEL conditionals, as in SDK headers. Re: #69688
  • Reworks headers for "mismatched" SDK compatibility. Re: #69867
  • Makes clockid_t an enum, matching SDK behavior.

TESTED:
Tested both normal and -devel versions on 10.4-10.5 ppc, 10.5-10.6 ppc
(i386 Rosetta), 10.4-10.6 i386, 10.4-12.x x86_64, and 11.x-14.x arm64.
Builds on all tested platforms except 10.4 ppc +universal.
Passes all tests in all buildable cases.

comment:6 Changed 3 months ago by fhgwright (Fred Wright)

In ceccb8bb27da3987f9c191f0ad8181998af1831c/macports-ports (master):

legacy-support: Update to v1.3.0.

  • Adds optional security wrapper for stpncpy(). Re: #69878
  • Moves renameat() prototype to the proper header location.
  • Fixes incorrect CLOCK_UPTIME_RAW_APPROX definition.
  • Eliminates spurious fmemopen() in OSes that don't need it.
  • Adds appropriate DARWIN_C_LEVEL conditionals, as in SDK headers. Re: #69688
  • Reworks headers for "mismatched" SDK compatibility. Re: #69867
  • Makes clockid_t an enum, matching SDK behavior.
  • Adds SLIST_REMOVE_AFTER, SLIST_HEAD_INITIALIZER. Re: #69890
  • Adds fgetattrlist(). Closes: #70350

Portfile changes:

  • Removes obsolete portion of Tiger-specific additions.
  • Moves atexit removal from post-extract to pre-patch, to respect expected phase behavior.

TESTED:
Tested both normal and -devel versions (currently identical) on
10.4-10.5 ppc, 10.5-10.6 ppc (i386 Rosetta), 10.4-10.6 i386, 10.4-12.x
x86_64, and 11.x-14.x arm64.
Builds on all tested platforms except 10.4 ppc +universal.
Passes all tests in all buildable cases.

Note: See TracTickets for help on using tickets.