diff --git a/gobject/glib-mkenums.in b/gobject/glib-mkenums.in index 7658a8276..e0c0b39af 100755 --- a/gobject/glib-mkenums.in +++ b/gobject/glib-mkenums.in @@ -247,15 +247,12 @@ def parse_entries(file, file_name): if flags is None and value is not None and '<<' in value: seenbitshift = 1 - if seenprivate: - continue - if options is not None: options = parse_trigraph(options) if 'skip' not in options: - entries.append((name, value, options.get('nick'))) + entries.append((name, value, seenprivate, options.get('nick'))) else: - entries.append((name, value)) + entries.append((name, value, seenprivate)) else: m = re.match(r'''\s* /\*< (([^*]|\*(?!/))*) >\s*\*/ @@ -580,7 +577,7 @@ def process_file(curfilename): # Autogenerate a prefix if enum_prefix is None: for entry in entries: - if len(entry) < 3 or entry[2] is None: + if not entry[2] and (len(entry) < 4 or entry[3] is None): name = entry[0] if enum_prefix is not None: enum_prefix = os.path.commonprefix([name, enum_prefix]) @@ -601,10 +598,11 @@ def process_file(curfilename): for e in entries: name = e[0] num = e[1] - if len(e) < 3 or e[2] is None: + private = e[2] + if len(e) < 4 or e[3] is None: nick = re.sub(r'^' + enum_prefix, '', name) nick = nick.replace('_', '-').lower() - e = (name, num, nick) + e = (name, num, private, nick) fixed_entries.append(e) entries = fixed_entries @@ -720,7 +718,7 @@ def process_file(curfilename): next_num = 0 prod = replace_specials(prod) - for name, num, nick in entries: + for name, num, private, nick in entries: tmp_prod = prod if '\u0040valuenum\u0040' in prod: @@ -742,6 +740,9 @@ def process_file(curfilename): tmp_prod = tmp_prod.replace('\u0040valuenum\u0040', str(num)) next_num = int(num) + 1 + if private: + continue + tmp_prod = tmp_prod.replace('\u0040VALUENAME\u0040', name) tmp_prod = tmp_prod.replace('\u0040valuenick\u0040', nick) if flags: diff --git a/gobject/tests/mkenums.py b/gobject/tests/mkenums.py index 09b770281..51424e29e 100644 --- a/gobject/tests/mkenums.py +++ b/gobject/tests/mkenums.py @@ -649,7 +649,7 @@ comment: {standard_bottom_comment} "ENUM", "ENUM_VALUE_PUBLIC2", "public2", - "0", + "1", ) def test_available_in(self):