Kill __P(), use ANSI function declarations, constify; WARNS=3.

This commit is contained in:
xtraeme 2005-02-17 17:29:58 +00:00
parent abda23981e
commit 1db2ef90e1
9 changed files with 60 additions and 72 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: C.c,v 1.11 2004/06/20 22:20:15 jmc Exp $ */
/* $NetBSD: C.c,v 1.12 2005/02/17 17:29:58 xtraeme Exp $ */
/*
* Copyright (c) 1987, 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)C.c 8.4 (Berkeley) 4/2/94";
#else
__RCSID("$NetBSD: C.c,v 1.11 2004/06/20 22:20:15 jmc Exp $");
__RCSID("$NetBSD: C.c,v 1.12 2005/02/17 17:29:58 xtraeme Exp $");
#endif
#endif /* not lint */
@ -48,17 +48,17 @@ __RCSID("$NetBSD: C.c,v 1.11 2004/06/20 22:20:15 jmc Exp $");
#include "ctags.h"
static int func_entry __P((void));
static void hash_entry __P((void));
static void skip_string __P((int));
static int str_entry __P((int));
static int func_entry(void);
static void hash_entry(void);
static void skip_string(int);
static int str_entry(int);
/*
* c_entries --
* read .c and .h files and call appropriate routines
*/
void
c_entries()
c_entries(void)
{
int c; /* current character */
int level; /* brace level */
@ -255,7 +255,7 @@ c_entries()
* handle a function reference
*/
static int
func_entry()
func_entry(void)
{
int c; /* current character */
int level = 0; /* for matching '()' */
@ -353,7 +353,7 @@ fnd:
* handle a line starting with a '#'
*/
static void
hash_entry()
hash_entry(void)
{
int c; /* character read */
int curline; /* line started on */
@ -410,8 +410,7 @@ skip: if (c == '\n') { /* get rid of rest of define */
* handle a struct, union or enum entry
*/
static int
str_entry(c)
int c; /* current character */
str_entry(int c /* current character */)
{
int curline; /* line started on */
char *sp; /* buffer pointer */
@ -493,8 +492,7 @@ skip_comment(int commenttype)
* skip to the end of a string or character constant.
*/
void
skip_string(key)
int key;
skip_string(int key)
{
int c,
skip;
@ -519,8 +517,7 @@ skip_string(key)
* skip to next char "key"
*/
int
skip_key(key)
int key;
skip_key(int key)
{
int c,
skip,

View File

@ -1,8 +1,10 @@
# $NetBSD: Makefile,v 1.6 2003/05/18 07:57:33 lukem Exp $
# $NetBSD: Makefile,v 1.7 2005/02/17 17:29:58 xtraeme 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
WARNS= 3
.include <bsd.prog.mk>

View File

@ -1,4 +1,4 @@
/* $NetBSD: ctags.c,v 1.10 2004/06/20 22:20:15 jmc Exp $ */
/* $NetBSD: ctags.c,v 1.11 2005/02/17 17:29:58 xtraeme Exp $ */
/*
* Copyright (c) 1987, 1993, 1994, 1995
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 1993, 1994, 1995\n\
#if 0
static char sccsid[] = "@(#)ctags.c 8.4 (Berkeley) 2/7/95";
#endif
__RCSID("$NetBSD: ctags.c,v 1.10 2004/06/20 22:20:15 jmc Exp $");
__RCSID("$NetBSD: ctags.c,v 1.11 2005/02/17 17:29:58 xtraeme Exp $");
#endif /* not lint */
#include <err.h>
@ -80,16 +80,13 @@ char *curfile; /* current input file name */
char searchar = '/'; /* use /.../ searches by default */
char lbuf[LINE_MAX];
void init __P((void));
int main __P((int, char **));
void find_entries __P((char *));
void init(void);
void find_entries(char *);
int
main(argc, argv)
int argc;
char **argv;
main(int argc, char **argv)
{
static char *outfile = "tags"; /* output file */
static const char *outfile = "tags"; /* output file */
int aflag; /* -a: append to tags */
int uflag; /* -u: update tags */
int exit_val; /* exit value */
@ -193,10 +190,10 @@ usage: (void)fprintf(stderr,
* the string CWHITE, else NO.
*/
void
init()
init(void)
{
int i;
unsigned char *sp;
unsigned const char *sp;
for (i = 0; i < 256; i++) {
_wht[i] = _etk[i] = _itk[i] = _btk[i] = NO;
@ -225,8 +222,7 @@ init()
* which searches the file.
*/
void
find_entries(file)
char *file;
find_entries(char *file)
{
char *cp;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ctags.h,v 1.7 2003/10/27 00:12:43 lukem Exp $ */
/* $NetBSD: ctags.h,v 1.8 2005/02/17 17:29:58 xtraeme Exp $ */
/*
* Copyright (c) 1987, 1993, 1994
@ -79,14 +79,14 @@ extern char lbuf[LINE_MAX];
extern char *lbp;
extern char searchar; /* ex search character */
extern int cicmp __P((char *));
extern void getline __P((void));
extern void pfnote __P((char *, int));
extern int skip_key __P((int));
extern void put_entries __P((NODE *));
extern void toss_yysec __P((void));
extern void l_entries __P((void));
extern void y_entries __P((void));
extern int PF_funcs __P((void));
extern void c_entries __P((void));
extern void skip_comment __P((int));
extern int cicmp(const char *);
extern void getline(void);
extern void pfnote(const char *, int);
extern int skip_key(int);
extern void put_entries(NODE *);
extern void toss_yysec(void);
extern void l_entries(void);
extern void y_entries(void);
extern int PF_funcs(void);
extern void c_entries(void);
extern void skip_comment(int);

View File

@ -1,4 +1,4 @@
/* $NetBSD: fortran.c,v 1.9 2004/06/20 22:20:15 jmc Exp $ */
/* $NetBSD: fortran.c,v 1.10 2005/02/17 17:29:58 xtraeme Exp $ */
/*
* Copyright (c) 1987, 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)fortran.c 8.3 (Berkeley) 4/2/94";
#else
__RCSID("$NetBSD: fortran.c,v 1.9 2004/06/20 22:20:15 jmc Exp $");
__RCSID("$NetBSD: fortran.c,v 1.10 2005/02/17 17:29:58 xtraeme Exp $");
#endif
#endif /* not lint */
@ -49,12 +49,12 @@ __RCSID("$NetBSD: fortran.c,v 1.9 2004/06/20 22:20:15 jmc Exp $");
#include "ctags.h"
static void takeprec __P((void));
static void takeprec(void);
char *lbp; /* line buffer pointer */
int
PF_funcs()
PF_funcs(void)
{
bool pfcnt; /* pascal/fortran functions found */
char *cp;
@ -142,8 +142,7 @@ PF_funcs()
* do case-independent strcmp
*/
int
cicmp(cp)
char *cp;
cicmp(const char *cp)
{
int len;
char *bp;
@ -159,7 +158,7 @@ cicmp(cp)
}
static void
takeprec()
takeprec(void)
{
for (; isspace((unsigned char)*lbp); ++lbp)
continue;

View File

@ -1,4 +1,4 @@
/* $NetBSD: lisp.c,v 1.9 2004/06/20 22:20:15 jmc Exp $ */
/* $NetBSD: lisp.c,v 1.10 2005/02/17 17:29:58 xtraeme Exp $ */
/*
* Copyright (c) 1987, 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)lisp.c 8.3 (Berkeley) 4/2/94";
#else
__RCSID("$NetBSD: lisp.c,v 1.9 2004/06/20 22:20:15 jmc Exp $");
__RCSID("$NetBSD: lisp.c,v 1.10 2005/02/17 17:29:58 xtraeme Exp $");
#endif
#endif /* not lint */
@ -54,7 +54,7 @@ __RCSID("$NetBSD: lisp.c,v 1.9 2004/06/20 22:20:15 jmc Exp $");
* just look for (def or (DEF
*/
void
l_entries()
l_entries(void)
{
int special;
char *cp;

View File

@ -1,4 +1,4 @@
/* $NetBSD: print.c,v 1.8 2004/06/20 22:20:15 jmc Exp $ */
/* $NetBSD: print.c,v 1.9 2005/02/17 17:29:58 xtraeme Exp $ */
/*
* Copyright (c) 1987, 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)print.c 8.3 (Berkeley) 4/2/94";
#else
__RCSID("$NetBSD: print.c,v 1.8 2004/06/20 22:20:15 jmc Exp $");
__RCSID("$NetBSD: print.c,v 1.9 2005/02/17 17:29:58 xtraeme Exp $");
#endif
#endif /* not lint */
@ -56,7 +56,7 @@ __RCSID("$NetBSD: print.c,v 1.8 2004/06/20 22:20:15 jmc Exp $");
* prepare it for printing.
*/
void
getline()
getline(void)
{
long saveftell;
int c;
@ -102,8 +102,7 @@ getline()
* write out the tags
*/
void
put_entries(node)
NODE *node;
put_entries(NODE *node)
{
if (node->left)

View File

@ -1,4 +1,4 @@
/* $NetBSD: tree.c,v 1.10 2004/06/20 22:20:15 jmc Exp $ */
/* $NetBSD: tree.c,v 1.11 2005/02/17 17:29:58 xtraeme Exp $ */
/*
* Copyright (c) 1987, 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)tree.c 8.3 (Berkeley) 4/2/94";
#else
__RCSID("$NetBSD: tree.c,v 1.10 2004/06/20 22:20:15 jmc Exp $");
__RCSID("$NetBSD: tree.c,v 1.11 2005/02/17 17:29:58 xtraeme Exp $");
#endif
#endif /* not lint */
@ -50,17 +50,15 @@ __RCSID("$NetBSD: tree.c,v 1.10 2004/06/20 22:20:15 jmc Exp $");
#include "ctags.h"
static void add_node __P((NODE *, NODE *));
static void free_tree __P((NODE *));
static void add_node(NODE *, NODE *);
static void free_tree(NODE *);
/*
* pfnote --
* enter a new node in the tree
*/
void
pfnote(name, ln)
char *name;
int ln;
pfnote(const char *name, int ln)
{
NODE *np;
char *fp;
@ -100,9 +98,7 @@ pfnote(name, ln)
}
static void
add_node(node, cur_node)
NODE *node,
*cur_node;
add_node(NODE *node, NODE *cur_node)
{
int dif;
@ -132,8 +128,7 @@ add_node(node, cur_node)
}
static void
free_tree(node)
NODE *node;
free_tree(NODE *node)
{
while (node) {
if (node->right)

View File

@ -1,4 +1,4 @@
/* $NetBSD: yacc.c,v 1.9 2004/06/20 22:20:15 jmc Exp $ */
/* $NetBSD: yacc.c,v 1.10 2005/02/17 17:29:58 xtraeme Exp $ */
/*
* Copyright (c) 1987, 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)yacc.c 8.3 (Berkeley) 4/2/94";
#else
__RCSID("$NetBSD: yacc.c,v 1.9 2004/06/20 22:20:15 jmc Exp $");
__RCSID("$NetBSD: yacc.c,v 1.10 2005/02/17 17:29:58 xtraeme Exp $");
#endif
#endif /* not lint */
@ -54,7 +54,7 @@ __RCSID("$NetBSD: yacc.c,v 1.9 2004/06/20 22:20:15 jmc Exp $");
* find the yacc tags and put them in.
*/
void
y_entries()
y_entries(void)
{
int c;
char *sp;
@ -126,7 +126,7 @@ y_entries()
* throw away lines up to the next "\n%%\n"
*/
void
toss_yysec()
toss_yysec(void)
{
int c; /* read character */
int state;