Re: libcurses: --enable-const

2020-12-12 Thread Todd C . Miller
On Sat, 12 Dec 2020 16:28:18 +0100, Christian Weisgerber wrote:

> ncurses has a configure option that adds a few more consts to its
> headers by way of the NCURSES_CONST define.  Starting with version
> 6.0, this has become the default.  OpenBSD is still on ncurses 5.7,
> but FreeBSD and I guess most Linux distributions have moved on.
> I suggest we also enable the additional consts.  This eliminates
> compiler warnings when sharing code with other platforms.
>
> The diff below has successfully gone through a release build on
> amd64, as well as a full amd64 package build.

OK millert@

 - todd



libcurses: --enable-const

2020-12-12 Thread Christian Weisgerber
ncurses has a configure option that adds a few more consts to its
headers by way of the NCURSES_CONST define.  Starting with version
6.0, this has become the default.  OpenBSD is still on ncurses 5.7,
but FreeBSD and I guess most Linux distributions have moved on.
I suggest we also enable the additional consts.  This eliminates
compiler warnings when sharing code with other platforms.

The diff below has successfully gone through a release build on
amd64, as well as a full amd64 package build.

OK?

Index: lib/libcurses/curses.h
===
RCS file: /cvs/src/lib/libcurses/curses.h,v
retrieving revision 1.61
diff -u -p -r1.61 curses.h
--- lib/libcurses/curses.h  6 Sep 2010 17:26:17 -   1.61
+++ lib/libcurses/curses.h  9 Dec 2020 22:56:31 -
@@ -101,7 +101,7 @@
  * doing so makes it incompatible with other implementations of X/Open Curses.
  */
 #undef  NCURSES_CONST
-#define NCURSES_CONST /*nothing*/
+#define NCURSES_CONST const
 
 #undef NCURSES_INLINE
 #define NCURSES_INLINE inline
Index: lib/libcurses/term.h
===
RCS file: /cvs/src/lib/libcurses/term.h,v
retrieving revision 1.15
diff -u -p -r1.15 term.h
--- lib/libcurses/term.h14 Nov 2015 23:56:49 -  1.15
+++ lib/libcurses/term.h9 Dec 2020 23:03:46 -
@@ -68,7 +68,7 @@ extern "C" {
  */
 
 #undef  NCURSES_CONST
-#define NCURSES_CONST /*nothing*/
+#define NCURSES_CONST const
 
 #undef  NCURSES_SBOOL
 #define NCURSES_SBOOL signed char
Index: lib/libcurses/termcap.h
===
RCS file: /cvs/src/lib/libcurses/termcap.h,v
retrieving revision 1.10
diff -u -p -r1.10 termcap.h
--- lib/libcurses/termcap.h 10 Dec 2013 20:33:51 -  1.10
+++ lib/libcurses/termcap.h 9 Dec 2020 23:03:54 -
@@ -62,7 +62,7 @@ extern "C"
 #include 
 
 #undef  NCURSES_CONST 
-#define NCURSES_CONST /*nothing*/ 
+#define NCURSES_CONST const
 
 #undef  NCURSES_OSPEED 
 #define NCURSES_OSPEED int 
-- 
Christian "naddy" Weisgerber  na...@mips.inka.de