• Kouhei Sutou's avatar
    Suppress -Wint-in-bool-context warning with G_DEFINE_INTERFACE and g++ · b8ac6e14
    Kouhei Sutou authored
    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)
                            ^~~~~~~~~~~~~
    b8ac6e14
Name
Last commit
Last update
.gitlab-ci Loading commit data...
build Loading commit data...
docs Loading commit data...
fuzzing Loading commit data...
gio Loading commit data...
glib Loading commit data...
gmodule Loading commit data...
gobject Loading commit data...
gthread Loading commit data...
m4macros Loading commit data...
po Loading commit data...
subprojects Loading commit data...
tests Loading commit data...
.dir-locals.el Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.gitlab-ci.yml Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
COPYING Loading commit data...
HACKING Loading commit data...
INSTALL.in Loading commit data...
Makefile.am Loading commit data...
NEWS Loading commit data...
NEWS.pre-1-3 Loading commit data...
README Loading commit data...
README.md Loading commit data...
README.rationale Loading commit data...
README.win32 Loading commit data...
acglib.m4 Loading commit data...
acinclude.m4 Loading commit data...
autogen.sh Loading commit data...
check-abis.sh Loading commit data...
configure.ac Loading commit data...
gio-2.0.pc.in Loading commit data...
gio-unix-2.0.pc.in Loading commit data...
gio-windows-2.0.pc.in Loading commit data...
glib-2.0.pc.in Loading commit data...
glib-gettextize.in Loading commit data...
glib-tap.mk Loading commit data...
glib.doap Loading commit data...
glib.mk Loading commit data...
glib.supp Loading commit data...
gmodule-2.0.pc.in Loading commit data...
gmodule-export-2.0.pc.in Loading commit data...
gmodule-no-export-2.0.pc.in Loading commit data...
gobject-2.0.pc.in Loading commit data...
gthread-2.0.pc.in Loading commit data...
meson.build Loading commit data...
meson_options.txt Loading commit data...
msvc_recommended_pragmas.h Loading commit data...
sanity_check Loading commit data...
tap-driver.sh Loading commit data...
tap-test Loading commit data...
template-tap.test.in Loading commit data...
template.test.in Loading commit data...