"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Christian Weisgerber <naddy@mips.inka.de>
Subject:
Unbreak development built if NCURSES_CONST is const
To:
gameoftrees@openbsd.org
Date:
Fri, 11 Dec 2020 00:19:28 +0100

Download raw body.

Thread
Starting with version 6.0, ncurses defaults to adding a few more
consts to its headers by way of the NCURSES_CONST define.  OpenBSD
is still on ncurses 5.7, but FreeBSD and I guess most Linux
distributions have moved on.  I intend to switch OpenBSD's ncurses
to "#define NCURSES_CONST const" soon, which breaks got's -Werror
build:

cc -O2 -pipe -O0 -g -Werror -Wall -Wstrict-prototypes -Wunused-variable  -MD -MP -I/home/naddy/got/tog/../include -I/home/naddy/got/tog/../lib -DGOT_LIBEXECDIR=/home/naddy/bin -DGOT_VERSION=0.45-current -c /home/naddy/got/tog/tog.c
/home/naddy/got/tog/tog.c:949:13: error: assigning to 'struct tog_view *' from 'const void *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
        view_above = panel_userptr(panel);
                   ^ ~~~~~~~~~~~~~~~~~~~~
1 error generated.

Here's a fix:

diff 437adc9d5be73b4b89441362ec89de754374a5a6 /home/naddy/got
blob - 457fcc6885530f6eb53c478998fd277562f91f45
file + tog/tog.c
--- tog/tog.c
+++ tog/tog.c
@@ -937,7 +937,7 @@ void
 view_vborder(struct tog_view *view)
 {
 	PANEL *panel;
-	struct tog_view *view_above;
+	const struct tog_view *view_above;
 
 	if (view->parent)
 		return view_vborder(view->parent);
-- 
Christian "naddy" Weisgerber                          naddy@mips.inka.de