games-board/gnuchess: fix configure w/ Clang 16, fix C++17 compat

Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Sam James 2023-02-02 06:25:46 +00:00
parent f8cf36e58a
commit 7791570ded
No known key found for this signature in database
GPG Key ID: 738409F520DF9190
3 changed files with 188 additions and 3 deletions

View File

@ -0,0 +1,140 @@
https://lists.gnu.org/archive/html/bug-gnu-chess/2023-01/msg00000.html
From 321eb9b1ca1b230063259dc43be8a2ab2f3bfee9 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 17 Jan 2023 22:16:36 -0800
Subject: [PATCH] Remove 'register' storage class classifier
This is gone with c++17
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
--- a/src/frontend/atak.cc
+++ b/src/frontend/atak.cc
@@ -37,7 +37,7 @@ short SqAtakd (short sq, short side)
*
**************************************************************************/
{
- register BitBoard *a, b, *c, d, blocker;
+ BitBoard *a, b, *c, d, blocker;
int t;
a = board.b[side];
@@ -89,7 +89,7 @@ BitBoard AttackTo (int sq, int side)
*
***************************************************************************/
{
- register BitBoard *a, b, *c, e, blocker;
+ BitBoard *a, b, *c, e, blocker;
int t;
a = board.b[side];
--- a/src/frontend/lexpgn.cc
+++ b/src/frontend/lexpgn.cc
@@ -2431,9 +2431,9 @@ extern int yylex (void);
*/
YY_DECL
{
- register yy_state_type yy_current_state;
- register char *yy_cp, *yy_bp;
- register int yy_act;
+ yy_state_type yy_current_state;
+ char *yy_cp, *yy_bp;
+ int yy_act;
#line 153 "lexpgn.ll"
@@ -3118,9 +3118,9 @@ case YY_STATE_EOF(RAV):
*/
static int yy_get_next_buffer (void)
{
- register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
- register char *source = (yytext_ptr);
- register int number_to_move, i;
+ char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+ char *source = (yytext_ptr);
+ int number_to_move, i;
int ret_val;
if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
@@ -3252,8 +3252,8 @@ static int yy_get_next_buffer (void)
static yy_state_type yy_get_previous_state (void)
{
- register yy_state_type yy_current_state;
- register char *yy_cp;
+ yy_state_type yy_current_state;
+ char *yy_cp;
yy_current_state = (yy_start);
yy_current_state += YY_AT_BOL();
@@ -3278,8 +3278,8 @@ static int yy_get_next_buffer (void)
*/
static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
{
- register int yy_is_jam;
- register char *yy_cp = (yy_c_buf_p);
+ int yy_is_jam;
+ char *yy_cp = (yy_c_buf_p);
yy_current_state = yy_nxt[yy_current_state][1];
yy_is_jam = (yy_current_state <= 0);
@@ -3296,9 +3296,9 @@ static int yy_get_next_buffer (void)
return yy_is_jam ? 0 : yy_current_state;
}
- static void yyunput (int c, register char * yy_bp )
+ static void yyunput (int c, char * yy_bp )
{
- register char *yy_cp;
+ char *yy_cp;
yy_cp = (yy_c_buf_p);
@@ -3308,10 +3308,10 @@ static int yy_get_next_buffer (void)
if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
{ /* need to shift things up to make room */
/* +2 for EOB chars. */
- register yy_size_t number_to_move = (yy_n_chars) + 2;
- register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
+ yy_size_t number_to_move = (yy_n_chars) + 2;
+ char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
- register char *source =
+ char *source =
&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
@@ -3925,7 +3925,7 @@ int yylex_destroy (void)
#ifndef yytext_ptr
static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
{
- register int i;
+ int i;
for ( i = 0; i < n; ++i )
s1[i] = s2[i];
}
@@ -3934,7 +3934,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
#ifdef YY_NEED_STRLEN
static int yy_flex_strlen (yyconst char * s )
{
- register int n;
+ int n;
for ( n = 0; s[n]; ++n )
;
--- a/src/frontend/util.cc
+++ b/src/frontend/util.cc
@@ -75,7 +75,7 @@ void UpdateFriends (void)
*
***************************************************************************/
{
- register BitBoard *w, *b;
+ BitBoard *w, *b;
w = board.b[white];
b = board.b[black];
--
2.39.1

View File

@ -0,0 +1,33 @@
From 1081b76df1f5d89a312db5bb16bc0da33f50f6fa Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Thu, 2 Feb 2023 06:21:31 +0000
Subject: [PATCH] configure.ac: Fix autoconf quoting breaking AC_FUNC_MEMCMP
See the linked autoconf bug for details, but the gist is that AC_FUNC_MEMCMP
ends up lacking the needed includes for string.h if a raw 'if' is used as
opposed to AS_IF.
Quote properly with AS_IF to allow proper generation of the AC_FUNC_MEMCMP
test and avoid -Wimplicit-function-declaration (which will be fatal in some
compilers soon, like Clang 16) in its test.
Bug: https://savannah.gnu.org/support/?110530
--- a/configure.ac
+++ b/configure.ac
@@ -35,11 +35,11 @@ AC_ARG_WITH(readline,
ac_cv_use_readline=yes)
dnl Check for readline library _and_ headers
-if test x"$ac_cv_use_readline" = "xyes"; then
+AS_IF([test x"$ac_cv_use_readline" = "xyes"], [
AC_CHECK_LIB(ncurses, tputs)
AC_CHECK_LIB(readline, readline)
AC_CHECK_HEADERS(readline/readline.h readline/history.h)
-fi
+])
dnl Checks for header files.
AC_HEADER_STDC
--
2.39.1

View File

@ -1,9 +1,9 @@
# Copyright 1999-2022 Gentoo Authors
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
EAPI=8
inherit flag-o-matic
inherit autotools flag-o-matic
DESCRIPTION="Console based chess interface"
HOMEPAGE="https://www.gnu.org/software/chess/chess.html"
@ -13,6 +13,18 @@ LICENSE="GPL-3"
SLOT="0"
KEYWORDS="amd64 ~arm arm64 ppc64 ~riscv x86"
PATCHES=(
"${FILESDIR}"/${PN}-6.2.9-c++17.patch
"${FILESDIR}"/${PN}-6.2.9-configure-quoting.patch
)
src_prepare() {
default
# Needed for clang 16 patch (quoting)
eautoreconf
}
src_configure() {
# -Wodr warnings, bug #858611
filter-lto