diff options
author | Philip Withnall <pwithnall@endlessos.org> | 2021-03-10 19:48:22 +0000 |
---|---|---|
committer | Philip Withnall <pwithnall@endlessos.org> | 2021-03-11 13:37:49 +0000 |
commit | 856aeba9e453e67dc5cc308d1f099f133f1f629c (patch) | |
tree | b2783e66d582b0bbfd61531a717160f7c0648af0 /gobject/glib-mkenums.in | |
parent | c80528f17ba25ea7d7089946926b93a98bd1479e (diff) | |
download | glib-856aeba9e453e67dc5cc308d1f099f133f1f629c.tar.gz |
glib-mkenums: Parse and skip deprecation/availability annotations
Teach `glib-mkenums` how to parse and ignore:
- `GLIB_AVAILABLE_ENUMERATOR_IN_x_xx`
- `GLIB_DEPRECATED_ENUMERATOR_IN_x_xx`
- `GLIB_DEPRECATED_ENUMERATOR_IN_x_xx_FOR(x)`
Future work could expose the deprecation/availability information as
substitutions in the template file, but this commit does not do that.
It does, however, add some unit tests for the annotations.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Fixes: #2327
Diffstat (limited to 'gobject/glib-mkenums.in')
-rwxr-xr-x | gobject/glib-mkenums.in | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gobject/glib-mkenums.in b/gobject/glib-mkenums.in index 199868039..b996a733a 100755 --- a/gobject/glib-mkenums.in +++ b/gobject/glib-mkenums.in @@ -219,6 +219,7 @@ def parse_entries(file, file_name): m = re.match(r'''\s* (\w+)\s* # name + (\s+[A-Z]+_(?:AVAILABLE|DEPRECATED)_ENUMERATOR_IN_[0-9_]+(?:_FOR\s*\(\s*\w+\s*\))?\s*)? # availability (?:=( # value \s*\w+\s*\(.*\)\s* # macro with multiple args | # OR @@ -231,12 +232,15 @@ def parse_entries(file, file_name): if m: groups = m.groups() name = groups[0] + availability = None value = None options = None if len(groups) > 1: - value = groups[1] + availability = groups[1] if len(groups) > 2: - options = groups[2] + value = groups[2] + if len(groups) > 3: + options = groups[3] if flags is None and value is not None and '<<' in value: seenbitshift = 1 |