refactor deprecate *LAST constants fitting #3131#5120
Open
dybucc wants to merge 1 commit into
Open
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
6d89662 to
ff01f04
Compare
Collaborator
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
d549bd3 to
05d5fe8
Compare
Constants matching the *LAST naming scheme, and whose purpose fits that of a "delimitter" value have been deprecated as part of the deprecation efforts stemming in rust-lang#3131.
This was referenced May 28, 2026
*LAST constants fitting #3131
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Constants matching the *LAST naming scheme, and whose purpose fits that of a "delimitter" value have
been deprecated as part of the deprecation efforts stemming from #3131.
This patch starts deprecation of symbols matching one of the most common suffixes in identifiers for
constants whose value fits that of a "limit." The changes here follow from those in
#3620, with the recommended fixes by Amanieu (not pinging for now.)
Notes
I couldn't look into the QNX
_NTO_HOOK_LASTconstant because I could not find any information onthe headers in that target.
While looking into the
UTX_DB_LASTLOGconstant in the DragonFly BSD upstream repo, I realizedthere was no symbol by that name. There is, though, a very similar constant, going by the identifier
of
UTX_DB_LASTLOGX(note the trailingX.) It does not seem like that one symbol has been changedrecently judging by the
git blameoutput of the containing file. The last modification to the partof the header where the constant is declared was 16 years ago. We may be defining a misspelled
constant in the
libccrate, though I can open a PR changing it if that's, indeed, the case.In the Linux source, I was hesitant to deprecate
NF_IP_PRI_SELINUX_LASTthe same way I did withNF_IP_PRI_LASTbecause that does not seem to be a trailing enumeration member nor does itnecessarily imply that it exists for the purpose of serving as a limit/bound on some other value(s).
Further, looking into section "Priority within hook" of [1], I found that this
SELINUX-taggedsymbol did have some significance, so I've not deprecated it even though no comments were made
against its removal in #3620.
I also couldn't get hold of Solaris sources, though I assumed that the
_PC_LASTconstant servedthe same purpose as in illumos, where I did get to check the headers.
I'm not sure if we should deprecate the
LC_ALL_MASKconstant in OpenBSD, as that seems to be usedas a simpler way of getting a bitmask with all bits for each of the
LC_constants set.Sources
FreeBSD manpage detailing how
UTXDB_LASTLOGINis not the type of constant we would want todeprecate.
https://man.freebsd.org/cgi/man.cgi?query=getutxent&sektion=3
DragonFlyBSD sources showing how they define a
UTX_DB_LASTLOGXsymbol but not aUTX_DB_LASTLOGsymbol as we do.
https://github.com/DragonFlyBSD/DragonFlyBSD/blame/59b78e44f96799c5f46fb3d6d616c18d838a75d0/include/utmpx.h#L89
Android sources showing how they use the
NF_*_PRI_LASTin much the same manner as the Linuxsources (further below.)
https://cs.android.com/search?q=NF_BR_PRI_LAST&ss=android%2Fplatform%2Fsuperproject
https://cs.android.com/search?q=NF_IP_PRI_LAST&sq=&ss=android%2Fplatform%2Fsuperproject
https://cs.android.com/search?q=NF_IP6_PRI_LAST&sq=&ss=android%2Fplatform%2Fsuperproject
Linux sources showing the use of
NF_*_PRI_LASTconstants as trailing enumeration constantsdefined in terms of large values.
https://github.com/torvalds/linux/blob/eb3f4b7426cfd2b79d65b7d37155480b32259a11/include/uapi/linux/netfilter_bridge.h#L42
https://github.com/torvalds/linux/blob/eb3f4b7426cfd2b79d65b7d37155480b32259a11/include/uapi/linux/netfilter_ipv4.h#L44
https://github.com/torvalds/linux/blob/eb3f4b7426cfd2b79d65b7d37155480b32259a11/include/uapi/linux/netfilter_ipv6.h#L47
Illumos sources showing how
_PC_LASTshould be changed when adding new_PCconstants.https://github.com/illumos/illumos-gate/blob/7124a0cccb6ebf2bcffdab36f9bdf8fe4c23d77f/usr/src/uts/common/sys/unistd.h#L336
OpenBSD sources showing how
_LC_LASTserves as the "end" value for constants defined prior toit.
https://github.com/search?q=repo%3Aopenbsd%2Fsrc%20_lc_last&type=code
Checklist
libc-test/semverhave been updated*LASTor*MAXareincluded (see #3131)
cd libc-test && cargo test --target mytarget);especially relevant for platforms that may not be checked in CI