Here's a replacement for my previous patch. This one includes the
following:
Makefile target for "lint" (runs lclint with some very permissive settings)
Fixes some ignored return values
A few minor casts.
--Josh
--
Josh Wilmes ([EMAIL PROTECTED]) | http://www.hitchhiker.org
Index: Configure.pl
===================================================================
RCS file: /home/perlcvs/parrot/Configure.pl,v
retrieving revision 1.23
diff -u -r1.23 Configure.pl
--- Configure.pl 2001/10/04 20:19:38 1.23
+++ Configure.pl 2001/10/06 21:17:42
@@ -72,7 +72,8 @@
cc => $Config{cc},
#ADD C COMPILER FLAGS HERE
- ccflags => $Config{ccflags}." -I./include",
+ cc_inc => "-I./include",
+ ccflags => $Config{ccflags},
libs => $Config{libs},
cc_debug => '-g',
o => '.o', # object files extension
Index: Makefile.in
===================================================================
RCS file: /home/perlcvs/parrot/Makefile.in,v
retrieving revision 1.18
diff -u -r1.18 Makefile.in
--- Makefile.in 2001/10/06 12:41:57 1.18
+++ Makefile.in 2001/10/06 21:17:42
@@ -9,7 +9,7 @@
#DO NOT ADD C COMPILER FLAGS HERE
#Add them in Configure.pl--look for the
#comment 'ADD C COMPILER FLAGS HERE'
-CFLAGS = ${ccflags} ${cc_debug}
+CFLAGS = ${ccflags} ${cc_inc} ${cc_debug}
C_LIBS = ${libs}
@@ -19,6 +19,9 @@
TEST_PROG = test_prog${exe}
PDUMP = pdump${exe}
+LINT = lclint
+LINTFLAGS = +showscan +posixlib -weak +longintegral +matchanyintegral -formattype
+
.c$(O):
$(CC) $(CFLAGS) -o $@ -c $<
@@ -86,3 +89,9 @@
update:
cvs -q update -dP
+
+lint: test_prog pdump
+ $(LINT) ${cc_inc} $(LINTFLAGS) `echo $(O_FILES) | sed 's/\.o/\.c/g'`
+ $(LINT) ${cc_inc} $(LINTFLAGS) test_main.c
+ $(LINT) ${cc_inc} $(LINTFLAGS) pdump.c
+
Index: basic_opcodes.ops
===================================================================
RCS file: /home/perlcvs/parrot/basic_opcodes.ops,v
retrieving revision 1.32
diff -u -r1.32 basic_opcodes.ops
--- basic_opcodes.ops 2001/10/06 00:57:43 1.32
+++ basic_opcodes.ops 2001/10/06 21:17:43
@@ -140,7 +140,7 @@
/* TIME Ix */
AUTO_OP time_i {
- INT_REG(P1) = time(NULL);
+ INT_REG(P1) = (INTVAL)time(NULL);
}
/* PRINT Ix */
@@ -316,7 +316,7 @@
/* TIME Nx */
AUTO_OP time_n {
- NUM_REG(P1) = time(NULL);
+ NUM_REG(P1) = (FLOATVAL)time(NULL);
}
/* PRINT Nx */
Index: interpreter.c
===================================================================
RCS file: /home/perlcvs/parrot/interpreter.c,v
retrieving revision 1.23
diff -u -r1.23 interpreter.c
--- interpreter.c 2001/10/03 16:21:30 1.23
+++ interpreter.c 2001/10/06 21:17:44
@@ -235,6 +235,8 @@
/* The default opcode function table would be a good thing here... */
{
+ /*@-castfcnptr@*/
+
opcode_t *(**foo)();
foo = mem_sys_allocate(2048 * sizeof(void *));
Index: packfile.c
===================================================================
RCS file: /home/perlcvs/parrot/packfile.c,v
retrieving revision 1.10
diff -u -r1.10 packfile.c
--- packfile.c 2001/10/06 00:57:43 1.10
+++ packfile.c 2001/10/06 21:17:47
@@ -1306,27 +1306,28 @@
#if TRACE_PACKFILE
printf("PackFile_Constant_unpack(): Unpacking no-type constant...\n");
#endif
+ return 1;
break;
case PFC_INTEGER:
#if TRACE_PACKFILE
printf("PackFile_Constant_unpack(): Unpacking integer constant...\n");
#endif
- PackFile_Constant_unpack_integer(self, cursor, size);
+ return(PackFile_Constant_unpack_integer(self, cursor, size));
break;
case PFC_NUMBER:
#if TRACE_PACKFILE
printf("PackFile_Constant_unpack(): Unpacking number constant...\n");
#endif
- PackFile_Constant_unpack_number(self, cursor, size);
+ return(PackFile_Constant_unpack_number(self, cursor, size));
break;
case PFC_STRING:
#if TRACE_PACKFILE
printf("PackFile_Constant_unpack(): Unpacking string constant...\n");
#endif
- PackFile_Constant_unpack_string(self, cursor, size);
+ return(PackFile_Constant_unpack_string(self, cursor, size));
break;
default:
@@ -1335,7 +1336,7 @@
break;
}
- return 1;
+ /*NOTREACHED*/
}
Index: pdump.c
===================================================================
RCS file: /home/perlcvs/parrot/pdump.c,v
retrieving revision 1.3
diff -u -r1.3 pdump.c
--- pdump.c 2001/09/30 20:25:22 1.3
+++ pdump.c 2001/10/06 21:17:47
@@ -60,7 +60,10 @@
pf = PackFile_new();
- PackFile_unpack(pf, packed, packed_size);
+ if (!PackFile_unpack(pf, packed, packed_size)) {
+ printf( "Can't unpack.\n" );
+ return 1;
+ }
PackFile_dump(pf);
PackFile_DELETE(pf);
Index: register.c
===================================================================
RCS file: /home/perlcvs/parrot/register.c,v
retrieving revision 1.10
diff -u -r1.10 register.c
--- register.c 2001/10/02 14:01:30 1.10
+++ register.c 2001/10/06 21:17:48
@@ -209,7 +209,7 @@
Parrot_clear_n(struct Parrot_Interp *interpreter) {
int i;
for (i=0; i<NUM_REGISTERS; i++) {
- interpreter->num_reg->registers[i] = 0;
+ interpreter->num_reg->registers[i] = 0.0;
}
}
Index: stacks.c
===================================================================
RCS file: /home/perlcvs/parrot/stacks.c,v
retrieving revision 1.1
diff -u -r1.1 stacks.c
--- stacks.c 2001/09/20 02:52:10 1.1
+++ stacks.c 2001/10/06 21:17:48
@@ -10,7 +10,7 @@
* References:
*/
-struct Stack_Entry *push_generic_entry(
+struct Stack_Entry *push_generic_entry;
/*
* Local variables:
Index: string.c
===================================================================
RCS file: /home/perlcvs/parrot/string.c,v
retrieving revision 1.11
diff -u -r1.11 string.c
--- string.c 2001/10/03 15:58:54 1.11
+++ string.c 2001/10/06 21:17:48
@@ -34,7 +34,7 @@
s->encoding = &(Parrot_string_vtable[encoding]);
s->buflen = s->bufused = buflen;
s->flags = flags;
- string_compute_strlen(s);
+ (void)string_compute_strlen(s);
s->type = type;
return s;
}
Index: test_main.c
===================================================================
RCS file: /home/perlcvs/parrot/test_main.c,v
retrieving revision 1.14
diff -u -r1.14 test_main.c
--- test_main.c 2001/10/06 00:57:43 1.14
+++ test_main.c 2001/10/06 21:17:49
@@ -47,16 +47,16 @@
time_t foo;
printf("String %p has length %i: %.*s\n", s, (int) string_length(s), (int) string_length(s), (char *) s->bufstart);
- string_concat(s, t, 0);
+ (void)string_concat(s, t, 0);
printf("String %p has length %i: %.*s\n", s, (int) string_length(s), (int) string_length(s), (char *) s->bufstart);
- string_chopn(s, 4);
+ (void)string_chopn(s, 4);
printf("String %p has length %i: %.*s\n", s, (int) string_length(s), (int) string_length(s), (char *) s->bufstart);
- string_chopn(s, 4);
+ (void)string_chopn(s, 4);
printf("String %p has length %i: %.*s\n", s, (int) string_length(s), (int) string_length(s), (char *) s->bufstart);
foo = time(0);
for (i = 0; i < 100000000; i++) {
- string_concat(s, t, 0);
- string_chopn(s, 4);
+ (void)string_concat(s, t, 0);
+ (void)string_chopn(s, 4);
}
printf("10000000 concats and chops took %li seconds.\n", time(0)-foo);
string_destroy(s);