diff --git a/bin/pax/Makefile b/bin/pax/Makefile index 5758ee9cb..70415cdb9 100644 --- a/bin/pax/Makefile +++ b/bin/pax/Makefile @@ -4,7 +4,7 @@ .include .if defined(__MINIX) -WARNS=3 +WARNS=2 .endif PROG= pax diff --git a/bin/pax/pax.h b/bin/pax/pax.h index 7e8ab1a21..4385fefca 100644 --- a/bin/pax/pax.h +++ b/bin/pax/pax.h @@ -246,6 +246,12 @@ typedef struct oplist { #ifdef HOSTPROG # include "pack_dev.h" /* explicitly use NetBSD's macros */ + +#ifdef __minix +#undef MAJOR +#undef MINOR +#endif + # define MAJOR(x) major_netbsd(x) # define MINOR(x) minor_netbsd(x) # define TODEV(x, y) makedev_netbsd((x), (y)) diff --git a/external/public-domain/xz/lib/Makefile b/external/public-domain/xz/lib/Makefile index a5d16d386..dc2724753 100644 --- a/external/public-domain/xz/lib/Makefile +++ b/external/public-domain/xz/lib/Makefile @@ -24,7 +24,11 @@ INCS+= base.h bcj.h block.h check.h container.h delta.h \ INCSDIR= /usr/include/lzma -LDFLAGS+= -Wl,-z,defs +LDFLAGS+= -Wl,-z,defs + +.if defined(__MINIX) +LDFLAGS+= -lc +.endif CPPFLAGS+= -I${XZSRCDIR}/src/liblzma/check CPPFLAGS+= -I${XZSRCDIR}/src/liblzma/common diff --git a/lib/libddekit/build/ddekit/Makefile b/lib/libddekit/build/ddekit/Makefile index 244b81677..a37b91a62 100644 --- a/lib/libddekit/build/ddekit/Makefile +++ b/lib/libddekit/build/ddekit/Makefile @@ -7,7 +7,7 @@ VPATH = $(SRC_DIR) SRCS = pci.c printf.c mem.c pgtab.c dde.c initcall.c thread.c condvar.c lock.c semaphore.c timer.c panic.c irq.c resource.c msg_queue.c -CFLAGS += -Wall -D_NETBSD_SOURCE +CFLAGS += -D_NETBSD_SOURCE .include diff --git a/lib/libedit/Makefile b/lib/libedit/Makefile index 0880363d1..5026ce30b 100644 --- a/lib/libedit/Makefile +++ b/lib/libedit/Makefile @@ -12,7 +12,10 @@ LIBDPLIBS+= terminfo ${.CURDIR}/../libterminfo .include "bsd.own.mk" COPTS+= -Wunused-parameter + +.if !defined(__MINIX) CWARNFLAGS.gcc+= -Wconversion +.endif OSRCS= chared.c common.c el.c emacs.c fcns.c filecomplete.c help.c \ hist.c keymacro.c map.c chartype.c \ diff --git a/lib/liblwip/include/lwip/pbuf.h b/lib/liblwip/include/lwip/pbuf.h index 786b288b4..4f8dca8ac 100644 --- a/lib/liblwip/include/lwip/pbuf.h +++ b/lib/liblwip/include/lwip/pbuf.h @@ -136,7 +136,7 @@ struct pbuf_custom { #endif /* PBUF_POOL_FREE_OOSEQ */ #if NO_SYS && PBUF_POOL_FREE_OOSEQ extern volatile u8_t pbuf_free_ooseq_pending; -void pbuf_free_ooseq(); +void pbuf_free_ooseq(void); /** When not using sys_check_timeouts(), call PBUF_CHECK_FREE_OOSEQ() at regular intervals from main level to check if ooseq pbufs need to be freed! */ diff --git a/lib/libmthread/Makefile b/lib/libmthread/Makefile index 95d1876d0..94d834192 100644 --- a/lib/libmthread/Makefile +++ b/lib/libmthread/Makefile @@ -14,6 +14,6 @@ SRCS= \ scheduler.c \ key.c -WARNS?= 5 +WARNS?= 4 .include diff --git a/lib/libmthread/misc.c b/lib/libmthread/misc.c index c9c9f1775..86c8800ac 100644 --- a/lib/libmthread/misc.c +++ b/lib/libmthread/misc.c @@ -39,7 +39,7 @@ void mthread_panic_s(void) volatile int *sf; sf = NULL; - *((int *) sf ) = 1; /* Cause segfault to generate trace */ + *((volatile int *) sf ) = 1; /* Cause segfault to generate trace */ exit(1); } #endif diff --git a/servers/ext2/inode.c b/servers/ext2/inode.c index 45107d94f..35b79c610 100644 --- a/servers/ext2/inode.c +++ b/servers/ext2/inode.c @@ -42,7 +42,7 @@ int fs_putnode(void) if (!rip) { printf("%s:%d put_inode: inode #%u dev: %d not found\n", __FILE__, - __LINE__, (ino_t) fs_m_in.REQ_INODE_NR, fs_dev); + __LINE__, (unsigned int) fs_m_in.REQ_INODE_NR, fs_dev); panic("fs_putnode failed"); } diff --git a/servers/ext2/open.c b/servers/ext2/open.c index 1096e09a3..f38d6e793 100644 --- a/servers/ext2/open.c +++ b/servers/ext2/open.c @@ -171,7 +171,7 @@ int fs_mkdir() /* It was not possible to enter . or .. probably disk was full - * links counts haven't been touched. */ if (search_dir(ldirp, lastc, NULL, DELETE, IGN_PERM, 0) != OK) - panic("Dir disappeared: %d ", rip->i_num); + panic("Dir disappeared: %d ", (int) rip->i_num); rip->i_links_count--; /* undo the increment done in new_node() */ } rip->i_dirt = IN_DIRTY; /* either way, i_links_count has changed */ diff --git a/servers/ext2/read.c b/servers/ext2/read.c index 083a8b022..f095a4579 100644 --- a/servers/ext2/read.c +++ b/servers/ext2/read.c @@ -327,7 +327,7 @@ int opportunistic; */ struct buf *bp; - int index; + int mindex; block_t b; unsigned long excess, block_pos; static char first_time = TRUE; @@ -358,7 +358,7 @@ int opportunistic; /* It is not in the inode, so it must be single, double or triple indirect */ if (block_pos < doub_ind_s) { b = rip->i_block[EXT2_NDIR_BLOCKS]; /* address of single indirect block */ - index = block_pos - EXT2_NDIR_BLOCKS; + mindex = block_pos - EXT2_NDIR_BLOCKS; } else if (block_pos >= out_range_s) { /* TODO: do we need it? */ return(NO_BLOCK); } else { @@ -374,8 +374,8 @@ int opportunistic; ASSERT(lmfs_dev(bp) != NO_DEV); ASSERT(lmfs_dev(bp) == rip->i_dev); excess = block_pos - triple_ind_s; - index = excess / addr_in_block2; - b = rd_indir(bp, index); /* num of double ind block */ + mindex = excess / addr_in_block2; + b = rd_indir(bp, mindex); /* num of double ind block */ put_block(bp, INDIRECT_BLOCK); /* release triple ind block */ excess = excess % addr_in_block2; } @@ -387,10 +387,10 @@ int opportunistic; } ASSERT(lmfs_dev(bp) != NO_DEV); ASSERT(lmfs_dev(bp) == rip->i_dev); - index = excess / addr_in_block; - b = rd_indir(bp, index); /* num of single ind block */ + mindex = excess / addr_in_block; + b = rd_indir(bp, mindex); /* num of single ind block */ put_block(bp, INDIRECT_BLOCK); /* release double ind block */ - index = excess % addr_in_block; /* index into single ind blk */ + mindex = excess % addr_in_block; /* index into single ind blk */ } if (b == NO_BLOCK) return(NO_BLOCK); bp = get_block(rip->i_dev, b, iomode); /* get single indirect block */ @@ -401,7 +401,7 @@ int opportunistic; ASSERT(lmfs_dev(bp) != NO_DEV); ASSERT(lmfs_dev(bp) == rip->i_dev); - b = rd_indir(bp, index); + b = rd_indir(bp, mindex); put_block(bp, INDIRECT_BLOCK); /* release single ind block */ return(b); @@ -421,14 +421,14 @@ struct buf *get_block_map(register struct inode *rip, u64_t position) /*===========================================================================* * rd_indir * *===========================================================================*/ -block_t rd_indir(bp, index) +block_t rd_indir(bp, mindex) struct buf *bp; /* pointer to indirect block */ -int index; /* index into *bp */ +int mindex; /* index into *bp */ { if (bp == NULL) panic("rd_indir() on NULL"); /* TODO: use conv call */ - return conv4(le_CPU, b_ind(bp)[index]); + return conv4(le_CPU, b_ind(bp)[mindex]); } @@ -678,13 +678,22 @@ int fs_getdents(void) if (d_desc->d_ino == 0) continue; /* Entry is not in use */ +#if 0 + /* read.c:682: error: comparison is always false due to + * limited range of data type + */ if (d_desc->d_name_len > NAME_MAX || d_desc->d_name_len > EXT2_NAME_MAX) { len = min(NAME_MAX, EXT2_NAME_MAX); - } else { + } else +#endif + { len = d_desc->d_name_len; } + assert(len <= NAME_MAX); + assert(len <= EXT2_NAME_MAX); + /* Compute record length */ reclen = offsetof(struct dirent, d_name) + len + 1; o = (reclen % sizeof(long)); diff --git a/servers/ext2/write.c b/servers/ext2/write.c index fe53161e6..389ca1716 100644 --- a/servers/ext2/write.c +++ b/servers/ext2/write.c @@ -24,16 +24,16 @@ static int empty_indir(struct buf *, struct super_block *); /*===========================================================================* * write_map * *===========================================================================*/ -int write_map(rip, position, new_block, op) +int write_map(rip, position, new_wblock, op) struct inode *rip; /* pointer to inode to be changed */ off_t position; /* file address to be mapped */ -block_t new_block; /* block # to be inserted */ +block_t new_wblock; /* block # to be inserted */ int op; /* special actions */ { /* Write a new block into an inode. * * If op includes WMAP_FREE, free the block corresponding to that position - * in the inode ('new_block' is ignored then). Also free the indirect block + * in the inode ('new_wblock' is ignored then). Also free the indirect block * if that was the last entry in the indirect block. * Also free the double/triple indirect block if that was the last entry in * the double/triple indirect block. @@ -73,7 +73,7 @@ int op; /* special actions */ rip->i_block[block_pos] = NO_BLOCK; rip->i_blocks -= rip->i_sp->s_sectors_in_block; } else { - rip->i_block[block_pos] = new_block; + rip->i_block[block_pos] = new_wblock; rip->i_blocks += rip->i_sp->s_sectors_in_block; } return(OK); @@ -222,7 +222,7 @@ int op; /* special actions */ } } } else { - wr_indir(bp, index1, new_block); + wr_indir(bp, index1, new_wblock); rip->i_blocks += rip->i_sp->s_sectors_in_block; } /* b1 equals NO_BLOCK only when we are freeing up the indirect block. */ @@ -272,9 +272,9 @@ int op; /* special actions */ /*===========================================================================* * wr_indir * *===========================================================================*/ -static void wr_indir(bp, index, block) +static void wr_indir(bp, wrindex, block) struct buf *bp; /* pointer to indirect block */ -int index; /* index into *bp */ +int wrindex; /* index into *bp */ block_t block; /* block to write */ { /* Given a pointer to an indirect block, write one entry. */ @@ -283,7 +283,7 @@ block_t block; /* block to write */ panic("wr_indir() on NULL"); /* write a block into an indirect block */ - b_ind(bp)[index] = conv4(le_CPU, block); + b_ind(bp)[wrindex] = conv4(le_CPU, block); } diff --git a/servers/inet/Makefile b/servers/inet/Makefile index 974a9a696..c80bab993 100644 --- a/servers/inet/Makefile +++ b/servers/inet/Makefile @@ -12,7 +12,7 @@ SRCS= buf.c clock.c inet.c inet_config.c \ .PATH: ${.CURDIR}/generic -WARNS=2 +WARNS= DPADD+= ${LIBCHARDRIVER} ${LIBSYS} ${LIBMINIXUTIL} LDADD+= -lchardriver -lsys diff --git a/servers/lwip/Makefile b/servers/lwip/Makefile index 65b80de6d..3cb2bed9a 100644 --- a/servers/lwip/Makefile +++ b/servers/lwip/Makefile @@ -19,7 +19,7 @@ MAN= BINDIR?= /usr/sbin -WARNS?=5 +WARNS?=2 CPPFLAGS+= -I${NETBSDSRCDIR}/lib/liblwip/include CPPFLAGS+= -I${NETBSDSRCDIR}/lib/liblwip/include/ipv4 diff --git a/servers/lwip/driver.c b/servers/lwip/driver.c index 7367b6bdc..6bd3f1a76 100644 --- a/servers/lwip/driver.c +++ b/servers/lwip/driver.c @@ -418,8 +418,8 @@ void driver_up(const char * label, endpoint_t ep) * at the very begining. dhcp should use raw socket but it is a little * tricy in the current dhcp implementation */ - if (!netif_add(&nic->netif, (ip_addr_t *) &ip_addr_any, &ip_addr_none, - &ip_addr_none, nic, ethernetif_init, ethernet_input)) { + if (!netif_add(&nic->netif, (ip_addr_t *) __UNCONST( &ip_addr_any), + &ip_addr_none, &ip_addr_none, nic, ethernetif_init, ethernet_input)) { printf("LWIP : failed to add device /dev/%s\n", nic->name); nic->drv_ep = NONE; } diff --git a/servers/lwip/lwip.c b/servers/lwip/lwip.c index 13f244fae..aec4fc434 100644 --- a/servers/lwip/lwip.c +++ b/servers/lwip/lwip.c @@ -91,7 +91,7 @@ static int sef_cb_init_fresh(__unused int type, __unused sef_init_info_t *info) set_timer(&tcp_stmr, tcp_sticks, tcp_swatchdog, 0); netif_init(); - netif_lo = netif_find((char *) "lo0"); + netif_lo = netif_find(__UNCONST("lo0")); /* Read configuration. */ #if 0 @@ -145,7 +145,7 @@ static int sef_cb_init_fresh(__unused int type, __unused sef_init_info_t *info) return(OK); } -static void sef_local_startup() +static void sef_local_startup(void) { /* Register init callbacks. */ sef_setcb_init_fresh(sef_cb_init_fresh); diff --git a/servers/vfs/filedes.c b/servers/vfs/filedes.c index 51c057e75..c8c5f4c77 100644 --- a/servers/vfs/filedes.c +++ b/servers/vfs/filedes.c @@ -673,8 +673,8 @@ struct filp *f; f->filp_mode = FILP_CLOSED; f->filp_count = 0; } else if (f->filp_count < 0) { - panic("VFS: invalid filp count: %d ino %d/%u", f->filp_count, - vp->v_dev, vp->v_inode_nr); + panic("VFS: invalid filp count: %d ino %d/%u", + (int) f->filp_count, (int) vp->v_dev, (unsigned int) vp->v_inode_nr); } else { unlock_vnode(f->filp_vno); } diff --git a/servers/vfs/misc.c b/servers/vfs/misc.c index 7f8dede77..8d1a4499c 100644 --- a/servers/vfs/misc.c +++ b/servers/vfs/misc.c @@ -336,7 +336,7 @@ int dupvm(struct fproc *rfp, int pfd, int *vmfd, struct filp **newfilp) if (!S_ISREG(f->filp_vno->v_mode) && !S_ISBLK(f->filp_vno->v_mode)) { printf("VFS: mmap regular/blockdev only; dev 0x%x ino %d has mode 0%o\n", - f->filp_vno->v_dev, f->filp_vno->v_inode_nr, f->filp_vno->v_mode); + (int) f->filp_vno->v_dev, (int) f->filp_vno->v_inode_nr, (int) f->filp_vno->v_mode); unlock_filp(f); return EINVAL; } diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk index 749dda535..448d098f6 100644 --- a/share/mk/bsd.own.mk +++ b/share/mk/bsd.own.mk @@ -947,6 +947,7 @@ MKLINT:= no # LSC MINIX does not support these features ATM. USE_FORT:= no +USE_SSP:= no MKYP:= no MKPF:= no MKNLS:= no diff --git a/sys/arch/i386/stand/boot/Makefile.boot b/sys/arch/i386/stand/boot/Makefile.boot index ecf055221..6ab175701 100644 --- a/sys/arch/i386/stand/boot/Makefile.boot +++ b/sys/arch/i386/stand/boot/Makefile.boot @@ -52,7 +52,11 @@ CPUFLAGS= -march=i386 -mtune=i386 CFLAGS+= -mno-sse -mno-sse2 -mno-sse3 COPTS+= -ffreestanding +.if defined(__MINIX) +CFLAGS+= -Wmissing-prototypes -Wstrict-prototypes +.else CFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes +.endif CPPFLAGS+= -nostdinc -D_STANDALONE CPPFLAGS+= -I$S diff --git a/sys/arch/i386/stand/bootxx/Makefile.bootxx b/sys/arch/i386/stand/bootxx/Makefile.bootxx index 3bf1916cb..d8fbae726 100644 --- a/sys/arch/i386/stand/bootxx/Makefile.bootxx +++ b/sys/arch/i386/stand/bootxx/Makefile.bootxx @@ -70,7 +70,11 @@ CPPFLAGS+= -DEPIA_HACK CPUFLAGS= -march=i386 -mtune=i386 .endif +.if defined(__MINIX) +CFLAGS+= -Wmissing-prototypes -Wstrict-prototypes +.else CFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes +.endif CPPFLAGS+= -nostdinc -D_STANDALONE CPPFLAGS+= -I$S diff --git a/usr.bin/ministat/Makefile b/usr.bin/ministat/Makefile index ab160ad1e..18faf3e9c 100644 --- a/usr.bin/ministat/Makefile +++ b/usr.bin/ministat/Makefile @@ -4,7 +4,7 @@ DPADD= ${LIBM} LDADD= -lm # BJG -WARNS=3 +WARNS= .include diff --git a/usr.bin/top/top.c b/usr.bin/top/top.c index 5ff979268..ac31697bf 100644 --- a/usr.bin/top/top.c +++ b/usr.bin/top/top.c @@ -230,12 +230,12 @@ static int print_memory(void) { FILE *fp; unsigned int pagesize; - unsigned long total, free, largest, cached; + unsigned long total, freemem, largest, cached; if ((fp = fopen("meminfo", "r")) == NULL) return 0; - if (fscanf(fp, "%u %lu %lu %lu %lu", &pagesize, &total, &free, + if (fscanf(fp, "%u %lu %lu %lu %lu", &pagesize, &total, &freemem, &largest, &cached) != 5) { fclose(fp); return 0; @@ -245,7 +245,7 @@ static int print_memory(void) printf("main memory: %ldK total, %ldK free, %ldK contig free, " "%ldK cached\n", - (pagesize * total)/1024, (pagesize * free)/1024, + (pagesize * total)/1024, (pagesize * freemem)/1024, (pagesize * largest)/1024, (pagesize * cached)/1024); return 1; @@ -290,7 +290,8 @@ struct tp { static int cmp_procs(const void *v1, const void *v2) { - struct tp *p1 = (struct tp *) v1, *p2 = (struct tp *) v2; + struct tp *p1 = (struct tp *) __UNCONST(v1), + *p2 = (struct tp *) __UNCONST(v2); int p1blocked, p2blocked; if(order == ORDER_MEMORY) { diff --git a/usr.bin/toproto/toproto.c b/usr.bin/toproto/toproto.c index df7aa305d..1d9113954 100644 --- a/usr.bin/toproto/toproto.c +++ b/usr.bin/toproto/toproto.c @@ -290,18 +290,18 @@ static char * parse_mode(int mode){ } static int -dump_entry(FILE * out, int index, const char *base_dir) +dump_entry(FILE * out, int mindex, const char *base_dir) { int space; int i; - struct entry *entry = &entries[index]; + struct entry *entry = &entries[mindex]; if (entry->type == ENTRY_DIR) { - for (space = 0; space < entries[index].depth; space++) { + for (space = 0; space < entries[mindex].depth; space++) { fprintf(out, " "); } - if (entries[index].depth > 0) { + if (entries[mindex].depth > 0) { fprintf(out, "%s ", entry->filename); } fprintf(out, "d%s", parse_mode(entry->mode)); @@ -313,12 +313,12 @@ dump_entry(FILE * out, int index, const char *base_dir) dump_entry(out, i, base_dir); } } - for (space = 0; space < entries[index].depth; space++) { + for (space = 0; space < entries[mindex].depth; space++) { fprintf(out, " "); } fprintf(out, "$\n"); } else if (entry->type == ENTRY_FILE) { - for (space = 0; space < entries[index].depth; space++) { + for (space = 0; space < entries[mindex].depth; space++) { fprintf(out, " "); } /* hack skipping the first . in the path */ @@ -326,7 +326,7 @@ dump_entry(FILE * out, int index, const char *base_dir) parse_mode(entry->mode), entry->uid, entry->gid, base_dir, &entry->path[1]); } else if (entry->type == ENTRY_LINK) { - for (space = 0; space < entries[index].depth; space++) { + for (space = 0; space < entries[mindex].depth; space++) { fprintf(out, " "); } /* hack skipping the first . in the path */ @@ -335,7 +335,7 @@ dump_entry(FILE * out, int index, const char *base_dir) } else { /* missing "b" and "c" for block and char device? */ fprintf(out, "# "); - for (space = 1; space < entries[index].depth; space++) { + for (space = 1; space < entries[mindex].depth; space++) { fprintf(out, " "); } fprintf(out, "%i %s\n", entry->type, entry->path); @@ -360,7 +360,7 @@ dump_proto(FILE * out, const char *base_dir) } static void -print_usage() +print_usage(void) { printf("Usage: toproto [OPTION]...\n"); printf