[libdazzle] util: avoid tripping up g-ir-scanner
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libdazzle] util: avoid tripping up g-ir-scanner
- Date: Fri, 9 Jun 2017 00:16:07 +0000 (UTC)
commit a933a4219eafccf045cd417174e6120eddc7abd0
Author: Christian Hergert <chergert redhat com>
Date: Thu Jun 8 17:14:38 2017 -0700
util: avoid tripping up g-ir-scanner
g-ir-scanner does not like that we have .name=foo assignments in
our header-based static inlines. This avoids those which semantically
does the same thing.
Additionally, we move the G_STATIC_ASSERT()s into the static inline
functions to avoid tripping g-ir-scanner on unknown symbols after
the preprocessor has run.
src/util/dzl-int-pair.h | 25 ++++++++++++++++++++-----
1 files changed, 20 insertions(+), 5 deletions(-)
---
diff --git a/src/util/dzl-int-pair.h b/src/util/dzl-int-pair.h
index ab307c7..67d57d0 100644
--- a/src/util/dzl-int-pair.h
+++ b/src/util/dzl-int-pair.h
@@ -63,16 +63,22 @@ typedef struct
#endif
-G_STATIC_ASSERT (sizeof (DzlIntPair) == 8);
-G_STATIC_ASSERT (sizeof (DzlUIntPair) == 8);
-
/**
* dzl_int_pair_new: (skip)
*/
static inline DzlIntPair *
dzl_int_pair_new (gint first, gint second)
{
- DzlIntPair pair = { .first = first, .second = second };
+ DzlIntPair pair;
+
+ /* Avoid tripping g-ir-scanner by putting this
+ * inside the inline function.
+ */
+ G_STATIC_ASSERT (sizeof (DzlIntPair) == 8);
+
+ pair.first = first;
+ pair.second = second;
+
#if __WORDSIZE >= 64
return pair.ptr;
#else
@@ -86,7 +92,16 @@ dzl_int_pair_new (gint first, gint second)
static inline DzlUIntPair *
dzl_uint_pair_new (guint first, guint second)
{
- DzlUIntPair pair = { .first = first, .second = second };
+ DzlUIntPair pair;
+
+ /* Avoid tripping g-ir-scanner by putting this
+ * inside the inline function.
+ */
+ G_STATIC_ASSERT (sizeof (DzlUIntPair) == 8);
+
+ pair.first = first;
+ pair.second = second;
+
#if __WORDSIZE >= 64
return pair.ptr;
#else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]