Page MenuHomeFreeBSD

libsysdecode: Teach mktables to handle enums
ClosedPublic

Authored by des on Wed, Jul 1, 11:12 AM.
Tags
None
Referenced Files
F161981283: D57993.diff
Wed, Jul 8, 2:43 PM
Unknown Object (File)
Tue, Jul 7, 10:55 PM
Unknown Object (File)
Mon, Jul 6, 5:04 AM
Unknown Object (File)
Sun, Jul 5, 4:10 PM
Unknown Object (File)
Sun, Jul 5, 4:10 PM
Unknown Object (File)
Sun, Jul 5, 6:49 AM
Unknown Object (File)
Sat, Jul 4, 4:42 PM
Unknown Object (File)
Sat, Jul 4, 1:26 PM
Subscribers

Details

Summary

While here, clean up and simplify the existing code.

MFC after: 1 week

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

des requested review of this revision.Wed, Jul 1, 11:12 AM

hmm, given awk's limited regex syntax I think it would be better to process the exclusion using sed and use awk only to pick out enums.

jhb added inline comments.
lib/libsysdecode/mktables
57

Having filter be local so it doesn't get created in the global namespace is still nice.

108

s/TABLE_NAME/TABLE_START/? (Old bug I think)

125

I think the only thing here is that this doesn't permit named enums, only enum {\n... }. That's fine for now I guess, but at some point the regex might have to be relaxed to allow a valid C identifier between enum and the {.

des marked 2 inline comments as done.Wed, Jul 1, 12:59 PM
des added inline comments.
lib/libsysdecode/mktables
125

yes it does, the ([[:space:]].*)? bit takes care of that, and I added support for a leading typedef after you commented. I don't want to make it more specific than that because technically there could be attributes (e.g. enum_extensibility) between the enum keyword and the identifier.

des marked 2 inline comments as done.Wed, Jul 1, 1:00 PM

further simplify the original code

Thanks a lot! Didn't review the awk/sed code, since not an expert in it.

This revision is now accepted and ready to land.Wed, Jul 1, 2:43 PM
jhb added inline comments.
lib/libsysdecode/mktables
125

I had misread the regex as only matching whitespace. It is pretty generic as you note, but I agree that it's probably not tenable to be more specific than just requiring at least one space before any other non-space characters.

This revision was automatically updated to reflect the committed changes.