From: Ben Gras Date: Wed, 14 Aug 2013 12:27:39 +0000 (+0000) Subject: a bit more -Werror compatability X-Git-Tag: v3.3.0~836 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=refs%2Fchanges%2F37%2F737%2F2;p=minix.git 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 --- diff --git a/common/dist/zlib/deflate.c b/common/dist/zlib/deflate.c index a79e37ebf..3f8340337 100644 --- a/common/dist/zlib/deflate.c +++ b/common/dist/zlib/deflate.c @@ -51,6 +51,10 @@ /* @(#) Id */ +#if defined(__minix) && defined(_STANDALONE) +#include +#endif + #include "deflate.h" const char deflate_copyright[] = diff --git a/common/dist/zlib/infback.c b/common/dist/zlib/infback.c index af697b764..2f074dbfc 100644 --- a/common/dist/zlib/infback.c +++ b/common/dist/zlib/infback.c @@ -12,6 +12,10 @@ inflate_fast() can be used with either inflate.c or infback.c. */ +#if defined(__minix) && defined(_STANDALONE) +#include +#endif + #include "zutil.h" #include "inftrees.h" #include "inflate.h" diff --git a/common/dist/zlib/inflate.c b/common/dist/zlib/inflate.c index 12461dc54..fef7e8b43 100644 --- a/common/dist/zlib/inflate.c +++ b/common/dist/zlib/inflate.c @@ -82,6 +82,10 @@ * The history for versions after 1.2.0 are in ChangeLog in zlib distribution. */ +#if defined(__minix) && defined(_STANDALONE) +#include +#endif + #include "zutil.h" #include "inftrees.h" #include "inflate.h" diff --git a/drivers/dec21140A/dec21140A.c b/drivers/dec21140A/dec21140A.c index c6edcf8ce..b4f105331 100644 --- a/drivers/dec21140A/dec21140A.c +++ b/drivers/dec21140A/dec21140A.c @@ -116,7 +116,7 @@ int main(int argc, char *argv[]) case DL_GETSTAT_S: do_get_stat_s(&m); break; 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); 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, (vir_bytes)&dep->de_stat, sizeof(dep->de_stat))) != OK) - panic(str_CopyErrMsg, rc); + panic("%s %d", str_CopyErrMsg, rc); mp->m_type = DL_STAT_REPLY; rc = send(mp->m_source, mp); if( rc != OK ) - panic(str_StatErrMsg, rc); + panic("%s %d", str_StatErrMsg, rc); return; } @@ -252,7 +252,7 @@ static void do_conf(const message * mp) } if (send(mp->m_source, &reply_mess) != OK) - panic(str_SendErrMsg, mp->m_source); + panic("%s %d", str_SendErrMsg, mp->m_source); return; } @@ -272,7 +272,7 @@ static void do_reply(dpeth_t * dep) r = send(dep->de_client, &reply); if(r < 0) - panic(str_SendErrMsg, r); + panic("%s %d", str_SendErrMsg, r); dep->de_read_s = 0; 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; size = de_calc_iov_size(&dep->de_read_iovec); if (size < ETH_MAX_PACK_SIZE) - panic(str_SizeErrMsg, size); + panic("%s %d", str_SizeErrMsg, size); /* Copy buffer to user area and clear ownage */ 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, (vir_bytes)buffer, bytes); if (r != OK) - panic(str_CopyErrMsg, r); + panic("%s %d", str_CopyErrMsg, r); buffer += bytes; 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 buffer_vir = (vir_bytes)dep->sendrecv_buf; de_loc_descr_t *loc_descr; - u32_t temp; + phys_bytes temp; 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++){ /* translate buffers physical address */ 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); loc_descr->descr->des[DES_BUF2] = 0; 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 */ 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]); - 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, 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", 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), sizeof(de_descr_t), &temp); if(r != OK) - panic(str_UmapErrMsg, r); + panic("%s %d", str_UmapErrMsg, r); if( ((loc_descr->descr->des[DES_BUF1] & 0x3) != 0) || ((loc_descr->descr->des[DES_BUF2] & 0x3) != 0) || ((temp&0x3)!=0) ) - panic(str_AlignErrMsg, temp); + panic("%s 0x%lx", str_AlignErrMsg, temp); 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); rc = sys_safecopyfrom(user_proc, grant, 0, (vir_bytes)loc_addr, len); if (rc != OK) - panic(str_CopyErrMsg, rc); + panic("%s %d", str_CopyErrMsg, rc); return; } @@ -806,7 +806,7 @@ static void do_vwrite_s(const message * mp, int from_int){ if (dep->de_mode == DEM_ENABLED) { 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]]; @@ -828,7 +828,7 @@ static void do_vwrite_s(const message * mp, int from_int){ iovp->iod_iovec_offset = 0; totalsize = size = de_calc_iov_size(iovp); 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->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, 0, (vir_bytes)buffer, bytes); if (r != OK) - panic(str_CopyErrMsg, r); + panic("%s %d", str_CopyErrMsg, r); buffer += bytes; if (++ix >= IOVEC_NR) { diff --git a/include/minix/optset.h b/include/minix/optset.h index 8d43fe23f..a7e088122 100644 --- a/include/minix/optset.h +++ b/include/minix/optset.h @@ -19,7 +19,7 @@ typedef enum { * 'os_val' is then a base passed to strtol(). */ struct optset { - char *os_name; + const char *os_name; optset_type os_type; void *os_ptr; int os_val; diff --git a/lib/csu/common/crt0-common.c b/lib/csu/common/crt0-common.c index 4918c9803..3766cac1c 100644 --- a/lib/csu/common/crt0-common.c +++ b/lib/csu/common/crt0-common.c @@ -42,6 +42,8 @@ __RCSID("$NetBSD: crt0-common.c,v 1.9 2012/08/13 02:15:35 matt Exp $"); #include #ifndef __minix #include +#else +#include #endif #include #include diff --git a/lib/libc/Makefile.inc b/lib/libc/Makefile.inc index 11019198c..b5354c484 100644 --- a/lib/libc/Makefile.inc +++ b/lib/libc/Makefile.inc @@ -23,6 +23,10 @@ USE_JEMALLOC=no USE_MINIXMALLOC=yes USE_FORT=no USE_LIBTRE=no + +# BJG too many warnings +NOGCCERROR?= yes +NOCLANGERROR?= yes .endif # defined(__MINIX) USE_FORT?= yes diff --git a/lib/libmthread/proto.h b/lib/libmthread/proto.h index c7154ac88..dc89ffbd2 100644 --- a/lib/libmthread/proto.h +++ b/lib/libmthread/proto.h @@ -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)) void mthread_debug_f(const char *file, int line, const char *msg); #else -void mthread_panic_s(void); +__dead void mthread_panic_s(void); # define mthread_panic(m) mthread_panic_s() # define mthread_debug(m) #endif diff --git a/lib/libprop/Makefile b/lib/libprop/Makefile index b17e4d40f..161861054 100644 --- a/lib/libprop/Makefile +++ b/lib/libprop/Makefile @@ -2,6 +2,10 @@ .include +.if defined(__MINIX) +WARNS=3 +.endif + WARNS?=5 USE_SHLIBDIR= yes diff --git a/servers/ext2/Makefile b/servers/ext2/Makefile index de47cca40..3521574d5 100644 --- a/servers/ext2/Makefile +++ b/servers/ext2/Makefile @@ -8,6 +8,8 @@ SRCS= balloc.c link.c \ DPADD+= ${LIBMINIXFS} ${LIBBDEV} ${LIBSYS} LDADD+= -lminixfs -lbdev -lsys +WARNS=3 + MAN= BINDIR?= /sbin diff --git a/servers/ext2/path.c b/servers/ext2/path.c index 54b7aa8ef..27a02801e 100644 --- a/servers/ext2/path.c +++ b/servers/ext2/path.c @@ -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) 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 */ int flag; /* LOOK_UP, ENTER, DELETE or IS_EMPTY */ int check_permissions; /* check permissions when flag is !IS_EMPTY */ diff --git a/servers/ext2/proto.h b/servers/ext2/proto.h index 46d285920..b66291f1e 100644 --- a/servers/ext2/proto.h +++ b/servers/ext2/proto.h @@ -62,7 +62,7 @@ int fs_slink(void); int fs_lookup(void); struct inode *advance(struct inode *dirp, char string[NAME_MAX + 1], int 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); /* protect.c */ @@ -99,7 +99,7 @@ int fs_utime(void); time_t clock_time(void); unsigned conv2(int norm, int w); 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); int min(unsigned int l, unsigned int r); int no_sys(void); diff --git a/servers/ext2/utility.c b/servers/ext2/utility.c index dd3d56d13..5cca3eac5 100644 --- a/servers/ext2/utility.c +++ b/servers/ext2/utility.c @@ -87,7 +87,7 @@ int min(unsigned int l, unsigned int r) /*===========================================================================* * 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) { if(len < maxlen && str[len-1] != '\0') { diff --git a/servers/inet/Makefile b/servers/inet/Makefile index 936b372fb..974a9a696 100644 --- a/servers/inet/Makefile +++ b/servers/inet/Makefile @@ -12,6 +12,8 @@ SRCS= buf.c clock.c inet.c inet_config.c \ .PATH: ${.CURDIR}/generic +WARNS=2 + DPADD+= ${LIBCHARDRIVER} ${LIBSYS} ${LIBMINIXUTIL} LDADD+= -lchardriver -lsys diff --git a/servers/inet/generic/tcp.c b/servers/inet/generic/tcp.c index d2427b0f2..2c072548f 100644 --- a/servers/inet/generic/tcp.c +++ b/servers/inet/generic/tcp.c @@ -761,7 +761,7 @@ ioreq_t req; tcp_fd_t *tcp_fd; tcp_port_t *tcp_port; tcp_conn_t *tcp_conn; - nwio_tcpconf_t *tcp_conf; + nwio_tcpconf_t *io_tcp_conf; nwio_tcpopt_t *tcp_opt; tcp_cookie_t *cookiep; acc_t *acc, *conf_acc, *opt_acc; @@ -797,19 +797,19 @@ ioreq_t req; result= tcp_setconf(tcp_fd); break; case NWIOGTCPCONF: - conf_acc= bf_memreq(sizeof(*tcp_conf)); -assert (conf_acc->acc_length == sizeof(*tcp_conf)); - tcp_conf= (nwio_tcpconf_t *)ptr2acc_data(conf_acc); + conf_acc= bf_memreq(sizeof(*io_tcp_conf)); +assert (conf_acc->acc_length == sizeof(*io_tcp_conf)); + 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) { tcp_conn= tcp_fd->tf_conn; - tcp_conf->nwtc_locport= tcp_conn->tc_locport; - tcp_conf->nwtc_remaddr= tcp_conn->tc_remaddr; - tcp_conf->nwtc_remport= tcp_conn->tc_remport; + io_tcp_conf->nwtc_locport= tcp_conn->tc_locport; + io_tcp_conf->nwtc_remaddr= tcp_conn->tc_remaddr; + 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, 0, conf_acc, TRUE); tcp_fd->tf_flags &= ~TFF_IOCTL_IP; diff --git a/servers/pm/misc.c b/servers/pm/misc.c index d37e4d768..40291a53c 100644 --- a/servers/pm/misc.c +++ b/servers/pm/misc.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -526,6 +527,6 @@ int do_getrusage() 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)); } diff --git a/sys/lib/libkern/libkern.h b/sys/lib/libkern/libkern.h index 7857cf941..e6fc8b886 100644 --- a/sys/lib/libkern/libkern.h +++ b/sys/lib/libkern/libkern.h @@ -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 kheapsort(void *, size_t, size_t, int (*)(const void *, const void *), void *); -#ifndef __minix uint32_t crc32(uint32_t, const uint8_t *, size_t); -#endif unsigned int popcount(unsigned int) __constfunc; unsigned int popcountl(unsigned long) __constfunc; unsigned int popcountll(unsigned long long) __constfunc;