Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
thesamesam opened this issue Dec 16, 2023 · 1 comment · May be fixed by #122
Open

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

thesamesam opened this issue Dec 16, 2023 · 1 comment · May be fixed by #122

Comments

@thesamesam
Copy link

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 added a commit to mtasaka/lxterminal that referenced this issue Feb 21, 2024
gcc14 now defaults to -Werror=incompatible-pointer-types .
Fix code to support this.

* Add GTK cast for GTK_STYLE_PROVIDER
* VteRegex must be deref'ed with vte_regex_unref

Fixes lxde#121 .
@mtasaka
Copy link
Contributor

mtasaka commented Feb 21, 2024

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,
      |                                         ~~~~~~~~~~~~~~~~~~^~~~~~~~

@mtasaka mtasaka linked a pull request Feb 21, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants