After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 794506 - glib-mkenums: Enters infinite loop if using typedef enum SomeIdentifier { }
glib-mkenums: Enters infinite loop if using typedef enum SomeIdentifier { }
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: build
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2018-03-20 01:23 UTC by Sam Spilsbury
Modified: 2018-03-21 15:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
glib-mkenums: Don't treat typedef enum _SomeIdentifier {} as syntax error (1.10 KB, patch)
2018-03-20 01:28 UTC, Sam Spilsbury
committed Details | Review
glib-mkenums: Don't go into an infinite loop trying to match { (1.00 KB, patch)
2018-03-20 01:28 UTC, Sam Spilsbury
committed Details | Review

Description Sam Spilsbury 2018-03-20 01:23:23 UTC
As the summary states, if I use

    typedef enum _SomeEnumIdentifier {
        ENUM_VALUE
    } SomeEnumIdentifier;

to define one of my enums, glib-mkenums goes into an infinite loop, because it is unable to match typedef enum _SomeEnumIdentifier .

There's really two issues here

1) glib-mkenums should error out when it detects the purported syntax error
2) The above is valid syntax, and glib-mkenums should handle it.
Comment 1 Sam Spilsbury 2018-03-20 01:28:12 UTC
Created attachment 369884 [details] [review]
glib-mkenums: Don't treat typedef enum _SomeIdentifier {} as syntax error
Comment 2 Sam Spilsbury 2018-03-20 01:28:38 UTC
Created attachment 369885 [details] [review]
glib-mkenums: Don't go into an infinite loop trying to match {
Comment 3 Philip Withnall 2018-03-21 15:04:28 UTC
Review of attachment 369884 [details] [review]:

I wish we had a test suite for glib-mkenums; this would be a perfect test case to add to it (thanks for the detailed description). Unless you particularly want to write one, this patch shouldn’t block on it though.
Comment 4 Philip Withnall 2018-03-21 15:05:14 UTC
Review of attachment 369885 [details] [review]:

++
Comment 5 Philip Withnall 2018-03-21 15:12:12 UTC
Pushed to master. I’ll backport to glib-2-56 too.

Attachment 369884 [details] pushed as 7027a12 - glib-mkenums: Don't treat typedef enum _SomeIdentifier {} as syntax error
Attachment 369885 [details] pushed as 5e02a9f - glib-mkenums: Don't go into an infinite loop trying to match {
Comment 6 Philip Withnall 2018-03-21 15:20:17 UTC
Backported to glib-2-56:

3c5e8a65f (HEAD -> glib-2-56, origin/glib-2-56) glib-mkenums: Don't go into an infinite loop trying to find a matching {
145e45f55 glib-mkenums: Don't treat typedef enum _SomeIdentifier {} as syntax error