a bit more -Werror compatability

for clang, fix warnings in drivers/, lib/, servers/, sys/, common/.
by turning off fatal warnings (takes effect if the default is on),
fixing warnings or reducing the warning level.

Change-Id: Ia1b4bc877c879ba783158081b59aa6ebb021a50f
This commit is contained in:
Ben Gras 2013-08-14 12:27:39 +00:00 committed by Gerrit Code Review
parent 0c044c6b02
commit 6e5a113837
17 changed files with 60 additions and 35 deletions

View file

@ -51,6 +51,10 @@
/* @(#) Id */ /* @(#) Id */
#if defined(__minix) && defined(_STANDALONE)
#include <lib/libkern/libkern.h>
#endif
#include "deflate.h" #include "deflate.h"
const char deflate_copyright[] = const char deflate_copyright[] =

View file

@ -12,6 +12,10 @@
inflate_fast() can be used with either inflate.c or infback.c. inflate_fast() can be used with either inflate.c or infback.c.
*/ */
#if defined(__minix) && defined(_STANDALONE)
#include <lib/libkern/libkern.h>
#endif
#include "zutil.h" #include "zutil.h"
#include "inftrees.h" #include "inftrees.h"
#include "inflate.h" #include "inflate.h"

View file

@ -82,6 +82,10 @@
* The history for versions after 1.2.0 are in ChangeLog in zlib distribution. * The history for versions after 1.2.0 are in ChangeLog in zlib distribution.
*/ */
#if defined(__minix) && defined(_STANDALONE)
#include <lib/libkern/libkern.h>
#endif
#include "zutil.h" #include "zutil.h"
#include "inftrees.h" #include "inftrees.h"
#include "inflate.h" #include "inflate.h"

View file

@ -116,7 +116,7 @@ int main(int argc, char *argv[])
case DL_GETSTAT_S: do_get_stat_s(&m); break; case DL_GETSTAT_S: do_get_stat_s(&m); break;
default: default:
printf("message 0x%lx; %d from %d\n", printf("message 0x%x; %d from %d\n",
m.m_type, m.m_type-DL_RQ_BASE, m.m_source); m.m_type, m.m_type-DL_RQ_BASE, m.m_source);
panic("illegal message: %d", m.m_type); panic("illegal message: %d", m.m_type);
} }
@ -179,12 +179,12 @@ static void do_get_stat_s(message * mp)
if ((rc = sys_safecopyto(mp->m_source, mp->DL_GRANT, 0UL, if ((rc = sys_safecopyto(mp->m_source, mp->DL_GRANT, 0UL,
(vir_bytes)&dep->de_stat, (vir_bytes)&dep->de_stat,
sizeof(dep->de_stat))) != OK) sizeof(dep->de_stat))) != OK)
panic(str_CopyErrMsg, rc); panic("%s %d", str_CopyErrMsg, rc);
mp->m_type = DL_STAT_REPLY; mp->m_type = DL_STAT_REPLY;
rc = send(mp->m_source, mp); rc = send(mp->m_source, mp);
if( rc != OK ) if( rc != OK )
panic(str_StatErrMsg, rc); panic("%s %d", str_StatErrMsg, rc);
return; return;
} }
@ -252,7 +252,7 @@ static void do_conf(const message * mp)
} }
if (send(mp->m_source, &reply_mess) != OK) if (send(mp->m_source, &reply_mess) != OK)
panic(str_SendErrMsg, mp->m_source); panic("%s %d", str_SendErrMsg, mp->m_source);
return; return;
} }
@ -272,7 +272,7 @@ static void do_reply(dpeth_t * dep)
r = send(dep->de_client, &reply); r = send(dep->de_client, &reply);
if(r < 0) if(r < 0)
panic(str_SendErrMsg, r); panic("%s %d", str_SendErrMsg, r);
dep->de_read_s = 0; dep->de_read_s = 0;
dep->de_flags &= NOT(DEF_ACK_SEND | DEF_ACK_RECV); dep->de_flags &= NOT(DEF_ACK_SEND | DEF_ACK_RECV);
@ -475,7 +475,7 @@ static void do_vread_s(const message * mp, int from_int)
dep->de_read_iovec.iod_iovec_offset = 0; dep->de_read_iovec.iod_iovec_offset = 0;
size = de_calc_iov_size(&dep->de_read_iovec); size = de_calc_iov_size(&dep->de_read_iovec);
if (size < ETH_MAX_PACK_SIZE) if (size < ETH_MAX_PACK_SIZE)
panic(str_SizeErrMsg, size); panic("%s %d", str_SizeErrMsg, size);
/* Copy buffer to user area and clear ownage */ /* Copy buffer to user area and clear ownage */
size = (descr->descr->des[DES0]&DES0_FL)>>DES0_FL_SHIFT; size = (descr->descr->des[DES0]&DES0_FL)>>DES0_FL_SHIFT;
@ -513,7 +513,7 @@ static void do_vread_s(const message * mp, int from_int)
r= sys_safecopyto(iovp->iod_proc_nr, iovp->iod_iovec[ix].iov_grant, 0, r= sys_safecopyto(iovp->iod_proc_nr, iovp->iod_iovec[ix].iov_grant, 0,
(vir_bytes)buffer, bytes); (vir_bytes)buffer, bytes);
if (r != OK) if (r != OK)
panic(str_CopyErrMsg, r); panic("%s %d", str_CopyErrMsg, r);
buffer += bytes; buffer += bytes;
if (++ix >= IOVEC_NR) { /* Next buffer of IO vector */ if (++ix >= IOVEC_NR) { /* Next buffer of IO vector */
@ -580,7 +580,7 @@ static void de_first_init(dpeth_t *dep)
vir_bytes descr_vir = (vir_bytes)dep->sendrecv_descr_buf; vir_bytes descr_vir = (vir_bytes)dep->sendrecv_descr_buf;
vir_bytes buffer_vir = (vir_bytes)dep->sendrecv_buf; vir_bytes buffer_vir = (vir_bytes)dep->sendrecv_buf;
de_loc_descr_t *loc_descr; de_loc_descr_t *loc_descr;
u32_t temp; phys_bytes temp;
for(i=0;i<2;i++){ for(i=0;i<2;i++){
@ -608,7 +608,7 @@ static void de_first_init(dpeth_t *dep)
for(j=0; j < (i==DESCR_RECV ? DE_NB_RECV_DESCR : DE_NB_SEND_DESCR); j++){ for(j=0; j < (i==DESCR_RECV ? DE_NB_RECV_DESCR : DE_NB_SEND_DESCR); j++){
/* translate buffers physical address */ /* translate buffers physical address */
r = sys_umap(SELF, VM_D, (vir_bytes)loc_descr->buf1, temp, r = sys_umap(SELF, VM_D, (vir_bytes)loc_descr->buf1, temp,
&(loc_descr->descr->des[DES_BUF1])); (phys_bytes *) &(loc_descr->descr->des[DES_BUF1]));
if(r != OK) panic("umap failed: %d", r); if(r != OK) panic("umap failed: %d", r);
loc_descr->descr->des[DES_BUF2] = 0; loc_descr->descr->des[DES_BUF2] = 0;
memset(&loc_descr->descr->des[DES0],0,sizeof(u32_t)); memset(&loc_descr->descr->des[DES0],0,sizeof(u32_t));
@ -624,11 +624,11 @@ static void de_first_init(dpeth_t *dep)
/* record physical location of two first descriptor */ /* record physical location of two first descriptor */
r = sys_umap(SELF, VM_D, (vir_bytes)dep->descr[DESCR_RECV][0].descr, r = sys_umap(SELF, VM_D, (vir_bytes)dep->descr[DESCR_RECV][0].descr,
sizeof(de_descr_t), &dep->sendrecv_descr_phys_addr[DESCR_RECV]); sizeof(de_descr_t), &dep->sendrecv_descr_phys_addr[DESCR_RECV]);
if(r != OK) panic(str_UmapErrMsg, r); if(r != OK) panic("%s %d", str_UmapErrMsg, r);
r = sys_umap(SELF, VM_D, (vir_bytes)dep->descr[DESCR_TRAN][0].descr, r = sys_umap(SELF, VM_D, (vir_bytes)dep->descr[DESCR_TRAN][0].descr,
sizeof(de_descr_t), &dep->sendrecv_descr_phys_addr[DESCR_TRAN]); sizeof(de_descr_t), &dep->sendrecv_descr_phys_addr[DESCR_TRAN]);
if(r != OK) panic(str_UmapErrMsg, r); if(r != OK) panic("%s %d", str_UmapErrMsg, r);
DEBUG(printf("Descr: head tran=[%08X] head recv=[%08X]\n", DEBUG(printf("Descr: head tran=[%08X] head recv=[%08X]\n",
dep->sendrecv_descr_phys_addr[DESCR_TRAN], dep->sendrecv_descr_phys_addr[DESCR_TRAN],
@ -641,12 +641,12 @@ static void de_first_init(dpeth_t *dep)
r = sys_umap(SELF, VM_D, (vir_bytes)&(loc_descr->descr), r = sys_umap(SELF, VM_D, (vir_bytes)&(loc_descr->descr),
sizeof(de_descr_t), &temp); sizeof(de_descr_t), &temp);
if(r != OK) if(r != OK)
panic(str_UmapErrMsg, r); panic("%s %d", str_UmapErrMsg, r);
if( ((loc_descr->descr->des[DES_BUF1] & 0x3) != 0) || if( ((loc_descr->descr->des[DES_BUF1] & 0x3) != 0) ||
((loc_descr->descr->des[DES_BUF2] & 0x3) != 0) || ((loc_descr->descr->des[DES_BUF2] & 0x3) != 0) ||
((temp&0x3)!=0) ) ((temp&0x3)!=0) )
panic(str_AlignErrMsg, temp); panic("%s 0x%lx", str_AlignErrMsg, temp);
loc_descr++; loc_descr++;
} }
@ -778,7 +778,7 @@ static void de_get_userdata_s(int user_proc, cp_grant_id_t grant,
len = (count > IOVEC_NR ? IOVEC_NR : count) * sizeof(iovec_t); len = (count > IOVEC_NR ? IOVEC_NR : count) * sizeof(iovec_t);
rc = sys_safecopyfrom(user_proc, grant, 0, (vir_bytes)loc_addr, len); rc = sys_safecopyfrom(user_proc, grant, 0, (vir_bytes)loc_addr, len);
if (rc != OK) if (rc != OK)
panic(str_CopyErrMsg, rc); panic("%s %d", str_CopyErrMsg, rc);
return; return;
} }
@ -806,7 +806,7 @@ static void do_vwrite_s(const message * mp, int from_int){
if (dep->de_mode == DEM_ENABLED) { if (dep->de_mode == DEM_ENABLED) {
if (!from_int && (dep->de_flags & DEF_SENDING)) if (!from_int && (dep->de_flags & DEF_SENDING))
panic(str_BusyErrMsg); panic("%s", str_BusyErrMsg);
descr = &dep->descr[DESCR_TRAN][dep->cur_descr[DESCR_TRAN]]; descr = &dep->descr[DESCR_TRAN][dep->cur_descr[DESCR_TRAN]];
@ -828,7 +828,7 @@ static void do_vwrite_s(const message * mp, int from_int){
iovp->iod_iovec_offset = 0; iovp->iod_iovec_offset = 0;
totalsize = size = de_calc_iov_size(iovp); totalsize = size = de_calc_iov_size(iovp);
if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE) if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE)
panic(str_SizeErrMsg, size); panic("%s %d", str_SizeErrMsg, size);
dep->bytes_tx += size; dep->bytes_tx += size;
dep->de_stat.ets_packetT++; dep->de_stat.ets_packetT++;
@ -842,7 +842,7 @@ static void do_vwrite_s(const message * mp, int from_int){
r= sys_safecopyfrom(iovp->iod_proc_nr, iovp->iod_iovec[ix].iov_grant, r= sys_safecopyfrom(iovp->iod_proc_nr, iovp->iod_iovec[ix].iov_grant,
0, (vir_bytes)buffer, bytes); 0, (vir_bytes)buffer, bytes);
if (r != OK) if (r != OK)
panic(str_CopyErrMsg, r); panic("%s %d", str_CopyErrMsg, r);
buffer += bytes; buffer += bytes;
if (++ix >= IOVEC_NR) { if (++ix >= IOVEC_NR) {

View file

@ -19,7 +19,7 @@ typedef enum {
* 'os_val' is then a base passed to strtol(). * 'os_val' is then a base passed to strtol().
*/ */
struct optset { struct optset {
char *os_name; const char *os_name;
optset_type os_type; optset_type os_type;
void *os_ptr; void *os_ptr;
int os_val; int os_val;

View file

@ -42,6 +42,8 @@ __RCSID("$NetBSD: crt0-common.c,v 1.9 2012/08/13 02:15:35 matt Exp $");
#include <sys/exec.h> #include <sys/exec.h>
#ifndef __minix #ifndef __minix
#include <sys/syscall.h> #include <sys/syscall.h>
#else
#include <string.h>
#endif #endif
#include <machine/profile.h> #include <machine/profile.h>
#include <stdlib.h> #include <stdlib.h>

View file

@ -23,6 +23,10 @@ USE_JEMALLOC=no
USE_MINIXMALLOC=yes USE_MINIXMALLOC=yes
USE_FORT=no USE_FORT=no
USE_LIBTRE=no USE_LIBTRE=no
# BJG too many warnings
NOGCCERROR?= yes
NOCLANGERROR?= yes
.endif # defined(__MINIX) .endif # defined(__MINIX)
USE_FORT?= yes USE_FORT?= yes

View file

@ -28,7 +28,7 @@ void mthread_panic_f(const char *file, int line, const char *msg);
#define mthread_debug(m) mthread_debug_f(__FILE__, __LINE__, (m)) #define mthread_debug(m) mthread_debug_f(__FILE__, __LINE__, (m))
void mthread_debug_f(const char *file, int line, const char *msg); void mthread_debug_f(const char *file, int line, const char *msg);
#else #else
void mthread_panic_s(void); __dead void mthread_panic_s(void);
# define mthread_panic(m) mthread_panic_s() # define mthread_panic(m) mthread_panic_s()
# define mthread_debug(m) # define mthread_debug(m)
#endif #endif

View file

@ -2,6 +2,10 @@
.include <bsd.own.mk> .include <bsd.own.mk>
.if defined(__MINIX)
WARNS=3
.endif
WARNS?=5 WARNS?=5
USE_SHLIBDIR= yes USE_SHLIBDIR= yes

View file

@ -8,6 +8,8 @@ SRCS= balloc.c link.c \
DPADD+= ${LIBMINIXFS} ${LIBBDEV} ${LIBSYS} DPADD+= ${LIBMINIXFS} ${LIBBDEV} ${LIBSYS}
LDADD+= -lminixfs -lbdev -lsys LDADD+= -lminixfs -lbdev -lsys
WARNS=3
MAN= MAN=
BINDIR?= /sbin BINDIR?= /sbin

View file

@ -483,7 +483,7 @@ char string[NAME_MAX+1]; /* component extracted from 'old_name' */
*===========================================================================*/ *===========================================================================*/
int search_dir(ldir_ptr, string, numb, flag, check_permissions, ftype) int search_dir(ldir_ptr, string, numb, flag, check_permissions, ftype)
register struct inode *ldir_ptr; /* ptr to inode for dir to search */ register struct inode *ldir_ptr; /* ptr to inode for dir to search */
char string[NAME_MAX + 1]; /* component to search for */ const char string[NAME_MAX + 1]; /* component to search for */
ino_t *numb; /* pointer to inode number */ ino_t *numb; /* pointer to inode number */
int flag; /* LOOK_UP, ENTER, DELETE or IS_EMPTY */ int flag; /* LOOK_UP, ENTER, DELETE or IS_EMPTY */
int check_permissions; /* check permissions when flag is !IS_EMPTY */ int check_permissions; /* check permissions when flag is !IS_EMPTY */

View file

@ -62,7 +62,7 @@ int fs_slink(void);
int fs_lookup(void); int fs_lookup(void);
struct inode *advance(struct inode *dirp, char string[NAME_MAX + 1], int struct inode *advance(struct inode *dirp, char string[NAME_MAX + 1], int
chk_perm); chk_perm);
int search_dir(struct inode *ldir_ptr, char string [NAME_MAX + 1], ino_t int search_dir(struct inode *ldir_ptr, const char string [NAME_MAX + 1], ino_t
*numb, int flag, int check_permissions, int ftype); *numb, int flag, int check_permissions, int ftype);
/* protect.c */ /* protect.c */
@ -99,7 +99,7 @@ int fs_utime(void);
time_t clock_time(void); time_t clock_time(void);
unsigned conv2(int norm, int w); unsigned conv2(int norm, int w);
long conv4(int norm, long x); long conv4(int norm, long x);
void mfs_nul_f(char *file, int line, char *str, unsigned int len, void mfs_nul_f(const char *file, int line, const char *str, unsigned int len,
unsigned int maxlen); unsigned int maxlen);
int min(unsigned int l, unsigned int r); int min(unsigned int l, unsigned int r);
int no_sys(void); int no_sys(void);

View file

@ -87,7 +87,7 @@ int min(unsigned int l, unsigned int r)
/*===========================================================================* /*===========================================================================*
* mfs_nul * * mfs_nul *
*===========================================================================*/ *===========================================================================*/
void mfs_nul_f(char *file, int line, char *str, unsigned int len, void mfs_nul_f(const char *file, int line, const char *str, unsigned int len,
unsigned int maxlen) unsigned int maxlen)
{ {
if(len < maxlen && str[len-1] != '\0') { if(len < maxlen && str[len-1] != '\0') {

View file

@ -12,6 +12,8 @@ SRCS= buf.c clock.c inet.c inet_config.c \
.PATH: ${.CURDIR}/generic .PATH: ${.CURDIR}/generic
WARNS=2
DPADD+= ${LIBCHARDRIVER} ${LIBSYS} ${LIBMINIXUTIL} DPADD+= ${LIBCHARDRIVER} ${LIBSYS} ${LIBMINIXUTIL}
LDADD+= -lchardriver -lsys LDADD+= -lchardriver -lsys

View file

@ -761,7 +761,7 @@ ioreq_t req;
tcp_fd_t *tcp_fd; tcp_fd_t *tcp_fd;
tcp_port_t *tcp_port; tcp_port_t *tcp_port;
tcp_conn_t *tcp_conn; tcp_conn_t *tcp_conn;
nwio_tcpconf_t *tcp_conf; nwio_tcpconf_t *io_tcp_conf;
nwio_tcpopt_t *tcp_opt; nwio_tcpopt_t *tcp_opt;
tcp_cookie_t *cookiep; tcp_cookie_t *cookiep;
acc_t *acc, *conf_acc, *opt_acc; acc_t *acc, *conf_acc, *opt_acc;
@ -797,19 +797,19 @@ ioreq_t req;
result= tcp_setconf(tcp_fd); result= tcp_setconf(tcp_fd);
break; break;
case NWIOGTCPCONF: case NWIOGTCPCONF:
conf_acc= bf_memreq(sizeof(*tcp_conf)); conf_acc= bf_memreq(sizeof(*io_tcp_conf));
assert (conf_acc->acc_length == sizeof(*tcp_conf)); assert (conf_acc->acc_length == sizeof(*io_tcp_conf));
tcp_conf= (nwio_tcpconf_t *)ptr2acc_data(conf_acc); io_tcp_conf= (nwio_tcpconf_t *)ptr2acc_data(conf_acc);
*tcp_conf= tcp_fd->tf_tcpconf; *io_tcp_conf= tcp_fd->tf_tcpconf;
if (tcp_fd->tf_flags & TFF_CONNECTED) if (tcp_fd->tf_flags & TFF_CONNECTED)
{ {
tcp_conn= tcp_fd->tf_conn; tcp_conn= tcp_fd->tf_conn;
tcp_conf->nwtc_locport= tcp_conn->tc_locport; io_tcp_conf->nwtc_locport= tcp_conn->tc_locport;
tcp_conf->nwtc_remaddr= tcp_conn->tc_remaddr; io_tcp_conf->nwtc_remaddr= tcp_conn->tc_remaddr;
tcp_conf->nwtc_remport= tcp_conn->tc_remport; io_tcp_conf->nwtc_remport= tcp_conn->tc_remport;
} }
tcp_conf->nwtc_locaddr= tcp_fd->tf_port->tp_ipaddr; io_tcp_conf->nwtc_locaddr= tcp_fd->tf_port->tp_ipaddr;
result= (*tcp_fd->tf_put_userdata)(tcp_fd->tf_srfd, result= (*tcp_fd->tf_put_userdata)(tcp_fd->tf_srfd,
0, conf_acc, TRUE); 0, conf_acc, TRUE);
tcp_fd->tf_flags &= ~TFF_IOCTL_IP; tcp_fd->tf_flags &= ~TFF_IOCTL_IP;

View file

@ -23,6 +23,7 @@
#include <minix/sysinfo.h> #include <minix/sysinfo.h>
#include <minix/type.h> #include <minix/type.h>
#include <minix/vm.h> #include <minix/vm.h>
#include <minix/ds.h>
#include <string.h> #include <string.h>
#include <machine/archtypes.h> #include <machine/archtypes.h>
#include <lib.h> #include <lib.h>
@ -526,6 +527,6 @@ int do_getrusage()
r_usage.ru_stime.tv_usec = usec % 1000000; r_usage.ru_stime.tv_usec = usec % 1000000;
} }
return sys_datacopy(SELF, &r_usage, who_e, return sys_datacopy(SELF, (vir_bytes) &r_usage, who_e,
(vir_bytes) m_in.RU_RUSAGE_ADDR, (vir_bytes) sizeof(r_usage)); (vir_bytes) m_in.RU_RUSAGE_ADDR, (vir_bytes) sizeof(r_usage));
} }

View file

@ -337,9 +337,7 @@ int snprintb(char *, size_t, const char *, uint64_t);
int snprintb_m(char *, size_t, const char *, uint64_t, size_t); int snprintb_m(char *, size_t, const char *, uint64_t, size_t);
int kheapsort(void *, size_t, size_t, int (*)(const void *, const void *), int kheapsort(void *, size_t, size_t, int (*)(const void *, const void *),
void *); void *);
#ifndef __minix
uint32_t crc32(uint32_t, const uint8_t *, size_t); uint32_t crc32(uint32_t, const uint8_t *, size_t);
#endif
unsigned int popcount(unsigned int) __constfunc; unsigned int popcount(unsigned int) __constfunc;
unsigned int popcountl(unsigned long) __constfunc; unsigned int popcountl(unsigned long) __constfunc;
unsigned int popcountll(unsigned long long) __constfunc; unsigned int popcountll(unsigned long long) __constfunc;