diff options
author | Kouhei Sutou <kou@clear-code.com> | 2018-12-20 11:24:53 +0900 |
---|---|---|
committer | Kouhei Sutou <kou@clear-code.com> | 2018-12-20 11:24:53 +0900 |
commit | b8ac6e146a86a1cffca7a62d9d175aae81f93dad (patch) | |
tree | 2650468c0e523dd133e648000559547785bfca6a /gobject | |
parent | 3924ef6ac1130b1abf54b2a52ffafd97a9067e8e (diff) | |
download | glib-b8ac6e146a86a1cffca7a62d9d175aae81f93dad.tar.gz |
Suppress -Wint-in-bool-context warning with G_DEFINE_INTERFACE and g++
Note that it's not reported with gcc. It's only reported with g++.
C++ code to reproduce this warning:
#include <glib-object.h>
G_BEGIN_DECLS
#define GARROW_TYPE_FILE (garrow_file_get_type())
G_DECLARE_INTERFACE(GArrowFile,
garrow_file,
GARROW,
FILE,
GObject)
struct _GArrowFileInterface {
GTypeInterface g_iface;
};
G_DEFINE_INTERFACE(GArrowFile,
garrow_file,
G_TYPE_OBJECT)
static void
garrow_file_default_init(GArrowFileInterface *iface)
{
}
G_END_DECLS
Build command line:
% g++ -Wall -shared -o liba.so a.cpp $(pkg-config --cflags --libs gobject-2.0)
Message:
In file included from /tmp/local.glib/include/glib-2.0/gobject/gobject.h:24,
from /tmp/local.glib/include/glib-2.0/gobject/gbinding.h:29,
from /tmp/local.glib/include/glib-2.0/glib-object.h:23,
from a.cpp:1:
a.cpp: In function 'GType garrow_file_get_type()':
/tmp/local.glib/include/glib-2.0/gobject/gtype.h:219:50: warning: '<<' in boolean context, did you mean '<' ? [-Wint-in-bool-context]
#define G_TYPE_MAKE_FUNDAMENTAL(x) ((GType) ((x) << G_TYPE_FUNDAMENTAL_SHIFT))
~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/local.glib/include/glib-2.0/gobject/gtype.h:2026:11: note: in definition of macro '_G_DEFINE_INTERFACE_EXTENDED_BEGIN'
if (TYPE_PREREQ) \
^~~~~~~~~~~
/tmp/local.glib/include/glib-2.0/gobject/gtype.h:1758:47: note: in expansion of macro 'G_DEFINE_INTERFACE_WITH_CODE'
#define G_DEFINE_INTERFACE(TN, t_n, T_P) G_DEFINE_INTERFACE_WITH_CODE(TN, t_n, T_P, ;)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cpp:16:1: note: in expansion of macro 'G_DEFINE_INTERFACE'
G_DEFINE_INTERFACE(GArrowFile,
^~~~~~~~~~~~~~~~~~
/tmp/local.glib/include/glib-2.0/gobject/gtype.h:178:25: note: in expansion of macro 'G_TYPE_MAKE_FUNDAMENTAL'
#define G_TYPE_OBJECT G_TYPE_MAKE_FUNDAMENTAL (20)
^~~~~~~~~~~~~~~~~~~~~~~
a.cpp:18:20: note: in expansion of macro 'G_TYPE_OBJECT'
G_TYPE_OBJECT)
^~~~~~~~~~~~~
Diffstat (limited to 'gobject')
-rw-r--r-- | gobject/gtype.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gobject/gtype.h b/gobject/gtype.h index 77e22a0a9..0d366e67b 100644 --- a/gobject/gtype.h +++ b/gobject/gtype.h @@ -2023,7 +2023,7 @@ type_name##_get_type (void) \ 0, \ (GInstanceInitFunc)NULL, \ (GTypeFlags) 0); \ - if (TYPE_PREREQ) \ + if (TYPE_PREREQ != G_TYPE_INVALID) \ g_type_interface_add_prerequisite (g_define_type_id, TYPE_PREREQ); \ { /* custom code follows */ #define _G_DEFINE_INTERFACE_EXTENDED_END() \ |