bug#47452: 28.0.50; Compilation warnings in xterm.c

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

bug#47452: 28.0.50; Compilation warnings in xterm.c

Lars Ingebrigtsen

This started happening on a Debian/bullseye machine some days ago:

xterm.c: In function ‘x_create_toolkit_scroll_bar’:
xterm.c:6226:7: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 6226 |       XtSetArg (av[ac], XtNbeNiceToColormap,
      |       ^~~~~~~~
xterm.c:6237:7: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 6237 |       XtSetArg (av[ac], XtNbeNiceToColormap, False);
      |       ^~~~~~~~
xterm.c:6244:4: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 6244 |    XtSetArg (av[ac], XtNtopShadowPixel, pixel);
      |    ^~~~~~~~
xterm.c:6250:4: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 6250 |    XtSetArg (av[ac], XtNbottomShadowPixel, pixel);
xterm.c: In function ‘x_create_horizontal_toolkit_scroll_bar’:
xterm.c:6427:7: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 6427 |       XtSetArg (av[ac], XtNbeNiceToColormap,
      |       ^~~~~~~~
xterm.c:6438:7: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 6438 |       XtSetArg (av[ac], XtNbeNiceToColormap, False);
      |       ^~~~~~~~
xterm.c:6445:4: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 6445 |    XtSetArg (av[ac], XtNtopShadowPixel, pixel);
      |    ^~~~~~~~
xterm.c:6451:4: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 6451 |    XtSetArg (av[ac], XtNbottomShadowPixel, pixel);
      |    ^~~~~~~~

It does not happen on my other Debian/bullseye machine, which is
confusing: Both are "apt update; apt upgraded" right now, so they should
be very similar.

From the machine that has the warnings:

In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2021-03-28 built on stories
Repository revision: cf607c262e15c873961fdfcced254e6f8e82f8d7
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12010000
System Description: Debian GNU/Linux bullseye/sid

This is the one that doesn't have the warning:

In GNU Emacs 28.0.50 (build 51, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo version 1.16.0)
 of 2021-03-28 built on xo
Repository revision: cf607c262e15c873961fdfcced254e6f8e82f8d7
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12010000
System Description: Debian GNU/Linux bullseye/sid

Ah, so the warning is when compiling without Gtk?  Makes sense; I
removed some libraries from the other machine for doing various tests
the other day



--
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Reply | Threaded
Open this post in threaded view
|

bug#47452: 28.0.50; Compilation warnings in xterm.c

Lars Ingebrigtsen
Lars Ingebrigtsen <[hidden email]> writes:

> This started happening on a Debian/bullseye machine some days ago:
>
> xterm.c: In function ‘x_create_toolkit_scroll_bar’:
> xterm.c:6226:7: warning: assignment discards ‘const’ qualifier from
> pointer target type [-Wdiscarded-qualifiers]
>  6226 |       XtSetArg (av[ac], XtNbeNiceToColormap,
>       |       ^~~~~~~~

Oh, right:

#define XtSetArg(arg, n, d) \
    ((void)( (arg).name = (n), (arg).value = (XtArgVal)(d) ))

And arg.name is....  A String, which is

#ifdef _CONST_X_STRING
typedef const char *String;
#else
typedef char *String;
#endif

Uhm...   So it depends.

But XtNbeNiceToColormap is just

#define XtNbeNiceToColormap "beNiceToColormap"

which...  Uhm.  This "fixes" the warning:

    XtSetArg (av[ac], (char*)XtNbeNiceToColormap,
                DefaultDepthOfScreen (FRAME_X_SCREEN (f)) < 16);

But...

--
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no