Page MenuHomeFreeBSD

libsysdecode: Teach mktables to handle enums
ClosedPublic

Authored by des on Wed, Jul 1, 11:12 AM.
Tags
None
Referenced Files
F162893857: D57993.id181168.diff
Sat, Jul 18, 2:16 AM
Unknown Object (File)
Thu, Jul 16, 5:25 AM
Unknown Object (File)
Thu, Jul 16, 4:55 AM
Unknown Object (File)
Thu, Jul 16, 4:13 AM
Unknown Object (File)
Thu, Jul 16, 2:57 AM
Unknown Object (File)
Thu, Jul 16, 1:51 AM
Unknown Object (File)
Wed, Jul 15, 7:28 AM
Unknown Object (File)
Wed, Jul 15, 7:28 AM
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 Skipped
Unit
Tests Skipped
Build Status
Buildable 74462
Build 71345: arc lint + arc unit

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.

85

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

102

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
102

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
102

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.

I've merged this to stable/15 but not stable/14 since it does not have the changes to <sys/socket.h> or <sys/netpfil/pf/pf_nl.h> which necessitated the change.