On 16/06/2025 22:58, H. Peter Anvin wrote:
Support the case where speed_t is simply a number, and in that case
assume that arbitrary values can be passed.  This is assumed to be the
case when all known speed_t macros equal their own value.

Try to probe for a variety of speed_t constants by trying to coax
$(CC) into emitting macro definitions (-E -dM).  If this is not
supported, use a fairly extensive list of constants as a
fallback.  This both improves the test for arbitrary speed support, as
well as allowing proper operation in the case where the constants are
not plain numbers and allows for handing enumerated speed constants
that were not known a priori when the source code was written.

A simple shell script (mostly using sed) is used to turn the list of
constants (probed and predefined) into a pair of conversion functions,
baud_to_value() and value_to_baud(); string_to_baud() is then
reimplemented as a wrapper around the latter.  Using a shell script
hopefully should make this portable.


This looks good from a quick look.
I'll give it a more thorough review tomorrow.
Note we avoid TAB chars, but I've fixed that up locally,
so no need to resend just for that.

cheers,
Pádraig

Reply via email to