From ad9cd1762a3493fcf3842bb7f91d847e4aba14ce Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Mon, 15 Jan 2024 21:55:36 -0800 Subject: [PATCH] girepository: Remove GI_FUNCTION_THROWS and GI_VFUNC_THROWS flags These flags were replaced by gi_callable_info_can_throw_error() in girepository 1.x, but the flags were maintained for backwards compatibility. No need to hold on to them in the 2.x API. Note that these flags are also still maintained as separate bits in the binary format, which is not changing. So, they still need to be read from FunctionBlob and VFuncBlob if the bit is not set in SignatureBlob. This is an API break for girepository 2.x, which is OK because the API has never been released yet. --- girepository/gifunctioninfo.c | 3 --- girepository/gitypes.h | 4 ---- girepository/givfuncinfo.c | 3 --- girepository/tests/throws.c | 3 --- 4 files changed, 13 deletions(-) diff --git a/girepository/gifunctioninfo.c b/girepository/gifunctioninfo.c index 9b3b1e8d6..c43f74cf3 100644 --- a/girepository/gifunctioninfo.c +++ b/girepository/gifunctioninfo.c @@ -140,9 +140,6 @@ gi_function_info_get_flags (GIFunctionInfo *info) if (blob->wraps_vfunc) flags = flags | GI_FUNCTION_WRAPS_VFUNC; - if (blob->throws) - flags = flags | GI_FUNCTION_THROWS; - return flags; } diff --git a/girepository/gitypes.h b/girepository/gitypes.h index 587b8ec7f..658043e2b 100644 --- a/girepository/gitypes.h +++ b/girepository/gitypes.h @@ -441,7 +441,6 @@ typedef enum * @GI_VFUNC_MUST_CHAIN_UP: chains up to the parent type * @GI_VFUNC_MUST_OVERRIDE: overrides * @GI_VFUNC_MUST_NOT_OVERRIDE: does not override - * @GI_VFUNC_THROWS: includes a [type@GLib.Error] * * Flags of a [class@GIRepository.VFuncInfo] struct. * @@ -452,7 +451,6 @@ typedef enum GI_VFUNC_MUST_CHAIN_UP = 1 << 0, GI_VFUNC_MUST_OVERRIDE = 1 << 1, GI_VFUNC_MUST_NOT_OVERRIDE = 1 << 2, - GI_VFUNC_THROWS = 1 << 3 } GIVFuncInfoFlags; /** @@ -462,7 +460,6 @@ typedef enum * @GI_FUNCTION_IS_GETTER: is a getter of a [class@GIRepository.PropertyInfo]. * @GI_FUNCTION_IS_SETTER: is a setter of a [class@GIRepository.PropertyInfo]. * @GI_FUNCTION_WRAPS_VFUNC: represents a virtual function. - * @GI_FUNCTION_THROWS: the function may throw an error. * * Flags for a [class@GIRepository.FunctionInfo] struct. * @@ -475,7 +472,6 @@ typedef enum GI_FUNCTION_IS_GETTER = 1 << 2, GI_FUNCTION_IS_SETTER = 1 << 3, GI_FUNCTION_WRAPS_VFUNC = 1 << 4, - GI_FUNCTION_THROWS = 1 << 5 } GIFunctionInfoFlags; G_END_DECLS diff --git a/girepository/givfuncinfo.c b/girepository/givfuncinfo.c index 0e61d598d..cc49307d9 100644 --- a/girepository/givfuncinfo.c +++ b/girepository/givfuncinfo.c @@ -104,9 +104,6 @@ gi_vfunc_info_get_flags (GIVFuncInfo *info) if (blob->must_not_be_implemented) flags = flags | GI_VFUNC_MUST_NOT_OVERRIDE; - if (blob->throws) - flags = flags | GI_VFUNC_THROWS; - return flags; } diff --git a/girepository/tests/throws.c b/girepository/tests/throws.c index 170c92ebd..2849e5364 100644 --- a/girepository/tests/throws.c +++ b/girepository/tests/throws.c @@ -37,7 +37,6 @@ test_invoke_gerror (RepositoryFixture *fx, func_info = GI_FUNCTION_INFO (gi_repository_find_by_name (fx->repository, "GLib", "file_read_link")); g_assert_nonnull (func_info); - g_assert_true (gi_function_info_get_flags (func_info) & GI_FUNCTION_THROWS); g_assert_true (gi_callable_info_can_throw_gerror (GI_CALLABLE_INFO (func_info))); in_arg[0].v_string = g_strdup ("non-existent-file/hope"); @@ -66,12 +65,10 @@ test_vfunc_can_throw_gerror (RepositoryFixture *fx, invoker_info = gi_interface_info_find_method (interface_info, "launch"); g_assert_nonnull (invoker_info); - g_assert_true (gi_function_info_get_flags (invoker_info) & GI_FUNCTION_THROWS); g_assert_true (gi_callable_info_can_throw_gerror (GI_CALLABLE_INFO (invoker_info))); vfunc_info = gi_interface_info_find_vfunc (interface_info, "launch"); g_assert_nonnull (vfunc_info); - g_assert_true (gi_vfunc_info_get_flags (vfunc_info) & GI_VFUNC_THROWS); g_assert_true (gi_callable_info_can_throw_gerror (GI_CALLABLE_INFO (vfunc_info))); g_clear_pointer (&vfunc_info, gi_base_info_unref);