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

Multiple changes (primarily cleanups) - see individual commits #106

Merged
merged 10 commits into from
Dec 10, 2024

Conversation

fhgwright
Copy link
Contributor

Notably:

  • Adds support for code that can't tolerate the normal scandir() fix.
  • Limits unavoidable GCC warnings to cases that really need the fix.

Tested (both from repo and from temp Portfile) 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.4.11 8S2167, x86_64, 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.6 21H1320, x86_64, Xcode 14.2 14C18
macOS 12.7.6 21H1320, arm64, Xcode 14.2 14C18
macOS 13.7.1 22H221, arm64, Xcode 15.2 15C500b
macOS 14.7.1 23H222, arm64, Xcode 16.1 16B40
macOS 15.1.1 24B91, arm64, Xcode 16.1 16B40

See the expanded comment in dirent.h.

TESTED:
Tests (including relevant update) pass on all platforms.
TESTED:
Fails without corresponding update & passes with.
The workaround for the bug in __has_cpp_attribute() is acceptable for
all versions of both clang and GCC, but causes unsuppressible warnings
in affected versions of GCC.  To minimize this, we narrow the scope of
the workaround in the GCC case to just the cases that actually require
it.

TESTED:
Eliminates warnings where possible.
Tests pass on all platforms.
SDK-related conditionals for the atcall mechanism were inappropriate
since the only use was in purely internal code.

This also removes the now-obsolete includes from common-priv.h.

TESTED:
Tests pass on all platforms.
Since the sole use of SYS___pthread_fchdir is in best_fchdir.c,
it makes no sense to define it in a header.

TESTED:
Tests pass on all platforms.
Since the sole purpose of the internal common-priv.h was to support
atcalls, naming it accordingly is more appropriate.  If another
circumstance arises calling for an internal header, it would make more
sense to make it a separate header with an appropriate name.

Also does some whitespace and include-order cleanup.

TESTED:
Tests pass on all platforms.
Since fdopendir() is just another "at" call, with the same
availability as other "at" calls, the mere fact that it doesn't have
"at" in its name doesn't justify giving it its own separate feature
flags.  This folds it into the general ATCALLS feature flags.

TESTED:
Test pass on all platforms.
These tests are intentionally performing illegal operations to verify
that the checks work as expected.  We try to suppress related warnings
as much as possible.

With these changes, all tested versions of clang are fully
well-behaved, in that they emit no warnings and apply the checks as
expected.

Gcc is another story, where some versions fail to suppress the
warnings, and some versions actually get false errors.  The current
state seems to be the best possible under the circumstances.

TESTED:
Behavior across compiler versions is as noted above.
Tests pass on all platforms.
This provides targets to run all variants of the st?ncpy_chk tests.

TESTED:
Works as intended.
@fhgwright
Copy link
Contributor Author

@mascguy
My availability will be fairly limited this week, so I figured I might as well dump the buffer of fully tested commits. It's probably not worth bothering with a -devel update for this, since the only likely user-visible change is getting rid of a warning when building with gcc 5-11 and SDK <15. The warning remains a necessary evil when building with gcc 5-11 and SDK >=15. There are no issues with any version of clang as of the original fix.

The only remaining intended cleanups for this cycle relate to copyfile, where a simple dlsym() cacheing addition led to implementing the missing test, which led to discovering multiple bugs that I haven't had time to fix yet. Then it will be time to review the backlog.

@mascguy mascguy merged commit 38694c2 into macports:master Dec 10, 2024
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