ctags: fix pointer-sign issues

Refactor init() to avoid -Wpointer-sign for host builds.
Uses same cast pattern used in ctags.h.
This commit is contained in:
lukem 2023-07-20 20:00:07 +00:00
parent b478b13b30
commit 995dd11d74
2 changed files with 9 additions and 13 deletions

View File

@ -1,12 +1,8 @@
# $NetBSD: Makefile,v 1.13 2012/08/10 12:10:27 joerg Exp $
# $NetBSD: Makefile,v 1.14 2023/07/20 20:00:07 lukem Exp $
# @(#)Makefile 8.1 (Berkeley) 6/6/93
PROG= ctags
CPPFLAGS+=-I${.CURDIR}
SRCS= C.c ctags.c fortran.c lisp.c print.c tree.c yacc.c
.if !defined(HOSTPROGNAME)
COPTS.ctags.c+= -Wno-pointer-sign
.endif
.include <bsd.prog.mk>

View File

@ -1,4 +1,4 @@
/* $NetBSD: ctags.c,v 1.13 2019/02/03 03:19:29 mrg Exp $ */
/* $NetBSD: ctags.c,v 1.14 2023/07/20 20:00:07 lukem Exp $ */
/*
* Copyright (c) 1987, 1993, 1994, 1995
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 1993, 1994, 1995\
#if 0
static char sccsid[] = "@(#)ctags.c 8.4 (Berkeley) 2/7/95";
#endif
__RCSID("$NetBSD: ctags.c,v 1.13 2019/02/03 03:19:29 mrg Exp $");
__RCSID("$NetBSD: ctags.c,v 1.14 2023/07/20 20:00:07 lukem Exp $");
#endif /* not lint */
#include <err.h>
@ -194,7 +194,7 @@ void
init(void)
{
int i;
unsigned const char *sp;
const char *sp;
for (i = 0; i < 256; i++) {
_wht[i] = _etk[i] = _itk[i] = _btk[i] = NO;
@ -202,19 +202,19 @@ init(void)
}
#define CWHITE " \f\t\n"
for (sp = CWHITE; *sp; sp++) /* white space chars */
_wht[*sp] = YES;
_wht[(unsigned)*sp] = YES;
#define CTOKEN " \t\n\"'#()[]{}=-+%*/&|^~!<>;,.:?"
for (sp = CTOKEN; *sp; sp++) /* token ending chars */
_etk[*sp] = YES;
_etk[(unsigned)*sp] = YES;
#define CINTOK "ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz0123456789"
for (sp = CINTOK; *sp; sp++) /* valid in-token chars */
_itk[*sp] = YES;
_itk[(unsigned)*sp] = YES;
#define CBEGIN "ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz"
for (sp = CBEGIN; *sp; sp++) /* token starting chars */
_btk[*sp] = YES;
_btk[(unsigned)*sp] = YES;
#define CNOTGD ",;"
for (sp = CNOTGD; *sp; sp++) /* invalid after-function chars */
_gd[*sp] = NO;
_gd[(unsigned)*sp] = NO;
}
/*