[pygobject] setup.py: enable -Wjump-misses-init
- From: Christoph Reiter <creiter src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] setup.py: enable -Wjump-misses-init
- Date: Thu, 22 Mar 2018 07:05:10 +0000 (UTC)
commit 84448a33ee741eeeba1121b4d67963dcd95de813
Author: Christoph Reiter <reiter christoph gmail com>
Date: Wed Mar 21 15:04:07 2018 +0100
setup.py: enable -Wjump-misses-init
Just move the error handling code out of the loop as it doesn't
depend on the loop state.
gi/pygi-array.c | 53 +++++++++++++++++++++++++++--------------------------
setup.py | 2 +-
2 files changed, 28 insertions(+), 27 deletions(-)
---
diff --git a/gi/pygi-array.c b/gi/pygi-array.c
index 292515ae..7cd3689a 100644
--- a/gi/pygi-array.c
+++ b/gi/pygi-array.c
@@ -350,37 +350,38 @@ _pygi_marshal_from_py_array (PyGIInvokeState *state,
}
success_count++;
- continue;
-err:
- if (sequence_cache->item_cache->from_py_cleanup != NULL) {
- gsize j;
- PyGIMarshalCleanupFunc cleanup_func =
- sequence_cache->item_cache->from_py_cleanup;
+ }
+ goto array_success;
- /* Only attempt per item cleanup on pointer items */
- if (sequence_cache->item_cache->is_pointer) {
- for(j = 0; j < success_count; j++) {
- PyObject *py_seq_item = PySequence_GetItem (py_arg, j);
- cleanup_func (state,
- sequence_cache->item_cache,
- py_seq_item,
- is_ptr_array ?
- g_ptr_array_index ((GPtrArray *)array_, j) :
- g_array_index (array_, gpointer, j),
- TRUE);
- Py_DECREF (py_seq_item);
- }
+err:
+ if (sequence_cache->item_cache->from_py_cleanup != NULL) {
+ gsize j;
+ PyGIMarshalCleanupFunc cleanup_func =
+ sequence_cache->item_cache->from_py_cleanup;
+
+ /* Only attempt per item cleanup on pointer items */
+ if (sequence_cache->item_cache->is_pointer) {
+ for(j = 0; j < success_count; j++) {
+ PyObject *py_seq_item = PySequence_GetItem (py_arg, j);
+ cleanup_func (state,
+ sequence_cache->item_cache,
+ py_seq_item,
+ is_ptr_array ?
+ g_ptr_array_index ((GPtrArray *)array_, j) :
+ g_array_index (array_, gpointer, j),
+ TRUE);
+ Py_DECREF (py_seq_item);
}
}
-
- if (is_ptr_array)
- g_ptr_array_free ( ( GPtrArray *)array_, TRUE);
- else
- g_array_free (array_, TRUE);
- _PyGI_ERROR_PREFIX ("Item %i: ", i);
- return FALSE;
}
+ if (is_ptr_array)
+ g_ptr_array_free ( ( GPtrArray *)array_, TRUE);
+ else
+ g_array_free (array_, TRUE);
+ _PyGI_ERROR_PREFIX ("Item %i: ", i);
+ return FALSE;
+
array_success:
if (array_cache->len_arg_index >= 0) {
/* we have an child arg to handle */
diff --git a/setup.py b/setup.py
index 0793a98d..ce257e14 100755
--- a/setup.py
+++ b/setup.py
@@ -738,7 +738,7 @@ def add_ext_warn_flags(ext, compiler, _cache={}):
"-Wimplicit-function-declaration",
"-Winit-self",
"-Winline",
- # "-Wjump-misses-init",
+ "-Wjump-misses-init",
# "-Wlogical-op",
"-Wmissing-declarations",
"-Wmissing-format-attribute",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]