Re: git: 8b197806dcdf - main - libsysdecode: Teach mktables to handle enums

From: Jessica Clarke <jrtc27_at_freebsd.org>
Date: Thu, 19 Nov 2026 23:24:11 UTC
On 19 Nov 2026, at 23:06, Gleb Smirnoff <glebius@freebsd.org> wrote:
> 
> On Thu, Nov 19, 2026 at 10:22:21PM +0000, Jessica Clarke wrote:
> J> The more adventurous alternative would be something like:
> J> 
> J> diff --git a/lib/libsysdecode/mktables b/lib/libsysdecode/mktables
> J> index bb784c853e48..61dc089a42c4 100644
> J> --- a/lib/libsysdecode/mktables
> J> +++ b/lib/libsysdecode/mktables
> J> @@ -64,7 +64,7 @@ _EOF_
> J>   sed -nE ${excl:+-e "/${excl}/d"} \
> J>      -e "/^#[[:space:]]*define[[:space:]]+${grep}/p" \
> J>      "${include_dir}/${file}" | \
> J> - sed -Ee 's/.*define[[:space:]]+([^[:space:]]+)\>.*/TABLE_ENTRY(\1)/'
> J> + sed -Ee 's/.*define[[:space:]]+([_[:alpha:]][_[:alnum:]]*).*/TABLE_ENTRY(\1)/'
> J>   fi
> J>  cat <<_EOF_
> J>  TABLE_END
> J> @@ -95,7 +95,7 @@ _EOF_
> J>   awk '/^(typedef[[:space:]]*)?enum([[:space:]].*)?\{/,
> J>                       /^\}([[:space:]].*)?;/' |
> J>   # pick out the constants we want
> J> - sed -Ene 's/^[[:space:]]*('"${grep}"')\>.*/TABLE_ENTRY(\1)/p'
> J> + sed -Ene 's/^[[:space:]]*('"${grep}"')([^_[:alnum:]].*|$)/TABLE_ENTRY(\1)/p'
> J>   fi
> J>  cat <<_EOF_
> J>  TABLE_END
> J> 
> J> 
> J> Tested only that the build produces a plausible tables.h on macOS, but
> J> I believe that in theory it only uses standard POSIX ERE features.
> 
> Jessica, can you please draw back your revertion request, since you got fix in the works?
> 
> I really don't want to see enum changes reverted.

Hi Gleb,
Thanks for the reply as someone involved with this set of changes and
able to comment on their importance; I’m not aware of the bigger
picture here.

If there are important changes that depend on it and people are happy
to go with this kind of approach, I can look at doing some tinderbox
builds to verify builds on FreeBSD at least aren’t modified (and that
Linux gets the same result, since I have a big Linux box available).
That should at least give re@ assurance about such a late-binding
change and help me sleep at night; I generally favour reverting to a
known state over fixing forwards, but probably we can avoid that here.

I’ll try and get some tinderbox builds kicked off later tonight.

Jessica