Just to be on the safe side about avoiding other portability hazards
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Sun, 13 Nov 2005 13:07:52 +0000 (13:07 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Sun, 13 Nov 2005 13:07:52 +0000 (13:07 +0000)
in future, add `-ansi -pedantic' to the Halibut default compile
options and fix the few resulting warnings (mostly signed/unsigned
char mismatches and commas at the ends of enums). The one remaining
warning I'm still seeing is `missing initializer' for the big table
in charset/iso2022.c, but I think the code genuinely is more
readable this way, and I haven't found a gcc option to disable that
specific warning.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@6458 cda61777-01e9-0310-a592-d414129be87e

Makefile
halibut.h
input.c
winhelp.c

index ffbe88b..d57cb3c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -71,7 +71,7 @@ else
 
 # The `real' makefile part.
 
-CFLAGS += -Wall -W
+CFLAGS += -Wall -W -ansi -pedantic
 
 ifdef TEST
 CFLAGS += -DLOGALLOC
index 26c82f6..05b914f 100644 (file)
--- a/halibut.h
+++ b/halibut.h
@@ -177,13 +177,13 @@ enum {
     attr_First  = 0x0001,             /* the first of a series */
     attr_Last   = 0x0002,             /* the last of a series */
     attr_Always        = 0x0003,              /* any other part of a series */
-    attr_mask   = 0x0003,
+    attr_mask   = 0x0003
 };
 /* aux values for quote-type words */
 enum {
     quote_Open  = 0x0010,
     quote_Close = 0x0020,
-    quote_mask  = 0x0030,
+    quote_mask  = 0x0030
 };
 #define isattr(x) ( ( (x) > word_Normal && (x) < word_WhiteSpace ) || \
                     ( (x) > word_WhiteSpace && (x) < word_internal_endattrs ) )
diff --git a/input.c b/input.c
index 1e132b4..dc44675 100644 (file)
--- a/input.c
+++ b/input.c
@@ -610,7 +610,7 @@ static void read_file(paragraph ***ret, input *in, indexdata *idx,
            stack_style = 2,           /* \e, \c, \cw */
            stack_idx = 4,             /* \I, \i, \ii */
            stack_hyper = 8,           /* \W */
-           stack_quote = 16,          /* \q */
+           stack_quote = 16           /* \q */
        } type;
        word **whptr;                  /* to restore from \u alternatives */
        word **idximplicit;            /* to restore from \u alternatives */
index 9bf1bd0..7db4801 100644 (file)
--- a/winhelp.c
+++ b/winhelp.c
@@ -580,7 +580,7 @@ void whlp_browse_link(WHLP h, WHLP_TOPIC before, WHLP_TOPIC after)
 static void whlp_linkdata(WHLP h, int which, int c)
 {
     int *len = (which == 1 ? &h->link->len1 : &h->link->len2);
-    char *data = (which == 1 ? h->linkdata1 : h->linkdata2);
+    unsigned char *data = (which == 1 ? h->linkdata1 : h->linkdata2);
     assert(*len < TOPIC_BLKSIZE);
     data[(*len)++] = c;
 }
@@ -1275,7 +1275,7 @@ static void whlp_make_btree(struct file *f, int flags, int pagesize,
     int npages = 0, pagessize = 0;
     int npages_this_level, nentries, nlevels;
     int total_leaf_entries;
-    char btdata[MAX_PAGE_SIZE];
+    unsigned char btdata[MAX_PAGE_SIZE];
     int btlen;
     int page_start, fixups_offset, unused_bytes;
     void *element;