[gjs] arg: Ignore compiler warning on un-initialized value
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] arg: Ignore compiler warning on un-initialized value
- Date: Thu, 9 Jul 2020 05:16:05 +0000 (UTC)
commit 1f8bc1f121f3afb2002e2294a3bb38f5d29e9e4c
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date: Tue May 12 12:49:08 2020 +0200
arg: Ignore compiler warning on un-initialized value
We're quite sure we do, otherwise we'd have already returned false but
g++ isn't smart enough to catch it, when building with release optimizations.
gi/arg.cpp | 9 +++++++++
1 file changed, 9 insertions(+)
---
diff --git a/gi/arg.cpp b/gi/arg.cpp
index 2097acd8..b53ff7f4 100644
--- a/gi/arg.cpp
+++ b/gi/arg.cpp
@@ -748,7 +748,16 @@ gjs_object_to_g_hash(JSContext *context,
&val_arg);
}
+#if __GNUC__ >= 8 // clang-format off
+_Pragma("GCC diagnostic push")
+_Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
+#endif
+ // The compiler isn't smart enough to figure out that key_ptr will
+ // always be initialized if value_to_ghashtable_key() returns true.
g_hash_table_insert(result, key_ptr, val_ptr);
+#if __GNUC__ >= 8
+_Pragma("GCC diagnostic pop")
+#endif // clang-format on
}
*hash_p = result.release();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]