Clean up the Spiff code so that it emits fewer warnings. This

consists mostly of changing sloppy K&R C code to slightly more
disciplined K&R C code, and doing the usual things to shut gcc up.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12877 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Brian Gaeke 2004-04-13 03:24:45 +00:00
parent 401be2c18c
commit cce5a349d9
18 changed files with 52 additions and 12 deletions

View File

@ -187,6 +187,7 @@ char *str;
return(W_BOLNULL);
}
int
W_is_bol(ptr)
W_bol ptr;
{
@ -234,6 +235,7 @@ char *str;
return(W_LITNULL);
}
int
W_is_lit(ptr)
W_lit ptr;
{
@ -281,6 +283,7 @@ char *str;
return(W_COMNULL);
}
int
W_is_com(ptr)
W_com ptr;
{
@ -300,6 +303,7 @@ W_com ptr;
return(0);
}
int
W_is_nesting(ptr)
W_com ptr;
{

View File

@ -66,6 +66,7 @@ extern W_com W_iscom();
extern int W_is_bol();
extern int W_is_lit();
extern int W_is_com();
extern int W_is_nesting();
extern _W_bolstruct _W_bols[];
extern _W_litstruct _W_lits[];

View File

@ -21,6 +21,11 @@ static char rcsid[]= "$Header$";
#include <ctype.h>
static int _X_strcmp();
static int _X_cmptokens();
static int _X_floatdiff();
int
X_com(a,b,flags)
int a,b,flags;
{

View File

@ -13,6 +13,8 @@ static char rcsid[]= "$Header$";
#include "misc.h"
#include "edit.h"
#include "compare.h"
#include <stdio.h>
/*
** routine to compare each object with its ordinal twin

View File

@ -11,6 +11,8 @@
static char rcsid[]= "$Header$";
#endif
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include "misc.h"
#include "floatrep.h"
@ -37,6 +39,7 @@ int floatcnt = 0;
** returns 0 if string can't be interpreted as a float
** otherwise returns the number of digits that will be used in F_atof
*/
int
F_isfloat(str,need_decimal,allow_sign)
char *str;
int need_decimal; /* if non-zero, require that a decimal point be present
@ -367,7 +370,7 @@ F_floatsub(p1,p2)
F_float p1,p2;
{
static F_float result;
static needinit = 1;
static int needinit = 1;
static char man1[R_MANMAX],man2[R_MANMAX],diff[R_MANMAX];
int exp1,exp2;
char *diffptr,*big,*small;
@ -500,6 +503,7 @@ F_float p1,p2;
return(result);
}
int
F_floatcmp(f1,f2)
F_float f1,f2;
{
@ -645,14 +649,18 @@ F_float f1,f2;
return(result);
}
int
_F_xor(x,y)
int x, y;
{
return(((x) && !(y)) || (!(x) && (y)));
}
#define _F_SAMESIGN(x,y) _F_xor((x<0),(y<0))
#define _F_ABSADD(x,y) (Z_ABS(x) + Z_ABS(y))
int
_F_ABSDIFF(x,y)
int x, y;
{
if (Z_ABS(x) < Z_ABS(y))
{

View File

@ -27,6 +27,8 @@ extern F_float F_atof();
extern F_float F_floatmul();
extern F_float F_floatmagadd();
extern F_float F_floatsub();
extern int F_floatcmp();
extern int F_isfloat();
#define F_null ((F_float) 0)

View File

@ -24,6 +24,7 @@ R_makefloat()
return(retval);
}
int
R_getexp(ptr)
R_float ptr;
{

View File

@ -63,6 +63,7 @@ char *str;
**
** stores data and sets maximum counts
*/
int
L_init_file(fnumber,fname)
int fnumber;
char *fname;

View File

@ -11,9 +11,11 @@
static char rcsid[]= "$Header$";
#endif
#include <stdio.h>
#include "misc.h"
#include "token.h"
#include "edit.h"
#include "compare.h"
#define MAXT K_MAXTOKENS
#define ORIGIN (max_obj/2)
@ -78,7 +80,7 @@ int comflags;
for (k = lower; k<= upper; k+= 2) {
new = E_edit_alloc();
if (k == ORIGIN-d || k!= ORIGIN+d && last_d[k+1] >= last_d[k-1]) {
if (k == ORIGIN-d || (k!= ORIGIN+d && last_d[k+1] >= last_d[k-1])) {
row = last_d[k+1]+1;
E_setnext(new,script[k+1]);
E_setop(new,E_DELETE);

View File

@ -15,6 +15,7 @@ static char rcsid[]= "$Header$";
#include "misc.h"
#include "visual.h"
#include "output.h"
#include <stdlib.h>
/*
** various routines used throughout the program
@ -101,7 +102,7 @@ _Z_myalloc(k)
int k;
{
int *tmp;
if (tmp = (int*) calloc((unsigned)k,(unsigned)1))
if ((tmp = (int*) calloc((unsigned)k,(unsigned)1)))
{
return(tmp);
}

View File

@ -12,6 +12,8 @@ static char rcsid[]= "$Header$";
#endif
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#ifdef M_TERMINFO
#include <curses.h>
@ -171,7 +173,7 @@ int start,end;
** convert a 0 origin token number to a 1 orgin token
** number or 1 origin line number as appropriate
*/
static
static int
_O_con_line(numb,flags,filenum)
int numb, flags,filenum;
{

View File

@ -21,7 +21,6 @@ static char rcsid[]= "$Header$";
#include "comment.h"
#include "parse.h"
#include <ctype.h>
#define _P_PARSE_CHATTER 1000
@ -64,7 +63,7 @@ _P_alpha_clear()
*_P_alpha = '\0';
}
static
static int
_P_in_alpha(chr)
char chr;
{
@ -128,13 +127,13 @@ _P_initparser()
}
static
static int
_P_needmore()
{
return(*_P_nextchr == '\0');
}
static
static int
_P_nextline()
{
/*
@ -370,7 +369,7 @@ W_bol bolptr;
/*
** pass over a comment -- look for nexting
*/
static
static int
_P_comsnarf(comptr)
W_com comptr;
{
@ -640,9 +639,9 @@ _P_do_parse()
/*
** see if this is a floating point number
*/
else if (tmp = F_isfloat(_P_nextchr,
else if ((tmp = F_isfloat(_P_nextchr,
_P_flags & U_NEED_DECIMAL,
_P_flags & U_INC_SIGN))
_P_flags & U_INC_SIGN)))
{
K_saventext(newtoken,_P_nextchr,tmp);
K_settype(newtoken,K_FLO_NUM);

View File

@ -13,6 +13,7 @@ static char rcsid[]= "$Header$";
#include <stdio.h>
#include <stdlib.h>
#include "misc.h"
#include "flagdefs.h"
#include "parse.h"
@ -27,7 +28,10 @@ static char rcsid[]= "$Header$";
#include "visual.h"
#include "output.h"
extern void _Y_doargs();
extern int L_init_file();
extern int V_visual();
static void _Y_doargs();
static int _Y_eflag = 0; /* use exact match algorithm */
static int _Y_vflag = 0; /* use visual mode */
@ -38,6 +42,7 @@ static int _Y_vflag = 0; /* use visual mode */
*/
static int _Y_flags;
int
main(argc,argv)
int argc;
char *argv[];

View File

@ -142,6 +142,7 @@ char **to,*from;
void
S_savenstr(to,from,cnt)
char **to,*from;
int cnt;
{
S_allocstr(to,cnt);
(void) strncpy(*to,from,cnt);

View File

@ -7,6 +7,7 @@
*/
#ifndef S_INCLUDED
#include <string.h>
extern void S_wordcpy();
extern void S_skipword();
extern void S_skipspace();

View File

@ -11,6 +11,7 @@
static char rcsid[]= "$Header$";
#endif
#include <stdio.h>
#include "misc.h"
#include "float.h"
#include "tol.h"
@ -213,7 +214,9 @@ char *str;
}
}
int
T_moretols(next_tol)
int next_tol;
{
return((next_tol >= 0) &&
(_T_TOLMAX-1 > next_tol) &&

View File

@ -35,6 +35,7 @@ extern void T_initdefault();
extern void T_setdef();
extern void T_tolline();
extern T_tol T_picktol();
extern int T_moretols();
#define T_gettype(x) (x->tol_type)
#define T_getfloat(x) (x->flo_tol)

View File

@ -396,6 +396,7 @@ V_cleanup()
** dummy code for systems that don't have
** the mgr window manager installed
*/
int
V_visual(d)
int d;
{