[glib/wip/meson: 53/53] glib-mkenums: fix parsing of /*< flags >*/ annotation



commit 392d1aebdcd4b61cf783d2f90eb02b3836c45f21
Author: Tim-Philipp Müller <tim centricular com>
Date:   Sat May 13 14:56:29 2017 +0100

    glib-mkenums: fix parsing of /*< flags >*/ annotation
    
    Fixes get_type function generation for:
    
     - GMountMountFlags
     - GDriveStartFlags
     - GResourceLookupFlags
     - GSocketMsgFlags
     - GTlsDatabaseVerifyFlags
     - GTestDBusFlags
    
    which were registered as enum types before, which broke
    some unit tests.
    
    Problem is that the flags annotation has no value, so
    options.get('flags') would always return None even if
    it was present.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=779332

 gobject/glib-mkenums.in |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/gobject/glib-mkenums.in b/gobject/glib-mkenums.in
index f32dbf0..84219e7 100755
--- a/gobject/glib-mkenums.in
+++ b/gobject/glib-mkenums.in
@@ -19,7 +19,7 @@ version = '@GLIB_VERSION@'
 
 # glib-mkenums.py
 # Information about the current enumeration
-flags = None # Is enumeration a bitmask?
+flags = False               # Is enumeration a bitmask?
 option_underscore_name = '' # Overriden underscore variant of the enum name
                             # for example to fix the cases we don't get the
                             # mixed-case -> underscorized transform right.
@@ -126,7 +126,7 @@ def parse_entries(file, file_name):
                 value = groups[1]
             if len(groups) > 2:
                 options = groups[2]
-            if flags is None and value is not None and '<<' in value:
+            if not flags and value is not None and '<<' in value:
                 seenbitshift = 1
 
             if options is not None:
@@ -339,12 +339,12 @@ def process_file(curfilename):
                 if 'skip' in options:
                     continue
                 enum_prefix = options.get('prefix', None)
-                flags = options.get('flags', None)
+                flags = 'flags' in options
                 option_lowercase_name = options.get('lowercase_name', None)
                 option_underscore_name = options.get('underscore_name', None)
             else:
                 enum_prefix = None
-                flags = None
+                flags = False
                 option_lowercase_name = None
                 option_underscore_name = None
 
@@ -369,7 +369,7 @@ def process_file(curfilename):
             parse_entries(curfile, curfilename);
 
             # figure out if this was a flags or enums enumeration
-            if flags is None:
+            if not flags:
                 flags = seenbitshift
 
             # Autogenerate a prefix


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]