Commit 065c00a9 authored by Adrien Plazas's avatar Adrien Plazas
Browse files

Use G_GNUC_WARN_UNUSED_RESULT in prototypes

This will warn users of the C API (and ourselves) in case we mistakenly
ignore a returned value that transfers a resource to the caller.

Fixes #127
parent 42b5d40c
Pipeline #286215 passed with stages
in 4 minutes and 35 seconds
......@@ -37,7 +37,7 @@ struct _AdwActionRowClass
};
ADW_AVAILABLE_IN_ALL
GtkWidget *adw_action_row_new (void);
GtkWidget *adw_action_row_new (void) G_GNUC_WARN_UNUSED_RESULT;
ADW_AVAILABLE_IN_ALL
const char *adw_action_row_get_subtitle (AdwActionRow *self);
......
......@@ -32,7 +32,7 @@ AdwAnimation *adw_animation_new (GtkWidget *widget,
AdwAnimationEasingFunc easing_func,
AdwAnimationValueCallback value_cb,
AdwAnimationDoneCallback done_cb,
gpointer user_data);
gpointer user_data) G_GNUC_WARN_UNUSED_RESULT;
AdwAnimation *adw_animation_ref (AdwAnimation *self);
void adw_animation_unref (AdwAnimation *self);
......
......@@ -30,7 +30,7 @@ struct _AdwApplicationWindowClass
};
ADW_AVAILABLE_IN_ALL
GtkWidget *adw_application_window_new (GtkApplication *app);
GtkWidget *adw_application_window_new (GtkApplication *app) G_GNUC_WARN_UNUSED_RESULT;
ADW_AVAILABLE_IN_ALL
void adw_application_window_set_child (AdwApplicationWindow *self,
......
......@@ -25,7 +25,7 @@ G_DECLARE_FINAL_TYPE (AdwAvatar, adw_avatar, ADW, AVATAR, GtkWidget)
ADW_AVAILABLE_IN_ALL
GtkWidget *adw_avatar_new (int size,
const char *text,
gboolean show_initials);
gboolean show_initials) G_GNUC_WARN_UNUSED_RESULT;
ADW_AVAILABLE_IN_ALL
const char *adw_avatar_get_icon_name (AdwAvatar *self);
......@@ -60,6 +60,6 @@ void adw_avatar_set_size (AdwAvatar *self,
ADW_AVAILABLE_IN_ALL
GdkPixbuf *adw_avatar_draw_to_pixbuf (AdwAvatar *self,
int size,
int scale_factor);
int scale_factor) G_GNUC_WARN_UNUSED_RESULT;
G_END_DECLS
......@@ -29,7 +29,7 @@ struct _AdwBinClass
};
ADW_AVAILABLE_IN_ALL
GtkWidget *adw_bin_new (void);
GtkWidget *adw_bin_new (void) G_GNUC_WARN_UNUSED_RESULT;
ADW_AVAILABLE_IN_ALL
GtkWidget *adw_bin_get_child (AdwBin *self);
......
......@@ -23,7 +23,7 @@ ADW_AVAILABLE_IN_ALL
G_DECLARE_FINAL_TYPE (AdwCarouselIndicatorDots, adw_carousel_indicator_dots, ADW, CAROUSEL_INDICATOR_DOTS, GtkWidget)
ADW_AVAILABLE_IN_ALL
GtkWidget *adw_carousel_indicator_dots_new (void);
GtkWidget *adw_carousel_indicator_dots_new (void) G_GNUC_WARN_UNUSED_RESULT;
ADW_AVAILABLE_IN_ALL
AdwCarousel *adw_carousel_indicator_dots_get_carousel (AdwCarouselIndicatorDots *self);
......
......@@ -23,7 +23,7 @@ ADW_AVAILABLE_IN_ALL
G_DECLARE_FINAL_TYPE (AdwCarouselIndicatorLines, adw_carousel_indicator_lines, ADW, CAROUSEL_INDICATOR_LINES, GtkWidget)
ADW_AVAILABLE_IN_ALL
GtkWidget *adw_carousel_indicator_lines_new (void);
GtkWidget *adw_carousel_indicator_lines_new (void) G_GNUC_WARN_UNUSED_RESULT;
ADW_AVAILABLE_IN_ALL
AdwCarousel *adw_carousel_indicator_lines_get_carousel (AdwCarouselIndicatorLines *self);
......
......@@ -22,7 +22,7 @@ ADW_AVAILABLE_IN_ALL
G_DECLARE_FINAL_TYPE (AdwCarousel, adw_carousel, ADW, CAROUSEL, GtkWidget)
ADW_AVAILABLE_IN_ALL
GtkWidget *adw_carousel_new (void);
GtkWidget *adw_carousel_new (void) G_GNUC_WARN_UNUSED_RESULT;
ADW_AVAILABLE_IN_ALL
void adw_carousel_prepend (AdwCarousel *self,
......
......@@ -22,7 +22,7 @@ ADW_AVAILABLE_IN_ALL
G_DECLARE_FINAL_TYPE (AdwClampLayout, adw_clamp_layout, ADW, CLAMP_LAYOUT, GtkLayoutManager)
ADW_AVAILABLE_IN_ALL
GtkLayoutManager *adw_clamp_layout_new (void);
GtkLayoutManager *adw_clamp_layout_new (void) G_GNUC_WARN_UNUSED_RESULT;
ADW_AVAILABLE_IN_ALL
int adw_clamp_layout_get_maximum_size (AdwClampLayout *self);
......
......@@ -22,7 +22,7 @@ ADW_AVAILABLE_IN_ALL
G_DECLARE_FINAL_TYPE (AdwClampScrollable, adw_clamp_scrollable, ADW, CLAMP_SCROLLABLE, GtkWidget)
ADW_AVAILABLE_IN_ALL
GtkWidget *adw_clamp_scrollable_new (void);
GtkWidget *adw_clamp_scrollable_new (void) G_GNUC_WARN_UNUSED_RESULT;
ADW_AVAILABLE_IN_ALL
GtkWidget *adw_clamp_scrollable_get_child (AdwClampScrollable *self);
......
......@@ -22,7 +22,7 @@ ADW_AVAILABLE_IN_ALL
G_DECLARE_FINAL_TYPE (AdwClamp, adw_clamp, ADW, CLAMP, GtkWidget)
ADW_AVAILABLE_IN_ALL
GtkWidget *adw_clamp_new (void);
GtkWidget *adw_clamp_new (void) G_GNUC_WARN_UNUSED_RESULT;
ADW_AVAILABLE_IN_ALL
GtkWidget *adw_clamp_get_child (AdwClamp *self);
......
......@@ -36,7 +36,7 @@ struct _AdwComboRowClass
};
ADW_AVAILABLE_IN_ALL
GtkWidget *adw_combo_row_new (void);
GtkWidget *adw_combo_row_new (void) G_GNUC_WARN_UNUSED_RESULT;
ADW_AVAILABLE_IN_ALL
GListModel *adw_combo_row_get_model (AdwComboRow *self);
......
......@@ -23,7 +23,7 @@ ADW_AVAILABLE_IN_ALL
G_DECLARE_FINAL_TYPE (AdwEnumListModel, adw_enum_list_model, ADW, ENUM_LIST_MODEL, GObject)
ADW_AVAILABLE_IN_ALL
AdwEnumListModel *adw_enum_list_model_new (GType enum_type);
AdwEnumListModel *adw_enum_list_model_new (GType enum_type) G_GNUC_WARN_UNUSED_RESULT;
ADW_AVAILABLE_IN_ALL
GType adw_enum_list_model_get_enum_type (AdwEnumListModel *self);
......
......@@ -14,6 +14,6 @@
G_BEGIN_DECLS
AdwEnumValueObject *adw_enum_value_object_new (GEnumValue *enum_value);
AdwEnumValueObject *adw_enum_value_object_new (GEnumValue *enum_value) G_GNUC_WARN_UNUSED_RESULT;
G_END_DECLS
......@@ -35,7 +35,7 @@ struct _AdwExpanderRowClass
};
ADW_AVAILABLE_IN_ALL
GtkWidget *adw_expander_row_new (void);
GtkWidget *adw_expander_row_new (void) G_GNUC_WARN_UNUSED_RESULT;
ADW_AVAILABLE_IN_ALL
const char *adw_expander_row_get_subtitle (AdwExpanderRow *self);
......
......@@ -35,7 +35,7 @@ typedef enum {
} AdwFlapTransitionType;
ADW_AVAILABLE_IN_ALL
GtkWidget *adw_flap_new (void);
GtkWidget *adw_flap_new (void) G_GNUC_WARN_UNUSED_RESULT;
ADW_AVAILABLE_IN_ALL
GtkWidget *adw_flap_get_content (AdwFlap *self);
......
......@@ -47,6 +47,6 @@ GtkWidget *adw_gizmo_new (const char *css_name,
AdwGizmoSnapshotFunc snapshot_func,
AdwGizmoContainsFunc contains_func,
AdwGizmoFocusFunc focus_func,
AdwGizmoGrabFocusFunc grab_focus_func);
AdwGizmoGrabFocusFunc grab_focus_func) G_GNUC_WARN_UNUSED_RESULT;
G_END_DECLS
......@@ -42,7 +42,7 @@ typedef enum {
} AdwCenteringPolicy;
ADW_AVAILABLE_IN_ALL
GtkWidget *adw_header_bar_new (void);
GtkWidget *adw_header_bar_new (void) G_GNUC_WARN_UNUSED_RESULT;
ADW_AVAILABLE_IN_ALL
GtkWidget *adw_header_bar_get_title_widget (AdwHeaderBar *self);
......
......@@ -20,7 +20,7 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (AdwIndicatorBin, adw_indicator_bin, ADW, INDICATOR_BIN, GtkWidget)
GtkWidget *adw_indicator_bin_new (void);
GtkWidget *adw_indicator_bin_new (void) G_GNUC_WARN_UNUSED_RESULT;
GtkWidget *adw_indicator_bin_get_child (AdwIndicatorBin *self);
void adw_indicator_bin_set_child (AdwIndicatorBin *self,
......
......@@ -50,7 +50,7 @@ typedef enum {
} AdwLeafletTransitionType;
ADW_AVAILABLE_IN_ALL
GtkWidget *adw_leaflet_new (void);
GtkWidget *adw_leaflet_new (void) G_GNUC_WARN_UNUSED_RESULT;
ADW_AVAILABLE_IN_ALL
AdwLeafletPage *adw_leaflet_append (AdwLeaflet *self,
......@@ -158,6 +158,6 @@ void adw_leaflet_set_can_unfold (AdwLeaflet *self,
gboolean can_unfold);
ADW_AVAILABLE_IN_ALL
GtkSelectionModel *adw_leaflet_get_pages (AdwLeaflet *self);
GtkSelectionModel *adw_leaflet_get_pages (AdwLeaflet *self) G_GNUC_WARN_UNUSED_RESULT;
G_END_DECLS
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment