mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-13 15:56:23 +01:00
Merge branch '2327-mkenums-version-macros' into 'master'
glib-mkenums: Parse and skip deprecation/availability annotations Closes #2327 See merge request GNOME/glib!1984
This commit is contained in:
commit
327ea4e30d
@ -1220,7 +1220,7 @@ typedef enum {
|
||||
G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS = (1<<2),
|
||||
G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION = (1<<3),
|
||||
G_DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING = (1<<4),
|
||||
G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_REQUIRE_SAME_USER = (1<<5)
|
||||
G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_REQUIRE_SAME_USER GLIB_AVAILABLE_ENUMERATOR_IN_2_68 = (1<<5)
|
||||
} GDBusConnectionFlags;
|
||||
|
||||
/**
|
||||
@ -1383,7 +1383,7 @@ typedef enum
|
||||
G_DBUS_SERVER_FLAGS_NONE = 0,
|
||||
G_DBUS_SERVER_FLAGS_RUN_IN_THREAD = (1<<0),
|
||||
G_DBUS_SERVER_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS = (1<<1),
|
||||
G_DBUS_SERVER_FLAGS_AUTHENTICATION_REQUIRE_SAME_USER = (1<<2)
|
||||
G_DBUS_SERVER_FLAGS_AUTHENTICATION_REQUIRE_SAME_USER GLIB_AVAILABLE_ENUMERATOR_IN_2_68 = (1<<2)
|
||||
} GDBusServerFlags;
|
||||
|
||||
/**
|
||||
|
@ -87,7 +87,7 @@ typedef enum {
|
||||
G_URI_FLAGS_ENCODED_QUERY = 1 << 5,
|
||||
G_URI_FLAGS_ENCODED_PATH = 1 << 6,
|
||||
G_URI_FLAGS_ENCODED_FRAGMENT = 1 << 7,
|
||||
G_URI_FLAGS_SCHEME_NORMALIZE = 1 << 8,
|
||||
G_URI_FLAGS_SCHEME_NORMALIZE GLIB_AVAILABLE_ENUMERATOR_IN_2_68 = 1 << 8,
|
||||
} GUriFlags;
|
||||
|
||||
GLIB_AVAILABLE_IN_2_66
|
||||
|
@ -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
|
||||
|
||||
|
@ -650,6 +650,84 @@ comment: {standard_bottom_comment}
|
||||
"0",
|
||||
)
|
||||
|
||||
def test_available_in(self):
|
||||
"""Test GLIB_AVAILABLE_ENUMERATOR_IN_2_68 handling
|
||||
https://gitlab.gnome.org/GNOME/glib/-/issues/2327"""
|
||||
h_contents = """
|
||||
typedef enum {
|
||||
G_DBUS_SERVER_FLAGS_AUTHENTICATION_REQUIRE_SAME_USER GLIB_AVAILABLE_ENUMERATOR_IN_2_68 = (1<<2)
|
||||
} GDBusServerFlags;
|
||||
"""
|
||||
result = self.runMkenumsWithHeader(h_contents)
|
||||
self.assertEqual("", result.err)
|
||||
self.assertSingleEnum(
|
||||
result,
|
||||
"GDBusServerFlags",
|
||||
"g_dbus_server_flags",
|
||||
"G_DBUS_SERVER_FLAGS",
|
||||
"DBUS_SERVER_FLAGS",
|
||||
"G",
|
||||
"",
|
||||
"flags",
|
||||
"Flags",
|
||||
"FLAGS",
|
||||
"G_DBUS_SERVER_FLAGS_AUTHENTICATION_REQUIRE_SAME_USER",
|
||||
"user",
|
||||
"4",
|
||||
)
|
||||
|
||||
def test_deprecated_in(self):
|
||||
"""Test GLIB_DEPRECATED_ENUMERATOR_IN_2_68 handling
|
||||
https://gitlab.gnome.org/GNOME/glib/-/issues/2327"""
|
||||
h_contents = """
|
||||
typedef enum {
|
||||
G_DBUS_SERVER_FLAGS_AUTHENTICATION_REQUIRE_SAME_USER GLIB_DEPRECATED_ENUMERATOR_IN_2_68 = (1<<2)
|
||||
} GDBusServerFlags;
|
||||
"""
|
||||
result = self.runMkenumsWithHeader(h_contents)
|
||||
self.assertEqual("", result.err)
|
||||
self.assertSingleEnum(
|
||||
result,
|
||||
"GDBusServerFlags",
|
||||
"g_dbus_server_flags",
|
||||
"G_DBUS_SERVER_FLAGS",
|
||||
"DBUS_SERVER_FLAGS",
|
||||
"G",
|
||||
"",
|
||||
"flags",
|
||||
"Flags",
|
||||
"FLAGS",
|
||||
"G_DBUS_SERVER_FLAGS_AUTHENTICATION_REQUIRE_SAME_USER",
|
||||
"user",
|
||||
"4",
|
||||
)
|
||||
|
||||
def test_deprecated_in_for(self):
|
||||
"""Test GLIB_DEPRECATED_ENUMERATOR_IN_2_68_FOR() handling
|
||||
https://gitlab.gnome.org/GNOME/glib/-/issues/2327"""
|
||||
h_contents = """
|
||||
typedef enum {
|
||||
G_DBUS_SERVER_FLAGS_AUTHENTICATION_REQUIRE_SAME_USER GLIB_DEPRECATED_ENUMERATOR_IN_2_68_FOR(G_DBUS_SERVER_FLAGS_AUTHENTICATION_REQUIRE_SAME_USER2) = (1<<2)
|
||||
} GDBusServerFlags;
|
||||
"""
|
||||
result = self.runMkenumsWithHeader(h_contents)
|
||||
self.assertEqual("", result.err)
|
||||
self.assertSingleEnum(
|
||||
result,
|
||||
"GDBusServerFlags",
|
||||
"g_dbus_server_flags",
|
||||
"G_DBUS_SERVER_FLAGS",
|
||||
"DBUS_SERVER_FLAGS",
|
||||
"G",
|
||||
"",
|
||||
"flags",
|
||||
"Flags",
|
||||
"FLAGS",
|
||||
"G_DBUS_SERVER_FLAGS_AUTHENTICATION_REQUIRE_SAME_USER",
|
||||
"user",
|
||||
"4",
|
||||
)
|
||||
|
||||
|
||||
class TestRspMkenums(TestMkenums):
|
||||
"""Run all tests again in @rspfile mode"""
|
||||
|
Loading…
Reference in New Issue
Block a user