[llvm-commits] CVS: llvm/utils/Spiff/comment.c comment.h compare.c exact.c float.c float.h floatrep.c line.c miller.c misc.c output.c parse.c spiff.c strings.c strings.h tol.c tol.h visual.c

Brian Gaeke gaeke at cs.uiuc.edu
Mon Apr 12 22:25:02 PDT 2004


Changes in directory llvm/utils/Spiff:

comment.c updated: 1.1 -> 1.2
comment.h updated: 1.1 -> 1.2
compare.c updated: 1.1 -> 1.2
exact.c updated: 1.1 -> 1.2
float.c updated: 1.1 -> 1.2
float.h updated: 1.1 -> 1.2
floatrep.c updated: 1.1 -> 1.2
line.c updated: 1.1 -> 1.2
miller.c updated: 1.1 -> 1.2
misc.c updated: 1.1 -> 1.2
output.c updated: 1.1 -> 1.2
parse.c updated: 1.1 -> 1.2
spiff.c updated: 1.1 -> 1.2
strings.c updated: 1.1 -> 1.2
strings.h updated: 1.1 -> 1.2
tol.c updated: 1.1 -> 1.2
tol.h updated: 1.1 -> 1.2
visual.c updated: 1.1 -> 1.2

---
Log message:

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.


---
Diffs of the changes:  (+66 -26)

Index: llvm/utils/Spiff/comment.c
diff -u llvm/utils/Spiff/comment.c:1.1 llvm/utils/Spiff/comment.c:1.2
--- llvm/utils/Spiff/comment.c:1.1	Mon Apr 12 17:53:24 2004
+++ llvm/utils/Spiff/comment.c	Mon Apr 12 22:24:45 2004
@@ -8,7 +8,7 @@
 
 
 #ifndef lint
-static char rcsid[]= "$Header: /home/vadve/shared/PublicCVS/llvm/utils/Spiff/comment.c,v 1.1 2004/04/12 22:53:24 gaeke Exp $";
+static char rcsid[]= "$Header: /home/vadve/shared/PublicCVS/llvm/utils/Spiff/comment.c,v 1.2 2004/04/13 03:24:45 gaeke Exp $";
 #endif
 
 
@@ -187,6 +187,7 @@
 	return(W_BOLNULL);
 }
 
+int
 W_is_bol(ptr)
 W_bol ptr;
 {
@@ -234,6 +235,7 @@
 	return(W_LITNULL);
 }
 
+int
 W_is_lit(ptr)
 W_lit ptr;
 {
@@ -281,6 +283,7 @@
 	return(W_COMNULL);
 }
 
+int
 W_is_com(ptr)
 W_com ptr;
 {
@@ -300,6 +303,7 @@
 	return(0);
 }
 
+int
 W_is_nesting(ptr)
 W_com ptr;
 {


Index: llvm/utils/Spiff/comment.h
diff -u llvm/utils/Spiff/comment.h:1.1 llvm/utils/Spiff/comment.h:1.2
--- llvm/utils/Spiff/comment.h:1.1	Mon Apr 12 17:53:24 2004
+++ llvm/utils/Spiff/comment.h	Mon Apr 12 22:24:45 2004
@@ -66,6 +66,7 @@
 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[];


Index: llvm/utils/Spiff/compare.c
diff -u llvm/utils/Spiff/compare.c:1.1 llvm/utils/Spiff/compare.c:1.2
--- llvm/utils/Spiff/compare.c:1.1	Mon Apr 12 17:53:24 2004
+++ llvm/utils/Spiff/compare.c	Mon Apr 12 22:24:45 2004
@@ -8,7 +8,7 @@
 
 
 #ifndef lint
-static char rcsid[]= "$Header: /home/vadve/shared/PublicCVS/llvm/utils/Spiff/compare.c,v 1.1 2004/04/12 22:53:24 gaeke Exp $";
+static char rcsid[]= "$Header: /home/vadve/shared/PublicCVS/llvm/utils/Spiff/compare.c,v 1.2 2004/04/13 03:24:45 gaeke Exp $";
 #endif
 
 #include "misc.h"
@@ -21,6 +21,11 @@
 
 #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;
 {


Index: llvm/utils/Spiff/exact.c
diff -u llvm/utils/Spiff/exact.c:1.1 llvm/utils/Spiff/exact.c:1.2
--- llvm/utils/Spiff/exact.c:1.1	Mon Apr 12 17:53:24 2004
+++ llvm/utils/Spiff/exact.c	Mon Apr 12 22:24:45 2004
@@ -8,11 +8,13 @@
 
 
 #ifndef lint
-static char rcsid[]= "$Header: /home/vadve/shared/PublicCVS/llvm/utils/Spiff/exact.c,v 1.1 2004/04/12 22:53:24 gaeke Exp $";
+static char rcsid[]= "$Header: /home/vadve/shared/PublicCVS/llvm/utils/Spiff/exact.c,v 1.2 2004/04/13 03:24:45 gaeke Exp $";
 #endif
 
 #include "misc.h"
 #include "edit.h"
+#include "compare.h"
+#include <stdio.h>
 
 /*
 **	routine to compare each object with its ordinal twin


Index: llvm/utils/Spiff/float.c
diff -u llvm/utils/Spiff/float.c:1.1 llvm/utils/Spiff/float.c:1.2
--- llvm/utils/Spiff/float.c:1.1	Mon Apr 12 17:53:24 2004
+++ llvm/utils/Spiff/float.c	Mon Apr 12 22:24:45 2004
@@ -8,9 +8,11 @@
 
 
 #ifndef lint
-static char rcsid[]= "$Header: /home/vadve/shared/PublicCVS/llvm/utils/Spiff/float.c,v 1.1 2004/04/12 22:53:24 gaeke Exp $";
+static char rcsid[]= "$Header: /home/vadve/shared/PublicCVS/llvm/utils/Spiff/float.c,v 1.2 2004/04/13 03:24:45 gaeke Exp $";
 #endif
 
+#include <stdio.h>
+#include <stdlib.h>
 #include <ctype.h>
 #include "misc.h"
 #include "floatrep.h"
@@ -37,6 +39,7 @@
 **	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_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 @@
 	return(result);
 }
 
+int
 F_floatcmp(f1,f2)
 F_float f1,f2;
 {
@@ -645,14 +649,18 @@
 	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))
 	{


Index: llvm/utils/Spiff/float.h
diff -u llvm/utils/Spiff/float.h:1.1 llvm/utils/Spiff/float.h:1.2
--- llvm/utils/Spiff/float.h:1.1	Mon Apr 12 17:53:24 2004
+++ llvm/utils/Spiff/float.h	Mon Apr 12 22:24:45 2004
@@ -27,6 +27,8 @@
 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)
 


Index: llvm/utils/Spiff/floatrep.c
diff -u llvm/utils/Spiff/floatrep.c:1.1 llvm/utils/Spiff/floatrep.c:1.2
--- llvm/utils/Spiff/floatrep.c:1.1	Mon Apr 12 17:53:24 2004
+++ llvm/utils/Spiff/floatrep.c	Mon Apr 12 22:24:45 2004
@@ -8,7 +8,7 @@
 
 
 #ifndef lint
-static char rcsid[]= "$Header: /home/vadve/shared/PublicCVS/llvm/utils/Spiff/floatrep.c,v 1.1 2004/04/12 22:53:24 gaeke Exp $";
+static char rcsid[]= "$Header: /home/vadve/shared/PublicCVS/llvm/utils/Spiff/floatrep.c,v 1.2 2004/04/13 03:24:45 gaeke Exp $";
 #endif
 
 #include "misc.h"
@@ -24,6 +24,7 @@
 	return(retval);
 }
 
+int
 R_getexp(ptr)
 R_float ptr;
 {


Index: llvm/utils/Spiff/line.c
diff -u llvm/utils/Spiff/line.c:1.1 llvm/utils/Spiff/line.c:1.2
--- llvm/utils/Spiff/line.c:1.1	Mon Apr 12 17:53:24 2004
+++ llvm/utils/Spiff/line.c	Mon Apr 12 22:24:45 2004
@@ -8,7 +8,7 @@
 
 
 #ifndef lint
-static char rcsid[]= "$Header: /home/vadve/shared/PublicCVS/llvm/utils/Spiff/line.c,v 1.1 2004/04/12 22:53:24 gaeke Exp $";
+static char rcsid[]= "$Header: /home/vadve/shared/PublicCVS/llvm/utils/Spiff/line.c,v 1.2 2004/04/13 03:24:45 gaeke Exp $";
 #endif
 
 #include <stdio.h>
@@ -63,6 +63,7 @@
 **
 **	stores data and sets maximum counts
 */
+int
 L_init_file(fnumber,fname)
 int fnumber;
 char *fname;


Index: llvm/utils/Spiff/miller.c
diff -u llvm/utils/Spiff/miller.c:1.1 llvm/utils/Spiff/miller.c:1.2
--- llvm/utils/Spiff/miller.c:1.1	Mon Apr 12 17:53:24 2004
+++ llvm/utils/Spiff/miller.c	Mon Apr 12 22:24:45 2004
@@ -8,12 +8,14 @@
 
 
 #ifndef lint
-static char rcsid[]= "$Header: /home/vadve/shared/PublicCVS/llvm/utils/Spiff/miller.c,v 1.1 2004/04/12 22:53:24 gaeke Exp $";
+static char rcsid[]= "$Header: /home/vadve/shared/PublicCVS/llvm/utils/Spiff/miller.c,v 1.2 2004/04/13 03:24:45 gaeke Exp $";
 #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 @@
 		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);


Index: llvm/utils/Spiff/misc.c
diff -u llvm/utils/Spiff/misc.c:1.1 llvm/utils/Spiff/misc.c:1.2
--- llvm/utils/Spiff/misc.c:1.1	Mon Apr 12 17:53:24 2004
+++ llvm/utils/Spiff/misc.c	Mon Apr 12 22:24:45 2004
@@ -8,13 +8,14 @@
 
 
 #ifndef lint
-static char rcsid[]= "$Header: /home/vadve/shared/PublicCVS/llvm/utils/Spiff/misc.c,v 1.1 2004/04/12 22:53:24 gaeke Exp $";
+static char rcsid[]= "$Header: /home/vadve/shared/PublicCVS/llvm/utils/Spiff/misc.c,v 1.2 2004/04/13 03:24:45 gaeke Exp $";
 #endif
 
 #include <stdio.h>
 #include "misc.h"
 #include "visual.h"
 #include "output.h"
+#include <stdlib.h>
 
 /*
 **	various routines used throughout the program
@@ -101,7 +102,7 @@
 int k;
 {
 	int *tmp;
-	if (tmp = (int*) calloc((unsigned)k,(unsigned)1))
+	if ((tmp = (int*) calloc((unsigned)k,(unsigned)1)))
 	{
 		return(tmp);
 	}


Index: llvm/utils/Spiff/output.c
diff -u llvm/utils/Spiff/output.c:1.1 llvm/utils/Spiff/output.c:1.2
--- llvm/utils/Spiff/output.c:1.1	Mon Apr 12 17:53:24 2004
+++ llvm/utils/Spiff/output.c	Mon Apr 12 22:24:45 2004
@@ -8,10 +8,12 @@
 
 
 #ifndef lint
-static char rcsid[]= "$Header: /home/vadve/shared/PublicCVS/llvm/utils/Spiff/output.c,v 1.1 2004/04/12 22:53:24 gaeke Exp $";
+static char rcsid[]= "$Header: /home/vadve/shared/PublicCVS/llvm/utils/Spiff/output.c,v 1.2 2004/04/13 03:24:45 gaeke Exp $";
 #endif
 
 #include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
 
 #ifdef M_TERMINFO
 #include <curses.h>
@@ -171,7 +173,7 @@
 **	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;
 {


Index: llvm/utils/Spiff/parse.c
diff -u llvm/utils/Spiff/parse.c:1.1 llvm/utils/Spiff/parse.c:1.2
--- llvm/utils/Spiff/parse.c:1.1	Mon Apr 12 17:53:24 2004
+++ llvm/utils/Spiff/parse.c	Mon Apr 12 22:24:45 2004
@@ -8,7 +8,7 @@
 
 
 #ifndef lint
-static char rcsid[]= "$Header: /home/vadve/shared/PublicCVS/llvm/utils/Spiff/parse.c,v 1.1 2004/04/12 22:53:24 gaeke Exp $";
+static char rcsid[]= "$Header: /home/vadve/shared/PublicCVS/llvm/utils/Spiff/parse.c,v 1.2 2004/04/13 03:24:45 gaeke Exp $";
 #endif
 
 #include "misc.h"
@@ -21,7 +21,6 @@
 #include "comment.h"
 #include "parse.h"
 
-
 #include <ctype.h>
 
 #define _P_PARSE_CHATTER	1000
@@ -64,7 +63,7 @@
 	*_P_alpha = '\0';
 }
 
-static
+static int
 _P_in_alpha(chr)
 char chr;
 {
@@ -128,13 +127,13 @@
 }
 
 
-static
+static int
 _P_needmore()
 {
 	return(*_P_nextchr == '\0');
 }
 
-static
+static int
 _P_nextline()
 {
 	/*
@@ -370,7 +369,7 @@
 /*
 **	pass over a comment -- look for nexting
 */
-static
+static int
 _P_comsnarf(comptr)
 W_com comptr; 
 {
@@ -640,9 +639,9 @@
 		/*
 		**	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);


Index: llvm/utils/Spiff/spiff.c
diff -u llvm/utils/Spiff/spiff.c:1.1 llvm/utils/Spiff/spiff.c:1.2
--- llvm/utils/Spiff/spiff.c:1.1	Mon Apr 12 17:53:24 2004
+++ llvm/utils/Spiff/spiff.c	Mon Apr 12 22:24:45 2004
@@ -8,11 +8,12 @@
 
 
 #ifndef lint
-static char rcsid[]= "$Header: /home/vadve/shared/PublicCVS/llvm/utils/Spiff/spiff.c,v 1.1 2004/04/12 22:53:24 gaeke Exp $";
+static char rcsid[]= "$Header: /home/vadve/shared/PublicCVS/llvm/utils/Spiff/spiff.c,v 1.2 2004/04/13 03:24:45 gaeke Exp $";
 #endif
 
 
 #include <stdio.h>
+#include <stdlib.h>
 #include "misc.h"
 #include "flagdefs.h"
 #include "parse.h"
@@ -27,7 +28,10 @@
 #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_flags;
 
+int
 main(argc,argv)
 int argc;
 char *argv[];


Index: llvm/utils/Spiff/strings.c
diff -u llvm/utils/Spiff/strings.c:1.1 llvm/utils/Spiff/strings.c:1.2
--- llvm/utils/Spiff/strings.c:1.1	Mon Apr 12 17:53:24 2004
+++ llvm/utils/Spiff/strings.c	Mon Apr 12 22:24:45 2004
@@ -8,7 +8,7 @@
 
 
 #ifndef lint
-static char rcsid[]= "$Header: /home/vadve/shared/PublicCVS/llvm/utils/Spiff/strings.c,v 1.1 2004/04/12 22:53:24 gaeke Exp $";
+static char rcsid[]= "$Header: /home/vadve/shared/PublicCVS/llvm/utils/Spiff/strings.c,v 1.2 2004/04/13 03:24:45 gaeke Exp $";
 #endif
 
 #include <ctype.h>
@@ -142,6 +142,7 @@
 void
 S_savenstr(to,from,cnt)
 char **to,*from;
+int cnt;
 {
 	S_allocstr(to,cnt);
 	(void) strncpy(*to,from,cnt);


Index: llvm/utils/Spiff/strings.h
diff -u llvm/utils/Spiff/strings.h:1.1 llvm/utils/Spiff/strings.h:1.2
--- llvm/utils/Spiff/strings.h:1.1	Mon Apr 12 17:53:24 2004
+++ llvm/utils/Spiff/strings.h	Mon Apr 12 22:24:45 2004
@@ -7,6 +7,7 @@
 */
 
 #ifndef S_INCLUDED
+#include <string.h>
 extern void S_wordcpy();
 extern void S_skipword();
 extern void S_skipspace();


Index: llvm/utils/Spiff/tol.c
diff -u llvm/utils/Spiff/tol.c:1.1 llvm/utils/Spiff/tol.c:1.2
--- llvm/utils/Spiff/tol.c:1.1	Mon Apr 12 17:53:24 2004
+++ llvm/utils/Spiff/tol.c	Mon Apr 12 22:24:45 2004
@@ -8,9 +8,10 @@
 
 
 #ifndef lint
-static char rcsid[]= "$Header: /home/vadve/shared/PublicCVS/llvm/utils/Spiff/tol.c,v 1.1 2004/04/12 22:53:24 gaeke Exp $";
+static char rcsid[]= "$Header: /home/vadve/shared/PublicCVS/llvm/utils/Spiff/tol.c,v 1.2 2004/04/13 03:24:45 gaeke Exp $";
 #endif
 
+#include <stdio.h>
 #include "misc.h"
 #include "float.h"
 #include "tol.h"
@@ -213,7 +214,9 @@
 	}
 }
 
+int
 T_moretols(next_tol)
+int next_tol;
 {
 	return((next_tol >= 0) &&
 		(_T_TOLMAX-1 > next_tol) &&


Index: llvm/utils/Spiff/tol.h
diff -u llvm/utils/Spiff/tol.h:1.1 llvm/utils/Spiff/tol.h:1.2
--- llvm/utils/Spiff/tol.h:1.1	Mon Apr 12 17:53:24 2004
+++ llvm/utils/Spiff/tol.h	Mon Apr 12 22:24:45 2004
@@ -35,6 +35,7 @@
 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)


Index: llvm/utils/Spiff/visual.c
diff -u llvm/utils/Spiff/visual.c:1.1 llvm/utils/Spiff/visual.c:1.2
--- llvm/utils/Spiff/visual.c:1.1	Mon Apr 12 17:53:24 2004
+++ llvm/utils/Spiff/visual.c	Mon Apr 12 22:24:45 2004
@@ -8,7 +8,7 @@
 
 
 #ifndef lint
-static char rcsid[]= "$Header: /home/vadve/shared/PublicCVS/llvm/utils/Spiff/visual.c,v 1.1 2004/04/12 22:53:24 gaeke Exp $";
+static char rcsid[]= "$Header: /home/vadve/shared/PublicCVS/llvm/utils/Spiff/visual.c,v 1.2 2004/04/13 03:24:45 gaeke Exp $";
 #endif
 
 #ifdef MGR
@@ -396,6 +396,7 @@
 **	dummy code for systems that don't have
 **	the mgr window manager installed
 */
+int
 V_visual(d)
 int d;
 {





More information about the llvm-commits mailing list