We can do this in the caller with ferror()
or setting errno = 0
or whatever. We could distinguish this in the generated code, and explicitly return a different value.
I'm not convinced I actually do want to handle this in the generated code, because it only applies to FSM_IO_GETC
(you can't have a read error for any other IO API, just hit EOT). Perhaps this is the responsibility of the caller, because they provide the getc callback in the first place.