Commit: patch 9.1.0432: Ancient XPM preprocessor hack may cause build errors

13 views
Skip to first unread message

Christian Brabandt

unread,
May 22, 2024, 11:00:14 AMMay 22
to vim...@googlegroups.com
patch 9.1.0432: Ancient XPM preprocessor hack may cause build errors

Commit: https://github.com/vim/vim/commit/5090f838bbcd3a13433d9fe20a94f3ce6b796eb1
Author: Drew Vogel <dvogel@github>
Date: Wed May 22 16:51:53 2024 +0200

patch 9.1.0432: Ancient XPM preprocessor hack may cause build errors

Problem: Ancient XPM preprocessor hack may cause build errors.
Solution: Simplify XPM includes and get rid of complicated #ifdef magic
(Drew Vogel).

closes: #14816

Signed-off-by: Drew Vogel <dvogel@github>
Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/runtime/vim16x16.xpm b/runtime/vim16x16.xpm
index cb75b7178..9b55218cc 100644
--- a/runtime/vim16x16.xpm
+++ b/runtime/vim16x16.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static char * vim16x16[] = {
+static const char * vim16x16[] = {
"16 16 8 1",
" c None",
". c #000000",
diff --git a/runtime/vim32x32.xpm b/runtime/vim32x32.xpm
index 43a3a40c0..017b93b6f 100644
--- a/runtime/vim32x32.xpm
+++ b/runtime/vim32x32.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static char * vim32x32[] = {
+static const char * vim32x32[] = {
"32 32 8 1",
" c None",
". c #000000",
diff --git a/runtime/vim48x48.xpm b/runtime/vim48x48.xpm
index b2fdd9592..8bd08bc5a 100644
--- a/runtime/vim48x48.xpm
+++ b/runtime/vim48x48.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static char * vim48x48[] = {
+static const char * vim48x48[] = {
"48 48 8 1",
" c None",
". c #000000",
diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c
index 4d201fcae..066aa1745 100644
--- a/src/gui_gtk_x11.c
+++ b/src/gui_gtk_x11.c
@@ -2704,23 +2704,9 @@ global_event_filter(GdkXEvent *xev,
static void
mainwin_realize(GtkWidget *widget UNUSED, gpointer data UNUSED)
{
-// If you get an error message here, you still need to unpack the runtime
-// archive!
-#ifdef magick
-# undef magick
-#endif
- // A bit hackish, but avoids casting later and allows optimization
-# define static static const
-#define magick vim32x32
#include "../runtime/vim32x32.xpm"
-#undef magick
-#define magick vim16x16
#include "../runtime/vim16x16.xpm"
-#undef magick
-#define magick vim48x48
#include "../runtime/vim48x48.xpm"
-#undef magick
-# undef static

GdkWindow * const mainwin_win = gtk_widget_get_window(gui.mainwin);

diff --git a/src/gui_x11.c b/src/gui_x11.c
index fc63658f8..edde6b55c 100644
--- a/src/gui_x11.c
+++ b/src/gui_x11.c
@@ -1363,20 +1363,9 @@ gui_mch_init(void)
#else
// Use Pixmaps, looking much nicer.

-// If you get an error message here, you still need to unpack the runtime
-// archive!
-# ifdef magick
-# undef magick
-# endif
-# define magick vim32x32
# include "../runtime/vim32x32.xpm"
-# undef magick
-# define magick vim16x16
# include "../runtime/vim16x16.xpm"
-# undef magick
-# define magick vim48x48
# include "../runtime/vim48x48.xpm"
-# undef magick

static Pixmap icon = 0;
static Pixmap icon_mask = 0;
diff --git a/src/version.c b/src/version.c
index ca8af1690..b37dbcf85 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 432,
/**/
431,
/**/

Tony Mechelynck

unread,
May 22, 2024, 7:29:20 PMMay 22
to Christian Brabandt, vim...@googlegroups.com
On Wed, May 22, 2024 at 5:00 PM Christian Brabandt <cbl...@256bit.org> wrote:
>
> patch 9.1.0432: Ancient XPM preprocessor hack may cause build errors
>
> Commit: https://github.com/vim/vim/commit/5090f838bbcd3a13433d9fe20a94f3ce6b796eb1
> Author: Drew Vogel <dvogel@github>
> Date: Wed May 22 16:51:53 2024 +0200
>
> patch 9.1.0432: Ancient XPM preprocessor hack may cause build errors
>
> Problem: Ancient XPM preprocessor hack may cause build errors.
> Solution: Simplify XPM includes and get rid of complicated #ifdef magic
> (Drew Vogel).
>
> closes: #14816
>
> Signed-off-by: Drew Vogel <dvogel@github>
> Signed-off-by: Christian Brabandt <c...@256bit.org>
> [...]

Compiler warnings in gcc 13.2.1.20240509 in Tiny and Normal, both with
Motif GUI. Not in Tiny without GUI and not in Huge with GTK3 GUI :

gui_x11.c: In function ‘gui_mch_init’:
gui_x11.c:1372:36: warning: initialization of ‘char **’ from
incompatible pointer type ‘const char **’
[-Wincompatible-pointer-types]
1372 | static char **magick = vim32x32;
| ^~~~~~~~
gui_x11.c:1391:24: warning: assignment to ‘char **’ from incompatible
pointer type ‘const char **’ [-Wincompatible-pointer-types]
1391 | magick = vim48x48;
| ^
gui_x11.c:1393:24: warning: assignment to ‘char **’ from incompatible
pointer type ‘const char **’ [-Wincompatible-pointer-types]
1393 | magick = vim32x32;
| ^
gui_x11.c:1395:24: warning: assignment to ‘char **’ from incompatible
pointer type ‘const char **’ [-Wincompatible-pointer-types]
1395 | magick = vim16x16;
| ^


Best regards,
Tony.
Reply all
Reply to author
Forward
0 new messages