centos7 has reached EOL on 2024-06-30, centos8 on 2021-10-31. In
practical terms this means that their package repositories are offline
for the foreseeable future and the CI tasks making use of them might
never run again.
This patch replaces the existing CI jobs on centos7/centos8 with jobs on
rockylinux8/9. Since rockylinux is an open source variant similar to
RHEL this should provide testing with similar spirit. In contrast to
centos, rockylinux does provide very granular tagging of releases which
if used would help avoid breaking on e.g., subtle package changes in
their package repositories. I however did not use very precise tags in
the patch and instead went with broad "trains" for the 8 and 9 series;
I hope this minimizes maintenance overhead (e.g., bumping to new
releases) while still giving a good testing signal.
GNU `getcwd` can allocate a buffer if passed `NULL` for it. This is an
extension which is e.g., not recognized by clang-tidy-19's
`StdCLibraryFunctions` check[^1] which emits a diagnostic on a violated
precondition `buf != NULL`,
```
The 1st argument to 'getcwd' is NULL but should not be NULL [clang-analyzer-unix.StdCLibraryFunctions,-warnings-as-errors]
[build] 3987 | std::unique_ptr<char, decltype(&std::free)> buffer{::getcwd(NULL, 0), std::free};
```
This patch modifies this use of `getcwd` with this extension behavior to
instead use `get_current_dir_name` which is also a GNU extension, but
does not trigger this diagnostic.
[^1]: https://clang.llvm.org/docs/analyzer/checkers.html#unix-stdclibraryfunctions-c
Two changes:
- (minor) Rename GHC_OS_MACOS -> GHC_OS_APPLE, since it is defined all apple platforms (iOS, watchOS, etc.), not just macOS.
- Changed the preprocessor conditional in last_write_time to align with its presumed intent. Previously, it would always have been true, which can't be intentional, because the *_OS_VERSION_MIN_REQUIRED is undefined and thus zero for platforms besides the current one, and therefore less than the constants--except for on very old SDKs where, e.g., MAC_OS_X_VERSION_10_13 and others would be undefined and therefore 0 and therefore making the clause false when it needed to be true. Therefore, I changed the conditions to be parallel to those in the dynamic selection headers, checking for the undefined, zero case and hardcoding the version values to support old SDKs.
Reduces duplication and tendency to get out of sync.
As evidence of the problem, the snippet had previously (before this PR) started to diverge. It seemed more prudent to delete than to fix, given the usage instructions seem to be centralized in the readme and the dynamic selection headers should probably be recommended anyway.
This makes project integration more flexible, allowing the drag-contents-of-directory project integration contemplated in the readme and allowing use via -iquote
- Supports more Apple platforms, including future ones, which will always support std::filesystem, like with visionOS
- Simplifies cases. Undefined preprocessor values are guaranteed to default evaluate to 0
- Moves <Availability.h> include inside conditional, avoiding the include where not needed.
- Removes reference to wchar for std headers on windows, which seemed to be out of date, since the define it might have been referring to was commented
- (And some other small things.)