summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorBrian Gaeke <gaeke@uiuc.edu>2004-04-13 03:24:45 +0000
committerBrian Gaeke <gaeke@uiuc.edu>2004-04-13 03:24:45 +0000
commitcce5a349d925f51344f3fc63d44ce852afd3d1d1 (patch)
treee1b367a72516e99b2ef83f79afe867e4d977fe00 /utils
parent401be2c18c104cd25b9889143859580c4b7c78b7 (diff)
downloadllvm-cce5a349d925f51344f3fc63d44ce852afd3d1d1.tar.gz
llvm-cce5a349d925f51344f3fc63d44ce852afd3d1d1.tar.bz2
llvm-cce5a349d925f51344f3fc63d44ce852afd3d1d1.tar.xz
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
Diffstat (limited to 'utils')
-rw-r--r--utils/Spiff/comment.c4
-rw-r--r--utils/Spiff/comment.h1
-rw-r--r--utils/Spiff/compare.c5
-rw-r--r--utils/Spiff/exact.c2
-rw-r--r--utils/Spiff/float.c10
-rw-r--r--utils/Spiff/float.h2
-rw-r--r--utils/Spiff/floatrep.c1
-rw-r--r--utils/Spiff/line.c1
-rw-r--r--utils/Spiff/miller.c4
-rw-r--r--utils/Spiff/misc.c3
-rw-r--r--utils/Spiff/output.c4
-rw-r--r--utils/Spiff/parse.c13
-rw-r--r--utils/Spiff/spiff.c7
-rw-r--r--utils/Spiff/strings.c1
-rw-r--r--utils/Spiff/strings.h1
-rw-r--r--utils/Spiff/tol.c3
-rw-r--r--utils/Spiff/tol.h1
-rw-r--r--utils/Spiff/visual.c1
18 files changed, 52 insertions, 12 deletions
diff --git a/utils/Spiff/comment.c b/utils/Spiff/comment.c
index f9a3827589..8f2e22d827 100644
--- a/utils/Spiff/comment.c
+++ b/utils/Spiff/comment.c
@@ -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;
{
diff --git a/utils/Spiff/comment.h b/utils/Spiff/comment.h
index 01d8423021..60bb6ed35a 100644
--- a/utils/Spiff/comment.h
+++ b/utils/Spiff/comment.h
@@ -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[];
diff --git a/utils/Spiff/compare.c b/utils/Spiff/compare.c
index 90af24b3d8..edcbfeef33 100644
--- a/utils/Spiff/compare.c
+++ b/utils/Spiff/compare.c
@@ -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;
{
diff --git a/utils/Spiff/exact.c b/utils/Spiff/exact.c
index 3bcce5c694..c09e9c7d52 100644
--- a/utils/Spiff/exact.c
+++ b/utils/Spiff/exact.c
@@ -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
diff --git a/utils/Spiff/float.c b/utils/Spiff/float.c
index f6f9e87a0f..b20efb70d6 100644
--- a/utils/Spiff/float.c
+++ b/utils/Spiff/float.c
@@ -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))
{
diff --git a/utils/Spiff/float.h b/utils/Spiff/float.h
index 9a96255122..82c2424767 100644
--- a/utils/Spiff/float.h
+++ b/utils/Spiff/float.h
@@ -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)
diff --git a/utils/Spiff/floatrep.c b/utils/Spiff/floatrep.c
index 4847f47723..22fd78526f 100644
--- a/utils/Spiff/floatrep.c
+++ b/utils/Spiff/floatrep.c
@@ -24,6 +24,7 @@ R_makefloat()
return(retval);
}
+int
R_getexp(ptr)
R_float ptr;
{
diff --git a/utils/Spiff/line.c b/utils/Spiff/line.c
index 947f1faa48..e358a1806c 100644
--- a/utils/Spiff/line.c
+++ b/utils/Spiff/line.c
@@ -63,6 +63,7 @@ char *str;
**
** stores data and sets maximum counts
*/
+int
L_init_file(fnumber,fname)
int fnumber;
char *fname;
diff --git a/utils/Spiff/miller.c b/utils/Spiff/miller.c
index 63c7660a7a..ed83d640cb 100644
--- a/utils/Spiff/miller.c
+++ b/utils/Spiff/miller.c
@@ -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);
diff --git a/utils/Spiff/misc.c b/utils/Spiff/misc.c
index 3bdf164f27..3c77673a9d 100644
--- a/utils/Spiff/misc.c
+++ b/utils/Spiff/misc.c
@@ -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);
}
diff --git a/utils/Spiff/output.c b/utils/Spiff/output.c
index 3db9044a05..db157468d2 100644
--- a/utils/Spiff/output.c
+++ b/utils/Spiff/output.c
@@ -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;
{
diff --git a/utils/Spiff/parse.c b/utils/Spiff/parse.c
index 55722b701d..1d2fd18480 100644
--- a/utils/Spiff/parse.c
+++ b/utils/Spiff/parse.c
@@ -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);
diff --git a/utils/Spiff/spiff.c b/utils/Spiff/spiff.c
index eb0c755887..9d547850c8 100644
--- a/utils/Spiff/spiff.c
+++ b/utils/Spiff/spiff.c
@@ -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[];
diff --git a/utils/Spiff/strings.c b/utils/Spiff/strings.c
index 07745635c6..ebd1427bc4 100644
--- a/utils/Spiff/strings.c
+++ b/utils/Spiff/strings.c
@@ -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);
diff --git a/utils/Spiff/strings.h b/utils/Spiff/strings.h
index b265680047..95c341b653 100644
--- a/utils/Spiff/strings.h
+++ b/utils/Spiff/strings.h
@@ -7,6 +7,7 @@
*/
#ifndef S_INCLUDED
+#include <string.h>
extern void S_wordcpy();
extern void S_skipword();
extern void S_skipspace();
diff --git a/utils/Spiff/tol.c b/utils/Spiff/tol.c
index 6812355cc4..bc14778f25 100644
--- a/utils/Spiff/tol.c
+++ b/utils/Spiff/tol.c
@@ -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) &&
diff --git a/utils/Spiff/tol.h b/utils/Spiff/tol.h
index 87c291133a..b03673afea 100644
--- a/utils/Spiff/tol.h
+++ b/utils/Spiff/tol.h
@@ -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)
diff --git a/utils/Spiff/visual.c b/utils/Spiff/visual.c
index 93fb38e4e0..121614b8a6 100644
--- a/utils/Spiff/visual.c
+++ b/utils/Spiff/visual.c
@@ -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;
{