From c8f3b10909c82594396a5e25031538a15090fab0 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Mon, 26 Aug 2013 16:43:05 +0000 Subject: [PATCH] fix a few more minix specific warnings . also disable stack protection feature for gcc, causes build errors for pkgsrc gcc on minix Change-Id: I1c6e2bcb4d948098d642543d7b2711284ee55c72 --- bin/pax/Makefile | 2 +- bin/pax/pax.h | 1 + drivers/tty/arch/earm/omap_serial.h | 2 +- external/bsd/mdocml/lib/libmdoc/Makefile | 2 ++ external/gpl3/gcc/lib/libstdc++-v3/Makefile | 5 +++ external/gpl3/gcc/lib/libsupc++/Makefile | 7 +++++ external/gpl3/gcc/usr.bin/libcpp/Makefile | 5 +++ external/public-domain/xz/lib/Makefile | 6 +++- include/minix/gpio.h | 4 +-- include/minix/padconf.h | 4 +-- include/unistd.h | 2 +- kernel/arch/earm/arch_reset.c | 1 + kernel/arch/earm/arch_system.c | 2 ++ kernel/arch/earm/include/hw_intr.h | 2 ++ kernel/arch/earm/omap_intr.c | 4 ++- kernel/arch/earm/omap_reset.c | 2 +- kernel/arch/earm/omap_serial.c | 3 +- kernel/arch/earm/omap_timer.c | 7 +++-- kernel/main.c | 4 +++ kernel/watchdog.h | 3 ++ lib/libddekit/build/ddekit/Makefile | 2 +- lib/libedit/Makefile | 9 ++++++ lib/libgpio/gpio_omap.c | 34 ++++++++++----------- lib/liblwip/include/lwip/pbuf.h | 2 +- lib/libmthread/Makefile | 2 +- lib/libmthread/misc.c | 2 +- lib/libsys/env_panic.c | 3 +- servers/ext2/inode.c | 2 +- servers/ext2/link.c | 2 +- servers/ext2/open.c | 2 +- servers/ext2/read.c | 33 ++++++++++++-------- servers/ext2/write.c | 16 +++++----- servers/inet/Makefile | 2 +- servers/lwip/Makefile | 2 +- servers/lwip/driver.c | 4 +-- servers/lwip/lwip.c | 4 +-- servers/pm/signal.c | 3 +- servers/vfs/filedes.c | 4 +-- servers/vfs/misc.c | 2 +- share/mk/bsd.own.mk | 1 + sys/arch/i386/stand/boot/Makefile.boot | 4 +++ sys/arch/i386/stand/bootxx/Makefile.bootxx | 4 +++ sys/dev/videomode/pickmode.c | 2 ++ sys/sys/ucred.h | 5 +++ tests/Makefile.inc | 3 ++ usr.bin/ministat/Makefile | 2 +- usr.bin/top/top.c | 9 +++--- usr.bin/toproto/toproto.c | 18 +++++------ 48 files changed, 162 insertions(+), 84 deletions(-) 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..f6ada4bda 100644 --- a/bin/pax/pax.h +++ b/bin/pax/pax.h @@ -246,6 +246,7 @@ typedef struct oplist { #ifdef HOSTPROG # include "pack_dev.h" /* explicitly use NetBSD's macros */ + # define MAJOR(x) major_netbsd(x) # define MINOR(x) minor_netbsd(x) # define TODEV(x, y) makedev_netbsd((x), (y)) diff --git a/drivers/tty/arch/earm/omap_serial.h b/drivers/tty/arch/earm/omap_serial.h index 1f136caa2..765bfce63 100644 --- a/drivers/tty/arch/earm/omap_serial.h +++ b/drivers/tty/arch/earm/omap_serial.h @@ -42,7 +42,7 @@ #define OMAP_UART_FCR_RX_FIFO_TRIG_SHIFT 6 #define OMAP_UART_FCR_RX_FIFO_TRIG_MASK (0x3 << 6) #define OMAP_UART_FCR_TX_FIFO_TRIG_SHIFT 4 -#define OMAP_UART_FCR_RX_FIFO_TRIG_MASK (0x3 << 4) +#define OMAP_UART_FCR_TX_FIFO_TRIG_MASK (0x3 << 4) #define UART_FCR_ENABLE_FIFO 0x01 /* Enable the fifo */ #define UART_FCR_CLR_RCVR 0x02 /* Clear the RCVR FIFO */ #define UART_FCR_CLR_XMIT 0x04 /* Clear the XMIT FIFO */ diff --git a/external/bsd/mdocml/lib/libmdoc/Makefile b/external/bsd/mdocml/lib/libmdoc/Makefile index 5a77a7f8e..ab2cee0da 100644 --- a/external/bsd/mdocml/lib/libmdoc/Makefile +++ b/external/bsd/mdocml/lib/libmdoc/Makefile @@ -2,6 +2,8 @@ LIBISPRIVATE= yes +WARNS= + LIB= mdoc SRCS= mdoc_macro.c mdoc.c mdoc_hash.c mdoc_strings.c \ mdoc_argv.c mdoc_validate.c lib.c att.c \ diff --git a/external/gpl3/gcc/lib/libstdc++-v3/Makefile b/external/gpl3/gcc/lib/libstdc++-v3/Makefile index 8316cd644..b80e66fe3 100644 --- a/external/gpl3/gcc/lib/libstdc++-v3/Makefile +++ b/external/gpl3/gcc/lib/libstdc++-v3/Makefile @@ -10,6 +10,11 @@ LDADD= -lgcc_s LIBDPLIBS+= m ${.CURDIR}/../../../../../lib/libm +.if defined(__MINIX) +NOGCCERROR=yes +NOCLANGERROR=yes +.endif + UNSUPPORTED_COMPILER.clang= # defined CWARNFLAGS.clang+= -Wno-logical-op-parentheses \ -Wno-deprecated-writable-strings -Wno-parentheses diff --git a/external/gpl3/gcc/lib/libsupc++/Makefile b/external/gpl3/gcc/lib/libsupc++/Makefile index c13341afc..d26c734f5 100644 --- a/external/gpl3/gcc/lib/libsupc++/Makefile +++ b/external/gpl3/gcc/lib/libsupc++/Makefile @@ -5,7 +5,14 @@ NOLINT= # defined NOPIC= # defined NOPROFILE= # defined +.if defined(__MINIX) +WARNS= +NOGCCERROR=yes +NOCLANGERROR=yes +.else CWARNFLAGS.clang+= -Wno-parentheses +.endif + UNSUPPORTED_COMPILER.clang= # defined .include diff --git a/external/gpl3/gcc/usr.bin/libcpp/Makefile b/external/gpl3/gcc/usr.bin/libcpp/Makefile index 996412f72..57dd646eb 100644 --- a/external/gpl3/gcc/usr.bin/libcpp/Makefile +++ b/external/gpl3/gcc/usr.bin/libcpp/Makefile @@ -2,6 +2,11 @@ LIBISPRIVATE= yes +.if defined(__MINIX) +NOGCCERROR=yes +NOCLANGERROR=yes +.endif + LIB= cpp SRCS= ${G_libcpp_a_OBJS:.o=.c} 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/include/minix/gpio.h b/include/minix/gpio.h index d07e9f306..14000304f 100644 --- a/include/minix/gpio.h +++ b/include/minix/gpio.h @@ -10,7 +10,7 @@ struct gpio #define GPIO_MODE_INPUT 0 #define GPIO_MODE_OUTPUT 1 -int gpio_init(); +int gpio_init(void); /* request access to a gpio */ int gpio_claim(char *owner, int nr, struct gpio **gpio); @@ -30,5 +30,5 @@ int gpio_intr_read(struct gpio *gpio, int *value); /* Interrupt hook */ int gpio_intr_message(message * m); -int gpio_release(); +int gpio_release(void); #endif /* __INCLUDE_GPIO_H__ */ diff --git a/include/minix/padconf.h b/include/minix/padconf.h index 486577b7f..e832fbee4 100644 --- a/include/minix/padconf.h +++ b/include/minix/padconf.h @@ -314,8 +314,8 @@ #define CONTROL_CONF_PUDEN (1<<3) #define CONTROL_CONF_MUXMODE(X) (X&0x7) -int padconf_init(); +int padconf_init(void); int padconf_set(u32_t padconf, u32_t mask, u32_t value); -int padconf_release(); +int padconf_release(void); #endif /* __PADCONF_H__ */ diff --git a/include/unistd.h b/include/unistd.h index efad00e23..c15848b61 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -322,6 +322,7 @@ int unlinkat(int, const char *, int); * Implementation-defined extensions */ #ifdef __minix + int lseek64(int fd, u64_t _offset, int _whence, u64_t *_newpos); #if defined(_NETBSD_SOURCE) #include @@ -334,7 +335,6 @@ int mapdriver(char *label, int major, int style, int flags); pid_t getnpid(endpoint_t proc_ep); uid_t getnuid(endpoint_t proc_ep); gid_t getngid(endpoint_t proc_ep); -int getnucred(endpoint_t proc_ep, struct ucred *ucred); ssize_t pread64(int fd, void *buf, size_t count, u64_t where); ssize_t pwrite64(int fd, const void *buf, size_t count, u64_t where); #endif /* defined(_NETBSD_SOURCE) */ diff --git a/kernel/arch/earm/arch_reset.c b/kernel/arch/earm/arch_reset.c index 44d5dbe8f..b6d16870e 100644 --- a/kernel/arch/earm/arch_reset.c +++ b/kernel/arch/earm/arch_reset.c @@ -17,6 +17,7 @@ #include "arch_proto.h" #include "serial.h" #include "omap_rtc.h" +#include "omap_reset.h" #include "kernel/proc.h" #include "kernel/debug.h" #include "direct_utils.h" diff --git a/kernel/arch/earm/arch_system.c b/kernel/arch/earm/arch_system.c index 5231b9d7b..5fc345126 100644 --- a/kernel/arch/earm/arch_system.c +++ b/kernel/arch/earm/arch_system.c @@ -19,6 +19,8 @@ #include "kernel/debug.h" #include "omap_ccnt.h" #include "omap_padconf.h" +#include "omap_rtc.h" +#include "omap_reset.h" #include "glo.h" diff --git a/kernel/arch/earm/include/hw_intr.h b/kernel/arch/earm/include/hw_intr.h index 0e747c502..2123f63a1 100644 --- a/kernel/arch/earm/include/hw_intr.h +++ b/kernel/arch/earm/include/hw_intr.h @@ -1,6 +1,8 @@ #ifndef __HW_INTR_ARM_H__ #define __HW_INTR_ARM_H__ +#include "omap_intr.h" + #include "kernel/kernel.h" void irq_handle(int irq); diff --git a/kernel/arch/earm/omap_intr.c b/kernel/arch/earm/omap_intr.c index baa3a901a..a99b8c6a1 100644 --- a/kernel/arch/earm/omap_intr.c +++ b/kernel/arch/earm/omap_intr.c @@ -8,6 +8,7 @@ #include "kernel/vm.h" #include "kernel/proto.h" #include "arch_proto.h" +#include "hw_intr.h" #include "omap_intr.h" static struct omap_intr { @@ -28,7 +29,8 @@ int intr_init(const int auto_eoi) #endif omap_intr.size = 0x1000 ; /* 4K */ - kern_phys_map_ptr(omap_intr.base,omap_intr.size,&intr_phys_map,&omap_intr.base); + kern_phys_map_ptr(omap_intr.base,omap_intr.size, + &intr_phys_map, (vir_bytes) &omap_intr.base); return 0; } diff --git a/kernel/arch/earm/omap_reset.c b/kernel/arch/earm/omap_reset.c index 9407b81e1..29b059c97 100644 --- a/kernel/arch/earm/omap_reset.c +++ b/kernel/arch/earm/omap_reset.c @@ -45,7 +45,7 @@ omap3_reset_init(void) { #if defined(AM335X) || defined(DM37XX) kern_phys_map_ptr(omap_reset.base, omap_reset.size, &reset_phys_map, - &omap_reset.base); + (vir_bytes) &omap_reset.base); #endif /* AM335X || DM37XX */ } diff --git a/kernel/arch/earm/omap_serial.c b/kernel/arch/earm/omap_serial.c index 8196275fc..3d182ef71 100644 --- a/kernel/arch/earm/omap_serial.c +++ b/kernel/arch/earm/omap_serial.c @@ -51,7 +51,8 @@ void omap3_ser_init(){ omap_serial.size = 0x1000 ; /* 4k */ - kern_phys_map_ptr(omap_serial.base,omap_serial.size,&serial_phys_map,&omap_serial.base); + kern_phys_map_ptr(omap_serial.base,omap_serial.size, + &serial_phys_map, (vir_bytes) &omap_serial.base); assert(omap_serial.base); } diff --git a/kernel/arch/earm/omap_timer.c b/kernel/arch/earm/omap_timer.c index 8f742e66d..748635368 100644 --- a/kernel/arch/earm/omap_timer.c +++ b/kernel/arch/earm/omap_timer.c @@ -151,7 +151,9 @@ void omap3_frclock_init(void) { u32_t tisr; - kern_phys_map_ptr(fr_timer.base,ARM_PAGE_SIZE,&fr_timer_phys_map,&fr_timer.base); + kern_phys_map_ptr(fr_timer.base,ARM_PAGE_SIZE, + &fr_timer_phys_map, (vir_bytes) &fr_timer.base); + /* enable the clock */ #ifdef AM335X /* Disable the module and wait for the module to be disabled */ @@ -210,7 +212,8 @@ void omap3_frclock_stop() void omap3_timer_init(unsigned freq) { u32_t tisr; - kern_phys_map_ptr(timer.base,ARM_PAGE_SIZE,&timer_phys_map,&timer.base); + kern_phys_map_ptr(timer.base,ARM_PAGE_SIZE, + &timer_phys_map, (vir_bytes) &timer.base); #ifdef AM335X /* disable the module and wait for the module to be disabled */ set32(CM_WKUP_TIMER1_CLKCTRL, CM_MODULEMODE_MASK,CM_MODULEMODE_DISABLED); diff --git a/kernel/main.c b/kernel/main.c index 2ab095344..78b74a2c3 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -111,6 +111,10 @@ void bsp_finish_booting(void) NOT_REACHABLE; } +#ifdef __arm__ +#include "omap_serial.h" +#endif + /*===========================================================================* * kmain * *===========================================================================*/ diff --git a/kernel/watchdog.h b/kernel/watchdog.h index b2ca56b3e..a4eaf1e95 100644 --- a/kernel/watchdog.h +++ b/kernel/watchdog.h @@ -30,6 +30,8 @@ extern struct arch_watchdog *watchdog; /* let the arch code do whatever it needs to setup or quit the watchdog */ int arch_watchdog_init(void); void arch_watchdog_stop(void); + +#ifdef __i386__ /* if the watchdog detects lockup, let the arch code to handle it */ void arch_watchdog_lockup(const struct nmi_frame * frame); @@ -37,6 +39,7 @@ void arch_watchdog_lockup(const struct nmi_frame * frame); * specific low level handler dumped CPU information and can be inspected by the * arch specific code of the watchdog implementaion */ void nmi_watchdog_handler(struct nmi_frame * frame); +#endif /* * start and stop profiling using the NMI watchdog 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..6921a7b21 100644 --- a/lib/libedit/Makefile +++ b/lib/libedit/Makefile @@ -4,6 +4,12 @@ USE_SHLIBDIR= yes WIDECHAR ?= yes + +.if defined(__MINIX) +NOGCCERROR=yes +NOCLANGERROR=yes +.endif + WARNS?= 5 LIB= edit @@ -12,7 +18,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/libgpio/gpio_omap.c b/lib/libgpio/gpio_omap.c index 22f73499c..86d8d3955 100644 --- a/lib/libgpio/gpio_omap.c +++ b/lib/libgpio/gpio_omap.c @@ -146,14 +146,14 @@ static struct omap_gpio_bank omap_gpio_banks[] = { .irq_id = GPIO6_IRQ_HOOK_ID, .irq_hook_id = GPIO6_IRQ_HOOK_ID, }, - {NULL, 0, 0} + {NULL, 0, 0, 0, 0, 0, 0, 0 } }; #define GPIO_REVISION 0x00 #define GPIO_REVISION_MAJOR(X) ((X & 0xF0) >> 4) #define GPIO_REVISION_MINOR(X) (X & 0XF) -struct omap_gpio_bank * +static struct omap_gpio_bank * omap_gpio_bank_get(int gpio_nr) { struct omap_gpio_bank *bank; @@ -162,7 +162,7 @@ omap_gpio_bank_get(int gpio_nr) return bank; } -int +static int omap_gpio_claim(char *owner, int nr, struct gpio **gpio) { log_trace(&log, "%s s claiming %d\n", owner, nr); @@ -187,7 +187,7 @@ omap_gpio_claim(char *owner, int nr, struct gpio **gpio) return OK; } -int +static int omap_gpio_pin_mode(struct gpio *gpio, int mode) { struct omap_gpio_bank *bank; @@ -213,7 +213,7 @@ omap_gpio_pin_mode(struct gpio *gpio, int mode) return 0; } -int +static int omap_gpio_set(struct gpio *gpio, int value) { struct omap_gpio_bank *bank; @@ -231,7 +231,7 @@ omap_gpio_set(struct gpio *gpio, int value) return OK; } -int +static int omap_gpio_read(struct gpio *gpio, int *value) { struct omap_gpio_bank *bank; @@ -256,7 +256,7 @@ omap_gpio_read(struct gpio *gpio, int *value) return OK; } -int +static int omap_gpio_intr_read(struct gpio *gpio, int *value) { struct omap_gpio_bank *bank; @@ -273,7 +273,7 @@ omap_gpio_intr_read(struct gpio *gpio, int *value) return OK; } -int +static int omap_message_hook(message * m) { unsigned long irq_set, i; @@ -312,8 +312,8 @@ omap_message_hook(message * m) return OK; } -int -omap_gpio_init(struct gpio_driver *drv) +static int +omap_gpio_init(struct gpio_driver *gpdrv) { u32_t revision; int i; @@ -382,12 +382,12 @@ omap_gpio_init(struct gpio_driver *drv) clkconf_release(); - drv->claim = omap_gpio_claim; - drv->pin_mode = omap_gpio_pin_mode; - drv->set = omap_gpio_set; - drv->read = omap_gpio_read; - drv->intr_read = omap_gpio_intr_read; - drv->message_hook = omap_message_hook; + gpdrv->claim = omap_gpio_claim; + gpdrv->pin_mode = omap_gpio_pin_mode; + gpdrv->set = omap_gpio_set; + gpdrv->read = omap_gpio_read; + gpdrv->intr_read = omap_gpio_intr_read; + gpdrv->message_hook = omap_message_hook; return 0; } @@ -440,7 +440,7 @@ gpio_intr_message(message * m) } int -gpio_release() +gpio_release(void) { return OK; } 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/lib/libsys/env_panic.c b/lib/libsys/env_panic.c index a1622fef4..23c789a76 100644 --- a/lib/libsys/env_panic.c +++ b/lib/libsys/env_panic.c @@ -13,7 +13,6 @@ char *key; /* environment variable whose value is bogus */ if (s != ESRCH) /* only error allowed */ printf("WARNING: env_get_param() failed in env_panic(): %d\n", s); } - printf("Bad environment setting: '%s = %s'\n", key, value); - panic(""); + panic("Bad environment setting: '%s = %s'\n", key, value); } 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/link.c b/servers/ext2/link.c index 831099b4c..53f57a5fd 100644 --- a/servers/ext2/link.c +++ b/servers/ext2/link.c @@ -308,7 +308,7 @@ int fs_rename() struct inode *new_superdirp, *next_new_superdirp; int r = OK; /* error flag; initially no error */ int odir, ndir; /* TRUE iff {old|new} file is dir */ - int same_pdir; /* TRUE iff parent dirs are the same */ + int same_pdir = 0; /* TRUE iff parent dirs are the same */ char old_name[NAME_MAX + 1], new_name[NAME_MAX + 1]; ino_t numb; phys_bytes len; 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/pm/signal.c b/servers/pm/signal.c index acf7a4785..43122caab 100644 --- a/servers/pm/signal.c +++ b/servers/pm/signal.c @@ -327,8 +327,7 @@ int ksig; /* non-zero means signal comes from kernel */ slot = (int) (rmp - mproc); if ((rmp->mp_flags & (IN_USE | EXITING)) != IN_USE) { - printf("PM: signal %d sent to exiting process %d\n", signo, slot); - panic(""); + panic("PM: signal %d sent to exiting process %d\n", signo, slot); } #if USE_TRACE 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/sys/dev/videomode/pickmode.c b/sys/dev/videomode/pickmode.c index 2cd9a45b1..9dd67340c 100644 --- a/sys/dev/videomode/pickmode.c +++ b/sys/dev/videomode/pickmode.c @@ -35,6 +35,8 @@ __KERNEL_RCSID(0, "$NetBSD: pickmode.c,v 1.4 2011/04/09 20:53:39 christos Exp $" #include #ifndef __minix #include "opt_videomode.h" +#else +#include #endif #ifndef abs #define abs(x) (((x) < 0) ? -(x) : (x)) diff --git a/sys/sys/ucred.h b/sys/sys/ucred.h index ac0a887ca..3ab646258 100644 --- a/sys/sys/ucred.h +++ b/sys/sys/ucred.h @@ -59,4 +59,9 @@ struct uucred { gid_t cr_groups[NGROUPS_MAX]; /* groups */ }; +#ifdef __minix +#include +int getnucred(endpoint_t proc_ep, struct ucred *ucred); +#endif + #endif /* !_SYS_UCRED_H_ */ diff --git a/tests/Makefile.inc b/tests/Makefile.inc index 8b51b17d7..ab86d8305 100644 --- a/tests/Makefile.inc +++ b/tests/Makefile.inc @@ -1,3 +1,6 @@ # $NetBSD: Makefile.inc,v 1.2 2011/09/16 16:30:18 joerg Exp $ WARNS ?= 4 CWARNFLAGS+= -Wno-missing-noreturn + +NOGCCERROR=yes +NOCLANGERROR=yes 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..b82c69157 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; + const struct tp *p1 = (const struct tp *) v1, + *p2 = (const struct tp *) 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 -- 2.44.0