Resolve many build warnings

This patch fixes many warnings from the beginning of the build up to
and including the depend stage. Nearly all warnings should be gone
even with -Wall.
This commit is contained in:
Ulrich Wilkens
2014-09-23 23:16:35 +02:00
committed by Jon Trulson
parent 2bf29e5d63
commit 42e891d9e7
125 changed files with 1926 additions and 1440 deletions

View File

@@ -41,7 +41,7 @@ This product and information is proprietary of Tandem Computers Incorporated.
#include "entdef.h"
/* Main procedure */
void main(argc, argv)
int main(argc, argv)
int argc ;
char **argv ;
{
@@ -67,8 +67,9 @@ while (TRUE)
if (scantrace)
printf(
"m_prevcon=%d, m_token=%d, curcon=%d, scanval = %c (%d), line=%d\n",
m_prevcon, m_token, curcon, scanval, scanval, m_line) ;
m_prevcon, m_token, curcon, (char)scanval, (int)scanval, m_line) ;
#include "case.c"
if (m_token == ENDFILE) exit(FALSE) ;
}
return 0;
}

View File

@@ -43,7 +43,7 @@ LOGICAL *flag;
char *delim;
{
M_WCHAR wcbuff[129];
size_t length;
ssize_t length;
wcbuff[128] = 0;
length = mbstowcs(wcbuff,delim,128);
@@ -73,7 +73,7 @@ m_openchk(&m_errfile, "error", "w") ;
fprintf(stderr, "MARKUP System - BUILD %s\n", M_VERSION) ;
fprintf(stderr, "Copyright (c) 1986, 1987, 1988, 1989 Hewlett-Packard Co.\n") ;
if (! standard)
warning("Warning: optional enhancements of SGML enabled.") ;
warning("Info: optional enhancements of SGML enabled.") ;
mb_delims = mb_dlmptr;
wc_delims = m_dlmptr;
@@ -112,7 +112,7 @@ void ruleinit(M_NOPAR)
/* Rule end processing */
void rulend(M_NOPAR)
{
STATE *fsa ;
STATE *fsa = NULL ;
LOGICAL canbenull ;
LHS *lhsp ;
LHS *discard ;
@@ -153,7 +153,7 @@ void rulend(M_NOPAR)
void skiptoend(M_NOPAR)
{
int i ;
static errlev = 0 ;
static int errlev = 0 ;
if (! errlev++) {
curcon = ERROR ;

View File

@@ -42,7 +42,7 @@ ELTSTRUCT *ntrelt(p)
int length ;
new = (ELTSTRUCT *) m_malloc(sizeof(ELTSTRUCT), "element structure") ;
if (old = (ELTSTRUCT *) m_ntrtrie(p, &eltree, (M_TRIE *) new)) {
if ((old = (ELTSTRUCT *) m_ntrtrie(p, &eltree, (M_TRIE *) new))) {
m_free((M_POINTER) new, "element structure") ;
return(old) ;
}
@@ -55,7 +55,7 @@ ELTSTRUCT *ntrelt(p)
w_strcpy(new->enptr, p) ;
new->model = M_NULLVAL ;
new->content = M_NULLVAL ;
new->inptr = new->exptr = NULL ;
new->inptr = new->exptr = 0 ;
new->parptr = NULL ;
new->parindex = M_NULLVAL ;
new->paramcount = M_NULLVAL ;

View File

@@ -85,11 +85,11 @@ void checkand(andstart, andptr, start, root, errelt)
for (pand = parc->group ; pand ; pand = pand->next)
checkand(andstart, andptr, pand->start, root, errelt) ;
}
else if (c = checkdfsa(andptr->start,
else if ((c = checkdfsa(andptr->start,
parc->label,
parc->group,
parc->id,
errelt))
errelt)))
nondeterm(root, c, *errelt) ;
}
}
@@ -112,7 +112,7 @@ int checkdfsa(from, label, and, id, errelt)
if (parc->group) {
if (and == parc->group) return(ANDCONFLICT) ;
for (group = parc->group ; group ; group = group->next)
if (c = checkdfsa(group->start, label, and, id, errelt))
if ((c = checkdfsa(group->start, label, and, id, errelt)))
return(c) ;
}
else if (! and && label == parc->label && parc->id != id) {
@@ -138,14 +138,14 @@ int checkrepeat(from, and, errelt)
for (; and ; and = and->next)
for (parc = and->start->first ; parc ; parc = parc->next) {
if (parc->group)
if (c = checkrepeat(from, parc->group, errelt)) return(c) ;
if ((c = checkrepeat(from, parc->group, errelt))) return(c) ;
else ;
else
if (c = checkdfsa(from,
if ((c = checkdfsa(from,
parc->label,
M_NULLVAL,
parc->id,
errelt))
errelt)))
return(c) ;
else ;
}
@@ -239,7 +239,7 @@ void makeand(canbenull, root, optional)
TREE *child ;
STATELIST *start, *final ;
LOGICAL groupbenull ;
ANDGROUP *andptr, *saveand, *otherand ;
ANDGROUP *andptr = NULL, *saveand = NULL, *otherand ;
STATELIST *index ;
ELTSTRUCT *errelt ;
@@ -579,7 +579,7 @@ void repeat(root)
for (a = top->starta ; a ; a = a->next) {
for (final = top->allfinal ; final ; final = final->next) {
if (a->group)
if (c = checkrepeat(final->value, a->group, &errelt)) {
if ((c = checkrepeat(final->value, a->group, &errelt))) {
wtemp = MakeWideCharString(root->occurrence == PLUS ? plus : rep);
warning1("Conflict in use of %s", wtemp);
m_free(wtemp, "wide character string");
@@ -588,11 +588,11 @@ void repeat(root)
else
;
else
if (c = checkdfsa(final->value,
if ((c = checkdfsa(final->value,
a->label,
a->group,
a->id,
&errelt))
&errelt)))
nondeterm (root, c, errelt) ;
else
;
@@ -600,14 +600,14 @@ void repeat(root)
for (final = top->finals ; final ; final = final->next) {
if (samelabelarc(a, final->value)) continue ;
if (a->group)
if (c = checkrepeat(final->value, a->group, &errelt))
if ((c = checkrepeat(final->value, a->group, &errelt)))
nondeterm(root, c, errelt) ;
if (a->label ||
a->group ||
! final->value->frompcdata) {
if (c = addarc(final->value, a->to, a->label,
if ((c = addarc(final->value, a->to, a->label,
a->group, TRUE, a->id,
a->minim, &errelt))
a->minim, &errelt)))
nondeterm(root, c, errelt) ;
if (permitspcd(a)) final->value->datacontent = TRUE ;
}
@@ -697,7 +697,7 @@ void simplebranch(root, value, group, optional)
states of and-groups that terminate at the start state of the new
arc */
for (index = top->allfinal ; index ; index = index->next)
if (c = checkdfsa(index->value, value, group, root->eltid, &errelt))
if ((c = checkdfsa(index->value, value, group, root->eltid, &errelt)))
nondeterm(root, c, errelt) ;
for (index = top->starts ; index ; index = index->next) {
if (! group && ! value && index->value->frompcdata)

View File

@@ -31,6 +31,7 @@ This product and information is proprietary of Tandem Computers Incorporated.
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#if defined(MSDOS)
#include <process.h>
#endif
@@ -195,7 +196,7 @@ void eltreeout(M_NOPAR)
if (first) first = FALSE ;
else fputs(",\n", dtd) ;
for (p = eltp->enptr ; *p ; p++)
fprintf(dtd, " %d,\n", *p) ;
fprintf(dtd, " %d,\n", (int)*p) ;
fputs(" 0", dtd) ;
}
fputs(ndif, dtd) ;
@@ -211,14 +212,14 @@ void eltreeout(M_NOPAR)
else fputs(",\n", dtd) ;
if (! eltp->content)
warning1("No content model for element %s", eltp->enptr) ;
fprintf(dtd, " %d, %d, %s, ",
fprintf(dtd, " {%d, %d, %s, ",
enameindex, eltp->model ? eltp->model->count : 0,
typecon(eltp->content)) ;
fprintf(dtd, "%d, %d, ", eltp->inptr, eltp->exptr) ;
fprintf(dtd, "%d, %d, %d",
eltp->parindex, eltp->paramcount, eltp->srefptr) ;
enameindex += w_strlen(eltp->enptr) + 1 ;
fprintf(dtd, ", %s, %s, %s",
fprintf(dtd, ", %s, %s, %s}",
boolean(eltp->stmin), boolean(eltp->etmin), boolean(eltp->useoradd)) ;
}
fputs(ndif, dtd) ;
@@ -259,7 +260,7 @@ void exout(M_NOPAR)
if (! first) fputs(",\n", dtd) ;
first = FALSE ;
exindex++ ;
fprintf(dtd, " %d, %d", ex->element, ex->next ? exindex + 1 : 0) ;
fprintf(dtd, " {%d, %d}", ex->element, ex->next ? exindex + 1 : 0) ;
}
fputs(ndif, dtd) ;
}
@@ -294,7 +295,7 @@ void fsa(M_NOPAR)
for (pstate = firststate ; pstate ; pstate = pstate->next) {
if (first) first = FALSE ;
else fputs(",\n", dtd) ;
fprintf(dtd, " %s, %s, %d",
fprintf(dtd, " {%s, %s, %d}",
boolean(pstate->final), boolean(pstate->datacontent),
pstate->first ? ++arcount : 0) ;
for (parc = pstate->first ; parc ; parc = parc->next) {
@@ -319,7 +320,7 @@ void fsa(M_NOPAR)
for (pand = firstand ; pand ; pand = pand->nextptr) {
if (first) first = FALSE ;
else fputs(",\n", dtd) ;
fprintf(dtd, " %d, %d",
fprintf(dtd, " {%d, %d}",
pand->start->count,
pand->next ? pand->next->count : M_NULLVAL) ;
}
@@ -352,7 +353,7 @@ if (kwlen)
if (first) first = FALSE ;
else fputs(",\n", dtd) ;
for (p = ptypep->keyword ; *p ; p++)
fprintf(dtd, " %d,\n", *p) ;
fprintf(dtd, " %d,\n", (int)*p) ;
fputs(" 0", dtd) ;
}
fputs(ndif, dtd) ;
@@ -372,7 +373,7 @@ if (deflen)
if (first) first = FALSE ;
else fputs(",\n", dtd) ;
for (p = paramp->defstring ; *p ; p++)
fprintf(dtd, " %d,\n", *p) ;
fprintf(dtd, " %d,\n", (int)*p) ;
fputs(" 0", dtd) ;
}
fputs(ndif, dtd) ;
@@ -392,7 +393,7 @@ if (ptypelen)
{
if (first) first = FALSE ;
else fprintf(dtd, ",\n") ;
fprintf(dtd, " %d, %d", kw, ptypep->next) ;
fprintf(dtd, " {%d, %d}", kw, ptypep->next) ;
kw += w_strlen(ptypep->keyword) + 1 ;
}
fputs(ndif, dtd) ;
@@ -412,21 +413,21 @@ if (parcount)
if (first) first = FALSE ;
else fputs(",\n", dtd) ;
fprintf(dtd,
" %d, %s, %d, %s, ",
" {%d, %s, %d, %s, ",
pnameindex,
partype(paramp->type),
paramp->kwlist,
deftype(paramp->deftype) );
pnameindex += w_strlen(paramp->paramname) + 1 ;
if (paramp->defval)
fprintf(dtd, "&m_keyword[%d]", paramp->defval - 1) ;
fprintf(dtd, "&m_keyword[%d]}", paramp->defval - 1) ;
else if (paramp->defstring)
{
fprintf(dtd, "&m_defval[%d]", defindex) ;
fprintf(dtd, "&m_defval[%d]}", defindex) ;
defindex += w_strlen(paramp->defstring) + 1 ;
}
else
fputs("NULL", dtd) ;
fputs("NULL}", dtd) ;
}
fputs(ndif, dtd) ;
}
@@ -443,7 +444,7 @@ if (pnamelen)
{
if (first) first = FALSE ;
else fputs(",\n", dtd) ;
for (p = paramp->paramname ; *p ; p++) fprintf(dtd, " %d,\n", *p) ;
for (p = paramp->paramname ; *p ; p++) fprintf(dtd, " %d,\n", (int)*p);
fputs(" 0", dtd) ;
}
fputs(ndif, dtd) ;
@@ -534,10 +535,10 @@ void srefout(M_NOPAR)
count++ ;
if (first) first = FALSE ;
else fputs(",\n", dtd) ;
fprintf(dtd, " %d, %d, ", j + 1, mapbysref[sreflen * i + j]) ;
fprintf(dtd, " {%d, %d, ", j + 1, mapbysref[sreflen * i + j]) ;
for (j++ ; j < sreflen ; j++)
if (mapbysref[sreflen * i + j]) break ;
fprintf(dtd, "%d", j < sreflen ? count + 1 : 0) ;
fprintf(dtd, "%d}", j < sreflen ? count + 1 : 0) ;
}
else j++ ;
fputs(ndif, dtd) ;
@@ -573,7 +574,8 @@ if (eltp->parptr)
{
int length;
char mbyte[32]; /* larger than any multibyte character */
char *pc, c;
char *pc;
unsigned char c;
length = wctomb(mbyte, *p);
if (length < 0)
@@ -645,7 +647,7 @@ void template(M_NOPAR)
}
mb_name = MakeMByteString(ent->name);
fprintf(tempfile, "<!ENTITY %s %s \"\">\n", mb_name, ent->type) ;
fprintf(tempfile, "<!ENTITY %s %d \"\">\n", mb_name, ent->type);
m_free(mb_name, "wide character ent->name");
}
}

View File

@@ -89,7 +89,7 @@ ptypelen++ ;
/* Add a parameter to the current element */
void addpar(M_NOPAR)
{
PARAMETER *paramp, *last ;
PARAMETER *paramp, *last = NULL ;
int length ;
parcount++ ;
@@ -200,6 +200,7 @@ switch (newpar->type)
}
break ;
}
return(FALSE);
}
/* Normalize parameter default. Change tabs and RE's to spaces, capitalize
@@ -212,7 +213,7 @@ M_WCHAR *string ;
#endif /* M_PROTO */
{
M_WCHAR *p, *q ;
int i ;
int i, ret ;
switch (newpar->type)
{
@@ -238,7 +239,7 @@ switch (newpar->type)
for (p = string, i = 0 ; *p ; p++, i++)
if (m_whitespace(*p))
{
mbtowc(p, " ", 1);
ret = mbtowc(p, " ", 1);
for (q = p + 1 ; m_whitespace(*q); q++) ;
w_strcpy(p + 1, q) ;
}
@@ -262,10 +263,13 @@ switch (newpar->type)
mbyte[1] = 0;
}
if ((length == 1) && (*mbyte == '\n' || *mbyte == '\t'))
mbtowc(string, " ", 1);
{
ret = mbtowc(string, " ", 1);
}
}
return ;
}
(void) ret;
}
/* Called at end of parameter attribute list rule */

View File

@@ -330,7 +330,7 @@ LOGICAL litproc(
#endif
) ;
void main(
int main(
#if defined(M_PROTO)
int argc, char **argv
#endif

View File

@@ -80,9 +80,10 @@ int c;
int n;
M_WCHAR wsp, wnl, wtb;
mbtowc(&wsp, " ", 1);
mbtowc(&wnl, "\n", 1);
mbtowc(&wtb, "\t", 1);
int
ret = mbtowc(&wsp, " ", 1);
ret = mbtowc(&wnl, "\n", 1);
ret = mbtowc(&wtb, "\t", 1);
while (TRUE)
{
@@ -158,13 +159,14 @@ while (TRUE)
{
char mbyte[32]; /* bigger than the biggest multibyte char */
wctomb(mbyte, c);
ret = wctomb(mbyte, c);
fprintf(stderr, "\n'%s' (%d)", mbyte, c);
fprintf(m_errfile, "\n'%s' (%d)", mbyte, c);
m_error("Unexpected character");
}
} /* End while */
(void) ret;
} /* End scan */
#include "scanutil.c"

View File

@@ -40,7 +40,7 @@ void adddefent(mapname)
M_WCHAR *mapname;
{
M_WCHAR *p;
int n, length;
int n;
char c;
if (!wc_prefix)
@@ -59,8 +59,9 @@ for (n = egensuf ; n ; n /= 10)
return;
}
c = ('0' + (n % 10));
mbtowc(p, &c, 1);
*p++;
int ret = mbtowc(p, &c, 1);
(void) ret;
p++;
}
*p = M_EOS;
egensuf++;
@@ -80,7 +81,7 @@ M_WCHAR *name;
M_ENTITY *new;
new = (M_ENTITY *) m_malloc(sizeof(M_ENTITY), "entity");
if (entity = (M_ENTITY *) m_ntrtrie(name, m_enttrie, (M_TRIE *) new))
if ((entity = (M_ENTITY *) m_ntrtrie(name, m_enttrie, (M_TRIE *) new)))
{
m_free((M_POINTER) new, "entity");
return(FALSE);
@@ -113,7 +114,7 @@ MAP *new;
LOGICAL retval;
new = (MAP *) m_malloc(sizeof(MAP), "map");
if (old = (MAP *) m_ntrtrie(p, &maptree, (M_TRIE *) new))
if ((old = (MAP *) m_ntrtrie(p, &maptree, (M_TRIE *) new)))
{
m_free(new, "map");
curmap = old->map;
@@ -153,7 +154,7 @@ int noseq = 0;
/* Define the delimiter */
delim = (SREFSTRUCT *)
m_malloc(sizeof(SREFSTRUCT), "short reference delimiter");
if (prevsr = (SREFSTRUCT *) m_ntrtrie(p, &sreftree, (M_TRIE *) delim))
if ((prevsr = (SREFSTRUCT *) m_ntrtrie(p, &sreftree, (M_TRIE *) delim)))
{
m_free(delim, "short reference delimiter");
delim = prevsr;