lib: fixes for warnings that clang has for libraries.

This commit is contained in:
Ben Gras 2010-07-06 12:08:22 +00:00
parent f6f814cb02
commit 68db8ed0b9
36 changed files with 65 additions and 45 deletions

View file

@ -181,7 +181,7 @@ parseRule(register char *buf, register const char *p)
if (*p == '/') { if (*p == '/') {
q = ++p; q = ++p;
if (!(p = parseTime(&time, p, &dstend))) return NULL; if (!(p = parseTime(&time, p, &dstend))) return NULL;
while(*buf++ = *q++); while((*buf++ = *q++));
} }
if (*p) return NULL; if (*p) return NULL;
return p; return p;

View file

@ -15,7 +15,7 @@ sighandler_t disp; /* signal handler, or SIG_DFL, or SIG_IGN */
errno = EINVAL; errno = EINVAL;
return(SIG_ERR); return(SIG_ERR);
} }
sigemptyset(&sa.sa_mask); (void) sigemptyset(&sa.sa_mask);
#ifdef WANT_UNRELIABLE_SIGNALS #ifdef WANT_UNRELIABLE_SIGNALS
/* Allow the signal being handled to interrupt the signal handler. */ /* Allow the signal being handled to interrupt the signal handler. */

View file

@ -47,7 +47,7 @@ getnetbyaddr(net, type)
register struct netent *p; register struct netent *p;
setnetent(_net_stayopen); setnetent(_net_stayopen);
while (p = getnetent()) while ((p = getnetent()))
if (p->n_addrtype == type && p->n_net == net) if (p->n_addrtype == type && p->n_net == net)
break; break;
if (!_net_stayopen) if (!_net_stayopen)

View file

@ -48,7 +48,7 @@ getnetbyname(name)
register char **cp; register char **cp;
setnetent(_net_stayopen); setnetent(_net_stayopen);
while (p = getnetent()) { while ((p = getnetent())) {
if (strcmp(p->n_name, name) == 0) if (strcmp(p->n_name, name) == 0)
break; break;
for (cp = p->n_aliases; *cp != 0; cp++) for (cp = p->n_aliases; *cp != 0; cp++)

View file

@ -37,7 +37,7 @@ getprotobynumber(proto)
register struct protoent *p; register struct protoent *p;
setprotoent(_proto_stayopen); setprotoent(_proto_stayopen);
while (p = getprotoent()) while ((p = getprotoent()))
if (p->p_proto == proto) if (p->p_proto == proto)
break; break;
if (!_proto_stayopen) if (!_proto_stayopen)

View file

@ -114,7 +114,7 @@ any(cp, match)
{ {
register char *mp, c; register char *mp, c;
while (c = *cp) { while ((c = *cp)) {
for (mp = match; *mp; mp++) for (mp = match; *mp; mp++)
if (*mp == c) if (*mp == c)
return (cp); return (cp);

View file

@ -115,7 +115,7 @@ any(cp, match)
{ {
register char *mp, c; register char *mp, c;
while (c = *cp) { while ((c = *cp)) {
for (mp = match; *mp; mp++) for (mp = match; *mp; mp++)
if (*mp == c) if (*mp == c)
return (cp); return (cp);

View file

@ -35,7 +35,7 @@ getservbyname(name, proto)
register char **cp; register char **cp;
setservent(_serv_stayopen); setservent(_serv_stayopen);
while (p = getservent()) { while ((p = getservent())) {
if (strcmp(name, p->s_name) == 0) if (strcmp(name, p->s_name) == 0)
goto gotname; goto gotname;
for (cp = p->s_aliases; *cp; cp++) for (cp = p->s_aliases; *cp; cp++)

View file

@ -38,7 +38,7 @@ getservbyport(port, proto)
register struct servent *p; register struct servent *p;
setservent(_serv_stayopen); setservent(_serv_stayopen);
while (p = getservent()) { while ((p = getservent())) {
if (p->s_port != port) if (p->s_port != port)
continue; continue;
if (proto == 0 || strcmp(p->s_proto, proto) == 0) if (proto == 0 || strcmp(p->s_proto, proto) == 0)

View file

@ -62,7 +62,7 @@ again:
base = 8, cp++; base = 8, cp++;
if (*cp == 'x' || *cp == 'X') if (*cp == 'x' || *cp == 'X')
base = 16, cp++; base = 16, cp++;
while (c = *cp) { while ((c = *cp)) {
if (isdigit(c)) { if (isdigit(c)) {
val = (val * base) + (c - '0'); val = (val * base) + (c - '0');
cp++; cp++;

View file

@ -58,6 +58,7 @@ static int dn_find();
* 'exp_dn' is a pointer to a buffer of size 'length' for the result. * 'exp_dn' is a pointer to a buffer of size 'length' for the result.
* Return size of compressed name or -1 if there was an error. * Return size of compressed name or -1 if there was an error.
*/ */
int
dn_expand(msg, eomorig, comp_dn, exp_dn, length) dn_expand(msg, eomorig, comp_dn, exp_dn, length)
CONST u_char *msg, *eomorig, *comp_dn; CONST u_char *msg, *eomorig, *comp_dn;
u_char *exp_dn; u_char *exp_dn;
@ -75,7 +76,7 @@ dn_expand(msg, eomorig, comp_dn, exp_dn, length)
/* /*
* fetch next label in domain name * fetch next label in domain name
*/ */
while (n = *cp++) { while ((n = *cp++)) {
/* /*
* Check for indirection * Check for indirection
*/ */
@ -220,6 +221,7 @@ dn_comp(exp_dn, comp_dn, length, dnptrs, lastdnptr)
/* /*
* Skip over a compressed domain name. Return the size or -1. * Skip over a compressed domain name. Return the size or -1.
*/ */
int
dn_skipname(comp_dn, eom) dn_skipname(comp_dn, eom)
CONST u_char *comp_dn, *eom; CONST u_char *comp_dn, *eom;
{ {
@ -264,7 +266,7 @@ dn_find(exp_dn, msg, dnptrs, lastdnptr)
for (cpp = dnptrs; cpp < lastdnptr; cpp++) { for (cpp = dnptrs; cpp < lastdnptr; cpp++) {
dn = exp_dn; dn = exp_dn;
sp = cp = *cpp; sp = cp = *cpp;
while (n = *cp++) { while ((n = *cp++)) {
/* /*
* check for indirection * check for indirection
*/ */

View file

@ -55,6 +55,7 @@ static char sccsid[] = "@(#)res_mkquery.c 6.12 (Berkeley) 6/1/90";
* Form all types of queries. * Form all types of queries.
* Returns the size of the result or -1. * Returns the size of the result or -1.
*/ */
int
res_mkquery(op, dname, class, type, data, datalen, newrr, buf, buflen) res_mkquery(op, dname, class, type, data, datalen, newrr, buf, buflen)
int op; /* opcode of query */ int op; /* opcode of query */
_CONST char *dname; /* domain name */ _CONST char *dname; /* domain name */

View file

@ -154,6 +154,7 @@ res_query(name, class, type, answer, anslen)
* Only useful for queries in the same name hierarchy as the local host * Only useful for queries in the same name hierarchy as the local host
* (not, for example, for host address-to-name lookups in domain in-addr.arpa). * (not, for example, for host address-to-name lookups in domain in-addr.arpa).
*/ */
int
res_search(name, class, type, answer, anslen) res_search(name, class, type, answer, anslen)
char *name; /* domain name */ char *name; /* domain name */
int class, type; /* class and type of query */ int class, type; /* class and type of query */

View file

@ -105,6 +105,7 @@ static struct sockaddr no_addr;
#endif /* FD_SET */ #endif /* FD_SET */
#endif /* _MINIX */ #endif /* _MINIX */
int
res_send(buf, buflen, answer, anslen) res_send(buf, buflen, answer, anslen)
const char *buf; const char *buf;
int buflen; int buflen;

View file

@ -61,18 +61,18 @@ static int match(const char *word, const char *pattern)
#define lc(c, d) ((((c)= (d)) - 'A') <= ('Z' - 'A') ? (c)+= ('a' - 'A') : 0) #define lc(c, d) ((((c)= (d)) - 'A') <= ('Z' - 'A') ? (c)+= ('a' - 'A') : 0)
for (;;) { for (;;) {
lc(cw, *word); (void) lc(cw, *word);
lc(cp, *pattern); (void) lc(cp, *pattern);
if (cp == '*') { if (cp == '*') {
do pattern++; while (*pattern == '*'); do pattern++; while (*pattern == '*');
lc(cp, *pattern); (void) lc(cp, *pattern);
if (cp == 0) return 1; if (cp == 0) return 1;
while (cw != 0) { while (cw != 0) {
if (cw == cp && match(word+1, pattern+1)) return 1; if (cw == cp && match(word+1, pattern+1)) return 1;
word++; word++;
lc(cw, *word); (void) lc(cw, *word);
} }
return 0; return 0;
} else } else

View file

@ -96,18 +96,18 @@ static int match(const char *word, const char *pattern)
#define lc(c, d) ((((c)= (d)) - 'A') <= ('Z' - 'A') ? (c)+= ('a' - 'A') : 0) #define lc(c, d) ((((c)= (d)) - 'A') <= ('Z' - 'A') ? (c)+= ('a' - 'A') : 0)
for (;;) { for (;;) {
lc(cw, *word); (void) lc(cw, *word);
lc(cp, *pattern); (void) lc(cp, *pattern);
if (cp == '*') { if (cp == '*') {
do pattern++; while (*pattern == '*'); do pattern++; while (*pattern == '*');
lc(cp, *pattern); (void) lc(cp, *pattern);
if (cp == 0) return 1; if (cp == 0) return 1;
while (cw != 0) { while (cw != 0) {
if (cw == cp && match(word+1, pattern+1)) return 1; if (cw == cp && match(word+1, pattern+1)) return 1;
word++; word++;
lc(cw, *word); (void) lc(cw, *word);
} }
return 0; return 0;
} else } else

View file

@ -15,6 +15,7 @@
#include <minix/type.h> #include <minix/type.h>
#include <minix/const.h> #include <minix/const.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <machine/archtypes.h> #include <machine/archtypes.h>
#include "../../../kernel/proc.h" #include "../../../kernel/proc.h"

View file

@ -65,7 +65,7 @@ int mountflags;
sprintf(label, "fs_%.12s", p); sprintf(label, "fs_%.12s", p);
} else { } else {
if (stat(name, &statbuf) < 0) return -1; if (stat(name, &statbuf) < 0) return -1;
sprintf(label, "fs_%04x%x", statbuf.st_dev, statbuf.st_ino); sprintf(label, "fs_%04x%lx", statbuf.st_dev, statbuf.st_ino);
} }
/* Tell VFS that we are passing in a 16-byte label. */ /* Tell VFS that we are passing in a 16-byte label. */

View file

@ -12,7 +12,6 @@ struct complex {
}; };
_PROTOTYPE(double hypot, (double x, double y )); _PROTOTYPE(double hypot, (double x, double y ));
_PROTOTYPE(double cabs, (struct complex p_compl ));
/* $Header$ */ /* $Header$ */
@ -34,9 +33,14 @@ hypot(double x, double y)
return y*sqrt(x*x+1.0); return y*sqrt(x*x+1.0);
} }
#if 0
_PROTOTYPE(double cabs, (struct complex p_compl ));
double double
cabs(p_compl) cabs(p_compl)
struct complex p_compl; struct complex p_compl;
{ {
return hypot(p_compl.r, p_compl.i); return hypot(p_compl.r, p_compl.i);
} }
#endif

View file

@ -26,7 +26,7 @@ char *name;
if (!name) return 0; if (!name) return 0;
if (*_penviron == NULL) return 1; if (*_penviron == NULL) return 1;
if (r = strchr(name, '=')) { if ((r = strchr(name, '='))) {
register _CONST char *p, *q; register _CONST char *p, *q;
*r = '\0'; *r = '\0';
@ -65,7 +65,7 @@ char *name;
size = i; size = i;
p = *_penviron; p = *_penviron;
*_penviron = v; *_penviron = v;
while (*v++ = *p++); /* copy the environment */ while ((*v++ = *p++)); /* copy the environment */
v = *_penviron; v = *_penviron;
} else if (!(size % ENTRY_INC)) { } else if (!(size % ENTRY_INC)) {
if (!(v = realloc(*_penviron, rounded(size) * sizeof(char **)))) if (!(v = realloc(*_penviron, rounded(size) * sizeof(char **))))

View file

@ -16,7 +16,7 @@ register FILE *stream;
register char *p = (char *) &w; register char *p = (char *) &w;
while (cnt--) { while (cnt--) {
putc(*p++, stream); (void) putc(*p++, stream);
} }
if (ferror(stream)) return EOF; if (ferror(stream)) return EOF;
return w; return w;

View file

@ -47,6 +47,7 @@ char *__findenv(const char *, int *);
* Set the value of the environmental variable "name" to be * Set the value of the environmental variable "name" to be
* "value". If rewrite is set, replace any current value. * "value". If rewrite is set, replace any current value.
*/ */
int
setenv(name, value, rewrite) setenv(name, value, rewrite)
register const char *name; register const char *name;
register const char *value; register const char *value;
@ -64,7 +65,7 @@ setenv(name, value, rewrite)
if (!rewrite) if (!rewrite)
return (0); return (0);
if (strlen(c) >= l_value) { /* old larger; copy over */ if (strlen(c) >= l_value) { /* old larger; copy over */
while (*c++ = *value++); while ((*c++ = *value++));
return (0); return (0);
} }
} else { /* create new slot */ } else { /* create new slot */
@ -94,7 +95,7 @@ setenv(name, value, rewrite)
malloc((size_t)((int)(c - name) + l_value + 2)))) malloc((size_t)((int)(c - name) + l_value + 2))))
return (-1); return (-1);
for (c = environ[offset]; (*c = *name++) && *c != '='; ++c); for (c = environ[offset]; (*c = *name++) && *c != '='; ++c);
for (*c++ = '='; *c++ = *value++;); for (*c++ = '='; (*c++ = *value++););
return (0); return (0);
} }

View file

@ -686,6 +686,7 @@ sopno lev; /* PLUS nesting level */
/* "can't happen" */ /* "can't happen" */
assert(nope); assert(nope);
/* NOTREACHED */ /* NOTREACHED */
_exit(1);
} }
/* /*

View file

@ -53,6 +53,7 @@ static char sccsid[] = "@(#)regexec.c 8.3 (Berkeley) 3/20/94";
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <limits.h> #include <limits.h>
#include <unistd.h>
#ifdef __minix_vmd #ifdef __minix_vmd
#include <bsd/asciictype.h> #include <bsd/asciictype.h>
#else #else

View file

@ -131,7 +131,7 @@ _doprnt(register const char *fmt, va_list ap, FILE *stream)
const char *oldfmt; const char *oldfmt;
char *s1, buf[1025]; char *s1, buf[1025];
while (c = *fmt++) { while ((c = *fmt++)) {
if (c != '%') { if (c != '%') {
#ifdef CPM #ifdef CPM
if (c == '\n') { if (c == '\n') {

View file

@ -46,6 +46,7 @@ static char sccsid[] = "@(#)mktemp.c 8.1 (Berkeley) 6/4/93";
static int _gettemp(char*,int*); static int _gettemp(char*,int*);
int
mkstemp(path) mkstemp(path)
char *path; char *path;
{ {
@ -61,7 +62,7 @@ mktemp(path)
return(_gettemp(path, (int *)NULL) ? path : (char *)NULL); return(_gettemp(path, (int *)NULL) ? path : (char *)NULL);
} }
static static int
_gettemp(path, doopen) _gettemp(path, doopen)
char *path; char *path;
register int *doopen; register int *doopen;

View file

@ -22,7 +22,7 @@ vsnprintf(char *s, size_t n, const char *format, va_list arg)
retval = _doprnt(format, arg, &tmp_stream); retval = _doprnt(format, arg, &tmp_stream);
tmp_stream._count = 1; tmp_stream._count = 1;
putc('\0',&tmp_stream); (void) putc('\0',&tmp_stream);
return retval; return retval;
} }

View file

@ -48,7 +48,7 @@ char *s;
void outc(c) void outc(c)
int c; int c;
{ {
putchar(c); (void) putchar(c);
} }
/* Move cursor to r,c */ /* Move cursor to r,c */

View file

@ -58,7 +58,7 @@ int ch;
{ {
if ((_cursvar.cursrow < LINES) || (_cursvar.curscol < COLS)) { if ((_cursvar.cursrow < LINES) || (_cursvar.curscol < COLS)) {
newattr(ch); newattr(ch);
putchar(ch); (void) putchar(ch);
} }
} }

View file

@ -17,7 +17,7 @@ WINDOW *win;
} }
inp = getchar(); inp = getchar();
if (_cursvar.echoit) { if (_cursvar.echoit) {
mvwaddch(curscr, win->_cury + win->_begy, (void) mvwaddch(curscr, win->_cury + win->_begy,
win->_curx + win->_begx, inp); win->_curx + win->_begx, inp);
waddch(win, inp); waddch(win, inp);
} }

View file

@ -5,6 +5,8 @@
#include <signal.h> #include <signal.h>
#include <errno.h> #include <errno.h>
#include <ctype.h> #include <ctype.h>
#include <termcap.h>
#include <unistd.h>
/* /*
** Manifest constants. ** Manifest constants.

View file

@ -18,12 +18,8 @@ PUBLIC void panic(const char *fmt, ...)
endpoint_t me = NONE; endpoint_t me = NONE;
char name[20]; char name[20];
void (*suicide)(void); void (*suicide)(void);
static int panicing= 0;
va_list args; va_list args;
if(panicing) return;
panicing= 1;
if(sys_whoami(&me, name, sizeof(name)) == OK && me != NONE) if(sys_whoami(&me, name, sizeof(name)) == OK && me != NONE)
printf("%s(%d): panic: ", name, me); printf("%s(%d): panic: ", name, me);
else else

View file

@ -166,6 +166,7 @@ PUBLIC void _exit(int status)
{ {
/* Make exit() an alias for sef_exit() for system services. */ /* Make exit() an alias for sef_exit() for system services. */
sef_exit(status); sef_exit(status);
panic("sef_exit failed");
} }
/*===========================================================================* /*===========================================================================*
@ -175,6 +176,7 @@ PUBLIC void __exit(int status)
{ {
/* Make exit() an alias for sef_exit() for system services. */ /* Make exit() an alias for sef_exit() for system services. */
sef_exit(status); sef_exit(status);
panic("sef_exit failed");
} }
/*===========================================================================* /*===========================================================================*

View file

@ -3,6 +3,8 @@
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
#include <unistd.h>
#include "gzguts.h" #include "gzguts.h"
#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 #if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0

View file

@ -3,6 +3,8 @@
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
#include <unistd.h>
#include "gzguts.h" #include "gzguts.h"
/* Local functions */ /* Local functions */
@ -167,12 +169,12 @@ local int gz_head(state)
gz_error(state, Z_DATA_ERROR, "unknown header flags set"); gz_error(state, Z_DATA_ERROR, "unknown header flags set");
return -1; return -1;
} }
NEXT(); /* modification time */ (void) NEXT(); /* modification time */
NEXT(); (void) NEXT();
NEXT(); (void) NEXT();
NEXT(); (void) NEXT();
NEXT(); /* extra flags */ (void) NEXT(); /* extra flags */
NEXT(); /* operating system */ (void) NEXT(); /* operating system */
if (flags & 4) { /* extra field */ if (flags & 4) { /* extra field */
len = (unsigned)NEXT(); len = (unsigned)NEXT();
len += (unsigned)NEXT() << 8; len += (unsigned)NEXT() << 8;
@ -187,8 +189,8 @@ local int gz_head(state)
while (NEXT() > 0) while (NEXT() > 0)
; ;
if (flags & 2) { /* header crc */ if (flags & 2) { /* header crc */
NEXT(); (void) NEXT();
NEXT(); (void) NEXT();
} }
/* an unexpected end of file is not checked for here -- it will be /* an unexpected end of file is not checked for here -- it will be
noticed on the first request for uncompressed data */ noticed on the first request for uncompressed data */

View file

@ -5,6 +5,8 @@
#include "gzguts.h" #include "gzguts.h"
#include <unistd.h>
/* Local functions */ /* Local functions */
local int gz_init OF((gz_statep)); local int gz_init OF((gz_statep));
local int gz_comp OF((gz_statep, int)); local int gz_comp OF((gz_statep, int));