[retro-gtk] Use G_GNUC_WARN_UNUSED_RESULT
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [retro-gtk] Use G_GNUC_WARN_UNUSED_RESULT
- Date: Fri, 9 Apr 2021 20:46:12 +0000 (UTC)
commit 4907e7426504b9b325f80a5f983612b94d8334dd
Author: Adrien Plazas <kekun plazas laposte net>
Date: Sat Dec 19 12:33:05 2020 +0100
Use G_GNUC_WARN_UNUSED_RESULT
This will help our users catch potential leaks by making clearer the
returned values shouldn't be ignored.
retro-gtk/retro-controller-iterator-private.h | 2 +-
retro-gtk/retro-core-descriptor.h | 20 ++++++++++----------
retro-gtk/retro-core-view.h | 4 ++--
retro-gtk/retro-core.h | 6 +++---
retro-gtk/retro-gl-display-private.h | 2 +-
retro-gtk/retro-key-joypad-mapping.h | 4 ++--
retro-gtk/retro-module-iterator.h | 4 ++--
retro-gtk/retro-module-query.h | 4 ++--
retro-gtk/retro-option-iterator-private.h | 2 +-
retro-gtk/retro-pixdata.c | 7 +++++++
retro-gtk/retro-pixdata.h | 4 ++--
retro-gtk/retro-runner-process-private.h | 2 +-
retro-runner/retro-core.h | 2 +-
retro-runner/retro-input-descriptor-private.h | 4 ++--
retro-runner/retro-pa-player-private.h | 2 +-
shared/retro-input.h | 4 ++--
16 files changed, 40 insertions(+), 33 deletions(-)
---
diff --git a/retro-gtk/retro-controller-iterator-private.h b/retro-gtk/retro-controller-iterator-private.h
index ec794c1..54ee283 100644
--- a/retro-gtk/retro-controller-iterator-private.h
+++ b/retro-gtk/retro-controller-iterator-private.h
@@ -13,6 +13,6 @@ G_BEGIN_DECLS
typedef RetroController * (*RetroControllerIteratorGetController) (gpointer data);
RetroControllerIterator *retro_controller_iterator_new (GHashTable *controllers,
- RetroControllerIteratorGetController func);
+ RetroControllerIteratorGetController func)
G_GNUC_WARN_UNUSED_RESULT;
G_END_DECLS
diff --git a/retro-gtk/retro-core-descriptor.h b/retro-gtk/retro-core-descriptor.h
index 4417277..b7760b8 100644
--- a/retro-gtk/retro-core-descriptor.h
+++ b/retro-gtk/retro-core-descriptor.h
@@ -16,7 +16,7 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (RetroCoreDescriptor, retro_core_descriptor, RETRO, CORE_DESCRIPTOR, GObject)
RetroCoreDescriptor *retro_core_descriptor_new (const gchar *filename,
- GError **error);
+ GError **error) G_GNUC_WARN_UNUSED_RESULT;
gboolean retro_core_descriptor_has_icon (RetroCoreDescriptor *self,
GError **error);
gchar *retro_core_descriptor_get_uri (RetroCoreDescriptor *self);
@@ -26,13 +26,13 @@ gboolean retro_core_descriptor_get_is_game (RetroCoreDescriptor *self,
gboolean retro_core_descriptor_get_is_emulator (RetroCoreDescriptor *self,
GError **error);
char *retro_core_descriptor_get_name (RetroCoreDescriptor *self,
- GError **error);
+ GError **error) G_GNUC_WARN_UNUSED_RESULT;
GIcon *retro_core_descriptor_get_icon (RetroCoreDescriptor *self,
- GError **error);
+ GError **error) G_GNUC_WARN_UNUSED_RESULT;
char *retro_core_descriptor_get_module (RetroCoreDescriptor *self,
- GError **error);
+ GError **error) G_GNUC_WARN_UNUSED_RESULT;
GFile *retro_core_descriptor_get_module_file (RetroCoreDescriptor *self,
- GError **error);
+ GError **error) G_GNUC_WARN_UNUSED_RESULT;
gboolean retro_core_descriptor_has_platform (RetroCoreDescriptor *self,
const gchar *platform);
gboolean retro_core_descriptor_has_firmwares (RetroCoreDescriptor *self,
@@ -47,20 +47,20 @@ gboolean retro_core_descriptor_has_firmware_sha512 (RetroCoreDescriptor *self,
gchar **retro_core_descriptor_get_mime_type (RetroCoreDescriptor *self,
const gchar *platform,
gsize *length,
- GError **error);
+ GError **error) G_GNUC_WARN_UNUSED_RESULT;
gchar **retro_core_descriptor_get_firmwares (RetroCoreDescriptor *self,
const gchar *platform,
gsize *length,
- GError **error);
+ GError **error) G_GNUC_WARN_UNUSED_RESULT;
gchar *retro_core_descriptor_get_firmware_path (RetroCoreDescriptor *self,
const gchar *firmware,
- GError **error);
+ GError **error) G_GNUC_WARN_UNUSED_RESULT;
gchar * retro_core_descriptor_get_firmware_md5 (RetroCoreDescriptor *self,
const gchar *firmware,
- GError **error);
+ GError **error) G_GNUC_WARN_UNUSED_RESULT;
gchar * retro_core_descriptor_get_firmware_sha512 (RetroCoreDescriptor *self,
const gchar *firmware,
- GError **error);
+ GError **error) G_GNUC_WARN_UNUSED_RESULT;
gboolean retro_core_descriptor_get_is_firmware_mandatory (RetroCoreDescriptor *self,
const gchar *firmware,
GError **error);
diff --git a/retro-gtk/retro-core-view.h b/retro-gtk/retro-core-view.h
index c33dd3f..4527b6e 100644
--- a/retro-gtk/retro-core-view.h
+++ b/retro-gtk/retro-core-view.h
@@ -19,7 +19,7 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (RetroCoreView, retro_core_view, RETRO, CORE_VIEW, GtkEventBox)
-RetroCoreView *retro_core_view_new (void);
+RetroCoreView *retro_core_view_new (void) G_GNUC_WARN_UNUSED_RESULT;
void retro_core_view_set_core (RetroCoreView *self,
RetroCore *core);
@@ -32,7 +32,7 @@ void retro_core_view_set_key_joypad_mapping (RetroCoreView *self,
RetroKeyJoypadMapping *mapping);
RetroKeyJoypadMapping *retro_core_view_get_key_joypad_mapping (RetroCoreView *self);
RetroController *retro_core_view_as_controller (RetroCoreView *self,
- RetroControllerType controller_type);
+ RetroControllerType controller_type)
G_GNUC_WARN_UNUSED_RESULT;
void retro_core_view_set_as_default_controller (RetroCoreView *self,
RetroCore *core);
gint16 retro_core_view_get_input_state (RetroCoreView *self,
diff --git a/retro-gtk/retro-core.h b/retro-gtk/retro-core.h
index 8bc36d4..3834e2c 100644
--- a/retro-gtk/retro-core.h
+++ b/retro-gtk/retro-core.h
@@ -17,7 +17,7 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (RetroCore, retro_core, RETRO, CORE, GObject)
-RetroCore *retro_core_new (const gchar *filename);
+RetroCore *retro_core_new (const gchar *filename) G_GNUC_WARN_UNUSED_RESULT;
guint retro_core_get_api_version (RetroCore *self);
const gchar *retro_core_get_filename (RetroCore *self);
const gchar *retro_core_get_system_directory (RetroCore *self);
@@ -69,7 +69,7 @@ void retro_core_set_controller (RetroCore *self,
RetroController *controller);
void retro_core_set_keyboard (RetroCore *self,
GtkWidget *widget);
-RetroControllerIterator *retro_core_iterate_controllers (RetroCore *self);
+RetroControllerIterator *retro_core_iterate_controllers (RetroCore *self) G_GNUC_WARN_UNUSED_RESULT;
guint retro_core_get_runahead (RetroCore *self);
void retro_core_set_runahead (RetroCore *self,
guint runahead);
@@ -80,7 +80,7 @@ gboolean retro_core_has_option (RetroCore *self,
const gchar *key);
RetroOption *retro_core_get_option (RetroCore *self,
const gchar *key);
-RetroOptionIterator *retro_core_iterate_options (RetroCore *self);
+RetroOptionIterator *retro_core_iterate_options (RetroCore *self) G_GNUC_WARN_UNUSED_RESULT;
void retro_core_override_option_default (RetroCore *self,
const gchar *key,
const gchar *value);
diff --git a/retro-gtk/retro-gl-display-private.h b/retro-gtk/retro-gl-display-private.h
index 8b579eb..2d94e5a 100644
--- a/retro-gtk/retro-gl-display-private.h
+++ b/retro-gtk/retro-gl-display-private.h
@@ -16,7 +16,7 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (RetroGLDisplay, retro_gl_display, RETRO, GL_DISPLAY, GtkGLArea)
-RetroGLDisplay *retro_gl_display_new (void);
+RetroGLDisplay *retro_gl_display_new (void) G_GNUC_WARN_UNUSED_RESULT;
GdkPixbuf *retro_gl_display_get_pixbuf (RetroGLDisplay *self);
void retro_gl_display_set_pixbuf (RetroGLDisplay *self,
GdkPixbuf *pixbuf);
diff --git a/retro-gtk/retro-key-joypad-mapping.h b/retro-gtk/retro-key-joypad-mapping.h
index 723707b..e4e2b72 100644
--- a/retro-gtk/retro-key-joypad-mapping.h
+++ b/retro-gtk/retro-key-joypad-mapping.h
@@ -15,8 +15,8 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (RetroKeyJoypadMapping, retro_key_joypad_mapping, RETRO, KEY_JOYPAD_MAPPING, GObject)
-RetroKeyJoypadMapping *retro_key_joypad_mapping_new ();
-RetroKeyJoypadMapping *retro_key_joypad_mapping_new_default ();
+RetroKeyJoypadMapping *retro_key_joypad_mapping_new () G_GNUC_WARN_UNUSED_RESULT;
+RetroKeyJoypadMapping *retro_key_joypad_mapping_new_default () G_GNUC_WARN_UNUSED_RESULT;
void retro_key_joypad_mapping_set_button_key (RetroKeyJoypadMapping *self,
RetroJoypadId button,
guint16 hardware_keycode);
diff --git a/retro-gtk/retro-module-iterator.h b/retro-gtk/retro-module-iterator.h
index f830217..b840196 100644
--- a/retro-gtk/retro-module-iterator.h
+++ b/retro-gtk/retro-module-iterator.h
@@ -16,8 +16,8 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (RetroModuleIterator, retro_module_iterator, RETRO, MODULE_ITERATOR, GObject)
RetroModuleIterator *retro_module_iterator_new (const gchar * const *lookup_paths,
- gboolean recursive);
-RetroCoreDescriptor *retro_module_iterator_get (RetroModuleIterator *self);
+ gboolean recursive) G_GNUC_WARN_UNUSED_RESULT;
+RetroCoreDescriptor *retro_module_iterator_get (RetroModuleIterator *self) G_GNUC_WARN_UNUSED_RESULT;
gboolean retro_module_iterator_next (RetroModuleIterator *self);
G_END_DECLS
diff --git a/retro-gtk/retro-module-query.h b/retro-gtk/retro-module-query.h
index cee08ca..f9d5401 100644
--- a/retro-gtk/retro-module-query.h
+++ b/retro-gtk/retro-module-query.h
@@ -15,7 +15,7 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (RetroModuleQuery, retro_module_query, RETRO, MODULE_QUERY, GObject)
-RetroModuleQuery *retro_module_query_new (gboolean recursive);
-RetroModuleIterator *retro_module_query_iterator (RetroModuleQuery *self);
+RetroModuleQuery *retro_module_query_new (gboolean recursive) G_GNUC_WARN_UNUSED_RESULT;
+RetroModuleIterator *retro_module_query_iterator (RetroModuleQuery *self) G_GNUC_WARN_UNUSED_RESULT;
G_END_DECLS
diff --git a/retro-gtk/retro-option-iterator-private.h b/retro-gtk/retro-option-iterator-private.h
index b71b33a..a425cf7 100644
--- a/retro-gtk/retro-option-iterator-private.h
+++ b/retro-gtk/retro-option-iterator-private.h
@@ -10,6 +10,6 @@
G_BEGIN_DECLS
-RetroOptionIterator *retro_option_iterator_new (GHashTable *options);
+RetroOptionIterator *retro_option_iterator_new (GHashTable *options) G_GNUC_WARN_UNUSED_RESULT;
G_END_DECLS
diff --git a/retro-gtk/retro-pixdata.c b/retro-gtk/retro-pixdata.c
index 77dfb4f..94105da 100644
--- a/retro-gtk/retro-pixdata.c
+++ b/retro-gtk/retro-pixdata.c
@@ -30,6 +30,13 @@ G_DEFINE_BOXED_TYPE (RetroPixdata, retro_pixdata, retro_pixdata_copy, retro_pixd
/* Private */
+static RetroPixdata *retro_pixdata_new (gconstpointer data,
+ RetroPixelFormat pixel_format,
+ gsize rowstride,
+ gsize width,
+ gsize height,
+ gfloat aspect_ratio) G_GNUC_WARN_UNUSED_RESULT;
+
typedef struct {
guint16 b: 5;
guint16 g: 5;
diff --git a/retro-gtk/retro-pixdata.h b/retro-gtk/retro-pixdata.h
index d9e4c3b..9f137f2 100644
--- a/retro-gtk/retro-pixdata.h
+++ b/retro-gtk/retro-pixdata.h
@@ -17,12 +17,12 @@ GType retro_pixdata_get_type (void) G_GNUC_CONST;
typedef struct _RetroPixdata RetroPixdata;
-RetroPixdata *retro_pixdata_copy (RetroPixdata *self);
+RetroPixdata *retro_pixdata_copy (RetroPixdata *self) G_GNUC_WARN_UNUSED_RESULT;
void retro_pixdata_free (RetroPixdata *self);
gint retro_pixdata_get_width (RetroPixdata *self);
gint retro_pixdata_get_height (RetroPixdata *self);
gfloat retro_pixdata_get_aspect_ratio (RetroPixdata *self);
-GdkPixbuf *retro_pixdata_to_pixbuf (RetroPixdata *self);
+GdkPixbuf *retro_pixdata_to_pixbuf (RetroPixdata *self) G_GNUC_WARN_UNUSED_RESULT;
gboolean retro_pixdata_load_gl_texture (RetroPixdata *self);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (RetroPixdata, retro_pixdata_free)
diff --git a/retro-gtk/retro-runner-process-private.h b/retro-gtk/retro-runner-process-private.h
index 56a4a9e..bd84953 100644
--- a/retro-gtk/retro-runner-process-private.h
+++ b/retro-gtk/retro-runner-process-private.h
@@ -12,7 +12,7 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (RetroRunnerProcess, retro_runner_process, RETRO, RUNNER_PROCESS, GObject)
-RetroRunnerProcess *retro_runner_process_new (const gchar *filename);
+RetroRunnerProcess *retro_runner_process_new (const gchar *filename) G_GNUC_WARN_UNUSED_RESULT;
void retro_runner_process_start (RetroRunnerProcess *self,
GError **error);
diff --git a/retro-runner/retro-core.h b/retro-runner/retro-core.h
index a515e85..23a1a1a 100644
--- a/retro-runner/retro-core.h
+++ b/retro-runner/retro-core.h
@@ -16,7 +16,7 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (RetroCore, retro_core, RETRO, CORE, GObject)
-RetroCore *retro_core_new (const gchar *filename);
+RetroCore *retro_core_new (const gchar *filename) G_GNUC_WARN_UNUSED_RESULT;
guint retro_core_get_api_version (RetroCore *self);
const gchar *retro_core_get_filename (RetroCore *self);
const gchar *retro_core_get_system_directory (RetroCore *self);
diff --git a/retro-runner/retro-input-descriptor-private.h b/retro-runner/retro-input-descriptor-private.h
index 8c35086..b848c00 100644
--- a/retro-runner/retro-input-descriptor-private.h
+++ b/retro-runner/retro-input-descriptor-private.h
@@ -24,8 +24,8 @@ struct _RetroInputDescriptor
gchar *description;
};
-RetroInputDescriptor *retro_input_descriptor_new (void);
-RetroInputDescriptor *retro_input_descriptor_copy (RetroInputDescriptor *self);
+RetroInputDescriptor *retro_input_descriptor_new (void) G_GNUC_WARN_UNUSED_RESULT;
+RetroInputDescriptor *retro_input_descriptor_copy (RetroInputDescriptor *self)
G_GNUC_WARN_UNUSED_RESULT;
void retro_input_descriptor_free (RetroInputDescriptor *self);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (RetroInputDescriptor, retro_input_descriptor_free)
diff --git a/retro-runner/retro-pa-player-private.h b/retro-runner/retro-pa-player-private.h
index 145a2cb..478351b 100644
--- a/retro-runner/retro-pa-player-private.h
+++ b/retro-runner/retro-pa-player-private.h
@@ -17,7 +17,7 @@ typedef struct _RetroCore RetroCore;
G_DECLARE_FINAL_TYPE (RetroPaPlayer, retro_pa_player, RETRO, PA_PLAYER, GObject)
-RetroPaPlayer *retro_pa_player_new (void);
+RetroPaPlayer *retro_pa_player_new (void) G_GNUC_WARN_UNUSED_RESULT;
void retro_pa_player_set_core (RetroPaPlayer *self,
RetroCore *core);
diff --git a/shared/retro-input.h b/shared/retro-input.h
index f94ebfc..b13aa23 100644
--- a/shared/retro-input.h
+++ b/shared/retro-input.h
@@ -18,8 +18,8 @@ GType retro_input_get_type (void) G_GNUC_CONST;
typedef union _RetroInput RetroInput;
-RetroInput *retro_input_new (void);
-RetroInput *retro_input_copy (RetroInput *self);
+RetroInput *retro_input_new (void) G_GNUC_WARN_UNUSED_RESULT;
+RetroInput *retro_input_copy (RetroInput *self) G_GNUC_WARN_UNUSED_RESULT;
void retro_input_free (RetroInput *self);
RetroControllerType retro_input_get_controller_type (RetroInput *self);
gboolean retro_input_get_joypad (RetroInput *self,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]