lxde / lxterminal

VTE terminal emulator written in GTK
GNU General Public License v2.0
159 stars 55 forks source link

Build failure with stricter C compilers (e.g. GCC 14) #121

Closed thesamesam closed 2 weeks ago

thesamesam commented 8 months ago

Modern C compilers are becoming stricter with a variety of changes over the last year or so.

GCC 14 in particular (to be released in ~April 2024) fails to build lxterminal-0.4.0 like:

lxterminal.c:1221:19: error: passing argument 1 of ‘g_regex_unref’ from incompatible pointer type [-Wincompatible-pointer-types]
 1221 |     g_regex_unref(dingus1);
      |                   ^~~~~~~
      |                   |
      |                   VteRegex * {aka struct _VteRegex *}
In file included from /usr/include/glib-2.0/glib.h:78,
                 from lxterminal.c:27:
/usr/include/glib-2.0/glib/gregex.h:465:71: note: expected ‘GRegex *’ {aka ‘struct _GRegex *’} but argument is of type ‘VteRegex *’ {aka ‘struct _VteRegex *’}
  465 | void              g_regex_unref                 (GRegex              *regex);
      |                                                  ~~~~~~~~~~~~~~~~~~~~~^~~~~
lxterminal.c:1222:19: error: passing argument 1 of ‘g_regex_unref’ from incompatible pointer type [-Wincompatible-pointer-types]
 1222 |     g_regex_unref(dingus2);
      |                   ^~~~~~~
      |                   |
      |                   VteRegex * {aka struct _VteRegex *}
/usr/include/glib-2.0/glib/gregex.h:465:71: note: expected ‘GRegex *’ {aka ‘struct _GRegex *’} but argument is of type ‘VteRegex *’ {aka ‘struct _VteRegex *’}
  465 | void              g_regex_unref                 (GRegex              *regex);
      |                                                  ~~~~~~~~~~~~~~~~~~~~~^~~~~

Originally reported downstream in Gentoo at https://bugs.gentoo.org/919094.

This can be emulated with -Werror=incompatible-pointer-types -Werror=implicit -Werror=int-conversion on an older GCC or Clang.

mtasaka commented 6 months ago

I see one more warning with -Werror=incompatible-pointer-types

make[2]: Entering directory '/builddir/build/BUILD/lxterminal-0.4.0-20230917git9b4299c2/lxterminal/src'
lxterminal.c: In function ‘terminal_new’:
lxterminal.c:1233:24: warning: passing argument 2 of ‘gtk_style_context_add_provider’ from incompatible pointer type [-Wincompatible-pointer-types]
 1233 |         box_style_ctx, box_css_provider,
      |                        ^~~~~~~~~~~~~~~~
      |                        |
      |                        GtkCssProvider * {aka struct _GtkCssProvider *}
In file included from /usr/include/gtk-3.0/gtk/gtkicontheme.h:27,
                 from /usr/include/gtk-3.0/gtk/gtk.h:127,
                 from lxterminal.c:28:
/usr/include/gtk-3.0/gtk/gtkstylecontext.h:1034:59: note: expected ‘GtkStyleProvider *’ {aka ‘struct _GtkStyleProvider *’} but argument is of type ‘GtkCssProvider *’ {aka ‘struct _GtkCssProvider *’}
 1034 |                                         GtkStyleProvider *provider,
      |                                         ~~~~~~~~~~~~~~~~~~^~~~~~~~