[Snowball-discuss] Problems with -Wall flag

From: Neal Richter (nealr@rightnow.com)
Date: Tue Feb 24 2004 - 23:21:02 GMT

Hi all,

Thanks for all your work on Snowball!


The C code produced by Snowball won't compile with these flags:
"-Wall -Wmissing-prototypes -Wmissing-declarations -Werror"

(We use these as part of a coding standard enforcement)

-Wall seems to be the culprit... and -Werror compounds the issue:

I would suggest these changes:

runtime/api.c ---- Fixes undefined calloc/free
Line 1: #include <stdlib.h>

compiler/space.c ---- Fixes "int format, pointer arg" warning
Line 58: if (DEBUG) printf("<-- %d\n", (unsigned int)p);
Line 69: if (DEBUG) printf("--> %d\n", (unsigned int)p);
Line 75: if (DEBUG) printf("%d --> %d\n", (unsigned int)p, (unsigned int)q);

compiler/analyser.c --- Fixes undefined 'exit'
Line 1: #include <stdlib.h>

compiler/generator.c -- Fixes undefined strlen
Line 1: #include <string.h>

compiler/driver.c -- Fixes undefined strlen
Line 1: #include <string.h>

libstemmer/libstemmer.c -- Undefined strcmp & malloc
Line 1 #include <stdlib.h>
Line 2 #include <string.h>

examples/stemwords.c +149 -- "warning: too few arguments for format"
fprintf(stderr, "language `%s' not available for stemming\n", "english");

I also get these errors in the C code generated:

src_c/stem_english.c: In function `r_prelude':
src_c/stem_english.c:376: warning: label `lab1' defined but not used

src_c/stem_finnish.c: In function `r_case':
src_c/stem_finnish.c:448: warning: unused variable `m'

src_c/stem_french.c: In function `french_stem':
src_c/stem_french.c:951: warning: unused variable `m'

src_c/stem_porter.c: In function `porter_stem':
src_c/stem_porter.c:514: warning: label `lab1' defined but not used

A stupid fix for 'unused variable m' would be:

143 "int m = 0; m = z->l - z->c;");

It's easy enough to change these files.... just thought you might want to

Thanks for your hard work on the Snowball suite!

Neal Richter
Knowledgebase Developer
RightNow Technologies, Inc.
Customer Service for Every Web Site
Office: 406-522-1485

This archive was generated by hypermail 2.1.3 : Thu Sep 20 2007 - 12:02:46 BST