unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#47452: 28.0.50; Compilation warnings in xterm.c
@ 2021-03-28 15:05 Lars Ingebrigtsen
  2021-03-28 15:24 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Lars Ingebrigtsen @ 2021-03-28 15:05 UTC (permalink / raw)
  To: 47452


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






^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#47452: 28.0.50; Compilation warnings in xterm.c
  2021-03-28 15:05 bug#47452: 28.0.50; Compilation warnings in xterm.c Lars Ingebrigtsen
@ 2021-03-28 15:24 ` Lars Ingebrigtsen
  2021-04-27  2:26   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Lars Ingebrigtsen @ 2021-03-28 15:24 UTC (permalink / raw)
  To: 47452

Lars Ingebrigtsen <larsi@gnus.org> 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





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#47452: 28.0.50; Compilation warnings in xterm.c
  2021-03-28 15:24 ` Lars Ingebrigtsen
@ 2021-04-27  2:26   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2021-04-27  2:26 UTC (permalink / raw)
  To: 47452

Lars Ingebrigtsen <larsi@gnus.org> writes:

> And arg.name is....  A String, which is
>
> #ifdef _CONST_X_STRING
> typedef const char *String;
> #else
> typedef char *String;
> #endif

Pushed a fix now (just casting the argument to String).

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





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-27  2:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-28 15:05 bug#47452: 28.0.50; Compilation warnings in xterm.c Lars Ingebrigtsen
2021-03-28 15:24 ` Lars Ingebrigtsen
2021-04-27  2:26   ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).