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

From: Gleb Smirnoff <glebius_at_freebsd.org>
Date: Thu, 19 Nov 2026 23:06:27 UTC
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.

-- 
Gleb Smirnoff