Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/ctags ctags: fix pointer-sign issues



details:   https://anonhg.NetBSD.org/src/rev/ce24a2f3c502
branches:  trunk
changeset: 378111:ce24a2f3c502
user:      lukem <lukem%NetBSD.org@localhost>
date:      Thu Jul 20 20:00:07 2023 +0000

description:
ctags: fix pointer-sign issues

Refactor init() to avoid -Wpointer-sign for host builds.
Uses same cast pattern used in ctags.h.

diffstat:

 usr.bin/ctags/Makefile |   6 +-----
 usr.bin/ctags/ctags.c  |  16 ++++++++--------
 2 files changed, 9 insertions(+), 13 deletions(-)

diffs (69 lines):

diff -r c60534240564 -r ce24a2f3c502 usr.bin/ctags/Makefile
--- a/usr.bin/ctags/Makefile    Thu Jul 20 18:02:45 2023 +0000
+++ b/usr.bin/ctags/Makefile    Thu Jul 20 20:00:07 2023 +0000
@@ -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>
diff -r c60534240564 -r ce24a2f3c502 usr.bin/ctags/ctags.c
--- a/usr.bin/ctags/ctags.c     Thu Jul 20 18:02:45 2023 +0000
+++ b/usr.bin/ctags/ctags.c     Thu Jul 20 20:00:07 2023 +0000
@@ -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 @@
 #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;
 }
 
 /*



Home | Main Index | Thread Index | Old Index