Page MenuHomeFreeBSD

libsysdecode: Teach mktables to handle enums
ClosedPublic

Authored by des on Wed, Jul 1, 11:12 AM.
Tags
None
Referenced Files
F162147049: D57993.id181168.diff
Fri, Jul 10, 7:07 AM
F162146363: D57993.id181176.diff
Fri, Jul 10, 6:53 AM
F162142851: D57993.id.diff
Fri, Jul 10, 5:57 AM
F162077928: D57993.id181175.diff
Thu, Jul 9, 12:50 PM
Unknown Object (File)
Thu, Jul 9, 7:44 AM
Unknown Object (File)
Thu, Jul 9, 4:21 AM
Unknown Object (File)
Wed, Jul 8, 2:43 PM
Unknown Object (File)
Tue, Jul 7, 10:55 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 Skipped
Unit
Tests Skipped
Build Status
Buildable 74463
Build 71346: 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.

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.

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.