GNOME Bugzilla – Bug 795008
glib-mkenums breaks if option specified but no nick
Last modified: 2018-05-24 20:21:08 UTC
gegl has an enum like this: typedef enum { GEGL_SAMPLER_NEAREST = 0, /*< desc="nearest" >*/ GEGL_SAMPLER_LINEAR, /*< desc="linear" >*/ GEGL_SAMPLER_CUBIC, /*< desc="cubic" >*/ GEGL_SAMPLER_LOHALO /*< desc="lohalo" >*/ } GeglSamplerType; I.e. it has an options field, but it doesn't specify the nick. The new glib-mkenums crashes on this with: Traceback (most recent call last):
+ Trace 238536
process_file(fname)
parse_entries(curfile, curfilename)
entries.append((name, value, options['nick']))
Because apparently this code: if options is not None: options = parse_trigraph(options) if 'skip' not in options: entries.append((name, value, options['nick'])) Does not handle skip not being set, and nick being unset. This should probably be options.get('nick', None) or something.
Created attachment 371481 [details] [review] Ignore other per value options than 'skip' and 'nick' I stumbled upon this problem today, and made this patch before I went looking to see if anyone else had seen it too.
The patch also applies to the 2.54 branch and the 2.56 branch, and should be applied there in addition to master.
Review of attachment 371481 [details] [review]: Seems reasonable, thanks. I’ve written some tests for it which I’ll attach for review shortly.
Created attachment 371611 [details] [review] tests: Add initial test framework for glib-mkenums This allows running glib-mkenums with different C headers and checking its output. Signed-off-by: Philip Withnall <withnall@endlessm.com>
Created attachment 371612 [details] [review] tests: Add glib-mkenums test for missing nicks This adds a test to verify the change from bug #795008. Signed-off-by: Philip Withnall <withnall@endlessm.com>
Review of attachment 371611 [details] [review]: This needs autotools support, and needs tests for other historic glib-mkenums bugs to be added. The overall approach and framework is ready to review though.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/1360.