From: Lawrence S. <ljs...@us...> - 2015-03-22 01:00:24
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via f6fff5b01226552134fdb0d942fa8ec7459427b0 (commit) from 32dda8aef0bccf0fab879eb8975139a492433874 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f6fff5b01226552134fdb0d942fa8ec7459427b0 Author: Lawrence Sebald <ljs...@us...> Date: Sat Mar 21 20:54:15 2015 -0400 Clean up all the warnings I care to clean up that are reported with -pedantic. Also, clean up a few other warnings that somehow snuck their way past the last warning cleanup pass. The rest of the warnings currently reported with -pedantic either would require a lot of work to clean up or would just make the code needlessly ugly. This commit cleans up warnings like the following: warning: ISO C forbids an empty translation unit [-pedantic] warning: ISO C does not permit named variadic macros [-Wvariadic-macros] warning: format â%pâ expects argument of type âvoid *â, but argument 3 has type âstruct kthread_t *â [-Wformat] warning: ISO C forbids zero-size array âdataâ [-pedantic] warning: pointer of type âvoid *â used in arithmetic [-pedantic] warning: obsolete use of designated initializer with â:â [-pedantic] warning: initialization discards âconstâ qualifier from pointer target type [enabled by default] It does *not* clean up warnings like these: warning: type of bit-field âblankâ is a GCC extension [-pedantic] warning: ISO C forbids braced-groups within expressions [-pedantic] warning: ISO C forbids conversion of object pointer to function pointer type [-pedantic] ----------------------------------------------------------------------- Summary of changes: addons/libkosutils/netcfg.c | 2 +- environ_base.sh | 6 +- kernel/arch/dreamcast/fs/fs_dclsocket.c | 7 ++- kernel/arch/dreamcast/hardware/maple/controller.c | 16 ++----- kernel/arch/dreamcast/hardware/maple/dreameye.c | 15 ++----- kernel/arch/dreamcast/hardware/maple/keyboard.c | 12 +++--- kernel/arch/dreamcast/hardware/maple/mouse.c | 16 ++----- kernel/arch/dreamcast/hardware/maple/purupuru.c | 16 ++----- kernel/arch/dreamcast/hardware/maple/sip.c | 15 ++----- kernel/arch/dreamcast/hardware/maple/vmu.c | 15 ++----- kernel/arch/dreamcast/hardware/sq.c | 2 +- kernel/arch/dreamcast/include/dc/maple.h | 2 +- kernel/arch/dreamcast/kernel/mm.c | 4 +- kernel/arch/dreamcast/sound/arm/aica_cmd_iface.h | 44 ++++++++++---------- kernel/libc/koslib/Makefile | 9 ++++- kernel/thread/thread.c | 3 +- 16 files changed, 79 insertions(+), 105 deletions(-) diff --git a/addons/libkosutils/netcfg.c b/addons/libkosutils/netcfg.c index 5c3371a..8a94fab 100644 --- a/addons/libkosutils/netcfg.c +++ b/addons/libkosutils/netcfg.c @@ -18,7 +18,7 @@ #if 0 #define dbgp printf #else -#define dbgp(x...) +#define dbgp(...) #endif void netcfg_vmuify(const char *filename_in, const char *filename_out) { diff --git a/environ_base.sh b/environ_base.sh index c588887..b76b6a8 100644 --- a/environ_base.sh +++ b/environ_base.sh @@ -33,9 +33,9 @@ export KOS_CPPFLAGS="${KOS_CPPFLAGS} ${KOS_INC_PATHS_CPP} -fno-operator-names -f export KOS_CSTD="-std=c99" export KOS_CPPSTD="-std=gnu++98" -GCCVER="`kos-cc -v 2>&1 | tail -1 | awk '{print $3}'`" +export KOS_GCCVER="`kos-cc -v 2>&1 | tail -1 | awk '{print $3}'`" -case $GCCVER in +case $KOS_GCCVER in 4*) export KOS_LDFLAGS="${KOS_LDFLAGS} ${KOS_LD_SCRIPT} -nodefaultlibs ${KOS_LIB_PATHS}" ;; *) @@ -45,7 +45,7 @@ esac # Some extra vars based on architecture export KOS_ARCH_DIR="${KOS_BASE}/kernel/arch/${KOS_ARCH}" -case $GCCVER in +case $KOS_GCCVER in 4*) export KOS_START="" ;; *) diff --git a/kernel/arch/dreamcast/fs/fs_dclsocket.c b/kernel/arch/dreamcast/fs/fs_dclsocket.c index d4c94f5..5f428f8 100644 --- a/kernel/arch/dreamcast/fs/fs_dclsocket.c +++ b/kernel/arch/dreamcast/fs/fs_dclsocket.c @@ -44,7 +44,7 @@ typedef struct { unsigned char id[4]; unsigned int address; unsigned int size; - unsigned char data[0]; + unsigned char data[]; } PACKED command_t; typedef struct { @@ -385,6 +385,7 @@ static ssize_t dcls_write(void *hnd, const void *buf, size_t cnt) { } static off_t dcls_seek(void *hnd, off_t offset, int whence) { + uint32 fd = (uint32)hnd; int locked; command_3int_t *command = (command_3int_t *)pktbuf; @@ -401,10 +402,10 @@ static off_t dcls_seek(void *hnd, off_t offset, int whence) { mutex_lock(&mutex); } - --hnd; + --fd; memcpy(command->id, "DC11", 4); - command->value0 = htonl((uint32)hnd); + command->value0 = htonl(fd); command->value1 = htonl((uint32)offset); command->value2 = htonl((uint32)whence); diff --git a/kernel/arch/dreamcast/hardware/maple/controller.c b/kernel/arch/dreamcast/hardware/maple/controller.c index a1830be..4fc7cc7 100644 --- a/kernel/arch/dreamcast/hardware/maple/controller.c +++ b/kernel/arch/dreamcast/hardware/maple/controller.c @@ -99,16 +99,11 @@ static void cont_periodic(maple_driver_t *drv) { /* Device Driver Struct */ static maple_driver_t controller_drv = { -functions: - MAPLE_FUNC_CONTROLLER, -name: "Controller Driver" - , -periodic: - cont_periodic, -attach: - NULL, -detach: - NULL + .functions = MAPLE_FUNC_CONTROLLER, + .name = "Controller Driver", + .periodic = cont_periodic, + .attach = NULL, + .detach = NULL }; /* Add the controller to the driver chain */ @@ -119,4 +114,3 @@ int cont_init() { void cont_shutdown() { maple_driver_unreg(&controller_drv); } - diff --git a/kernel/arch/dreamcast/hardware/maple/dreameye.c b/kernel/arch/dreamcast/hardware/maple/dreameye.c index ef48079..d76cd90 100644 --- a/kernel/arch/dreamcast/hardware/maple/dreameye.c +++ b/kernel/arch/dreamcast/hardware/maple/dreameye.c @@ -422,16 +422,11 @@ static int dreameye_attach(maple_driver_t *drv, maple_device_t *dev) { /* Device Driver Struct */ static maple_driver_t dreameye_drv = { -functions: - MAPLE_FUNC_CAMERA, -name: "Dreameye (Camera)" - , -periodic: - dreameye_periodic, -attach: - dreameye_attach, -detach: - NULL + .functions = MAPLE_FUNC_CAMERA, + .name = "Dreameye (Camera)", + .periodic = dreameye_periodic, + .attach = dreameye_attach, + .detach = NULL }; /* Add the Dreameye to the driver chain */ diff --git a/kernel/arch/dreamcast/hardware/maple/keyboard.c b/kernel/arch/dreamcast/hardware/maple/keyboard.c index 5c9f674..c391af5 100644 --- a/kernel/arch/dreamcast/hardware/maple/keyboard.c +++ b/kernel/arch/dreamcast/hardware/maple/keyboard.c @@ -343,7 +343,7 @@ static int kbd_attach(maple_driver_t *drv, maple_device_t *dev) { if(f & 0x80000000) { ++d; } - + f <<= 1; tmp <<= 1; } @@ -362,11 +362,11 @@ static int kbd_attach(maple_driver_t *drv, maple_device_t *dev) { /* Device driver struct */ static maple_driver_t kbd_drv = { - functions: MAPLE_FUNC_KEYBOARD, - name: "Keyboard Driver", - periodic: kbd_periodic, - attach: kbd_attach, - detach: NULL + .functions = MAPLE_FUNC_KEYBOARD, + .name = "Keyboard Driver", + .periodic = kbd_periodic, + .attach = kbd_attach, + .detach = NULL }; /* Add the keyboard to the driver chain */ diff --git a/kernel/arch/dreamcast/hardware/maple/mouse.c b/kernel/arch/dreamcast/hardware/maple/mouse.c index bee7706..9a4bea4 100644 --- a/kernel/arch/dreamcast/hardware/maple/mouse.c +++ b/kernel/arch/dreamcast/hardware/maple/mouse.c @@ -71,16 +71,11 @@ static void mouse_periodic(maple_driver_t *drv) { /* Device Driver Struct */ static maple_driver_t mouse_drv = { -functions: - MAPLE_FUNC_MOUSE, -name: "Mouse Driver" - , -periodic: - mouse_periodic, -attach: - NULL, -detach: - NULL + .functions = MAPLE_FUNC_MOUSE, + .name = "Mouse Driver", + .periodic = mouse_periodic, + .attach = NULL, + .detach = NULL }; /* Add the mouse to the driver chain */ @@ -91,4 +86,3 @@ int mouse_init() { void mouse_shutdown() { maple_driver_unreg(&mouse_drv); } - diff --git a/kernel/arch/dreamcast/hardware/maple/purupuru.c b/kernel/arch/dreamcast/hardware/maple/purupuru.c index 70647a5..6aaa590 100644 --- a/kernel/arch/dreamcast/hardware/maple/purupuru.c +++ b/kernel/arch/dreamcast/hardware/maple/purupuru.c @@ -112,16 +112,11 @@ static int purupuru_attach(maple_driver_t *drv, maple_device_t *dev) { /* Device Driver Struct */ static maple_driver_t purupuru_drv = { -functions: - MAPLE_FUNC_PURUPURU, -name: "PuruPuru (Vibration) Pack" - , -periodic: - purupuru_periodic, -attach: - purupuru_attach, -detach: - NULL + .functions = MAPLE_FUNC_PURUPURU, + .name = "PuruPuru (Vibration) Pack", + .periodic = purupuru_periodic, + .attach = purupuru_attach, + .detach = NULL }; /* Add the mouse to the driver chain */ @@ -132,4 +127,3 @@ int purupuru_init() { void purupuru_shutdown() { maple_driver_unreg(&purupuru_drv); } - diff --git a/kernel/arch/dreamcast/hardware/maple/sip.c b/kernel/arch/dreamcast/hardware/maple/sip.c index 80897eb..7bcab0d 100644 --- a/kernel/arch/dreamcast/hardware/maple/sip.c +++ b/kernel/arch/dreamcast/hardware/maple/sip.c @@ -289,16 +289,11 @@ static int sip_attach(maple_driver_t *drv, maple_device_t *dev) { /* Device Driver Struct */ static maple_driver_t sip_drv = { -functions: - MAPLE_FUNC_MICROPHONE, -name: "Sound Input Peripheral" - , -periodic: - sip_periodic, -attach: - sip_attach, -detach: - NULL + .functions = MAPLE_FUNC_MICROPHONE, + .name = "Sound Input Peripheral", + .periodic = sip_periodic, + .attach = sip_attach, + .detach = NULL }; /* Add the SIP to the driver chain */ diff --git a/kernel/arch/dreamcast/hardware/maple/vmu.c b/kernel/arch/dreamcast/hardware/maple/vmu.c index 2a02901..c916ab7 100644 --- a/kernel/arch/dreamcast/hardware/maple/vmu.c +++ b/kernel/arch/dreamcast/hardware/maple/vmu.c @@ -29,16 +29,11 @@ static int vmu_attach(maple_driver_t *drv, maple_device_t *dev) { /* Device Driver Struct */ static maple_driver_t vmu_drv = { -functions: - MAPLE_FUNC_MEMCARD | MAPLE_FUNC_LCD | MAPLE_FUNC_CLOCK, -name: "VMU Driver" - , -periodic: - NULL, -attach: - vmu_attach, -detach: - NULL + .functions = MAPLE_FUNC_MEMCARD | MAPLE_FUNC_LCD | MAPLE_FUNC_CLOCK, + .name = "VMU Driver", + .periodic = NULL, + .attach = vmu_attach, + .detach = NULL }; /* Add the VMU to the driver chain */ diff --git a/kernel/arch/dreamcast/hardware/sq.c b/kernel/arch/dreamcast/hardware/sq.c index e1cc8e0..c6c89d4 100644 --- a/kernel/arch/dreamcast/hardware/sq.c +++ b/kernel/arch/dreamcast/hardware/sq.c @@ -42,7 +42,7 @@ void sq_clr(void *dest, int n) { void * sq_cpy(void *dest, const void *src, int n) { unsigned int *d = (unsigned int *)(void *) (0xe0000000 | (((unsigned long)dest) & 0x03ffffe0)); - unsigned int *s = src; + const unsigned int *s = src; /* Set store queue memory area as desired */ QACR0 = ((((unsigned int)dest) >> 26) << 2) & 0x1c; diff --git a/kernel/arch/dreamcast/include/dc/maple.h b/kernel/arch/dreamcast/include/dc/maple.h index df38519..b8d0ec9 100644 --- a/kernel/arch/dreamcast/include/dc/maple.h +++ b/kernel/arch/dreamcast/include/dc/maple.h @@ -224,7 +224,7 @@ typedef struct maple_response { uint8 dst_addr; /**< \brief Destination address */ uint8 src_addr; /**< \brief Source address */ uint8 data_len; /**< \brief Data length (in 32-bit words) */ - uint8 data[0]; /**< \brief Data (if any) */ + uint8 data[]; /**< \brief Data (if any) */ } maple_response_t; /** \brief One maple device. diff --git a/kernel/arch/dreamcast/kernel/mm.c b/kernel/arch/dreamcast/kernel/mm.c index 8562e9e..ad10ecb 100644 --- a/kernel/arch/dreamcast/kernel/mm.c +++ b/kernel/arch/dreamcast/kernel/mm.c @@ -44,7 +44,7 @@ void* mm_sbrk(unsigned long increment) { if(increment & 3) increment = (increment + 4) & ~3; - sbrk_base += increment; + sbrk_base = (void *)(increment + (unsigned long)sbrk_base); if(((uint32)sbrk_base) >= (0x8d000000 - 65536)) { dbglog(DBG_DEAD, "Requested sbrk_base %p, was %p, diff %lu\n", @@ -56,5 +56,3 @@ void* mm_sbrk(unsigned long increment) { return base; } - - diff --git a/kernel/arch/dreamcast/sound/arm/aica_cmd_iface.h b/kernel/arch/dreamcast/sound/arm/aica_cmd_iface.h index d4c2d61..aba0a51 100644 --- a/kernel/arch/dreamcast/sound/arm/aica_cmd_iface.h +++ b/kernel/arch/dreamcast/sound/arm/aica_cmd_iface.h @@ -21,22 +21,22 @@ typedef unsigned long uint32; head point and the queue size, the command will wrap around to the beginning (i.e., queue commands _can_ be split up). */ typedef struct aica_queue { - uint32 head; /* Insertion point offset (in bytes) */ - uint32 tail; /* Removal point offset (in bytes) */ - uint32 size; /* Queue size (in bytes) */ + uint32 head; /* Insertion point offset (in bytes) */ + uint32 tail; /* Removal point offset (in bytes) */ + uint32 size; /* Queue size (in bytes) */ uint32 valid; /* 1 if the queue structs are valid */ uint32 process_ok; /* 1 if it's ok to process the data */ - uint32 data; /* Pointer to queue data buffer */ + uint32 data; /* Pointer to queue data buffer */ } aica_queue_t; /* Command queue struct for commanding the AICA from the SH-4 */ typedef struct aica_cmd { - uint32 size; /* Command data size in dwords */ - uint32 cmd; /* Command ID */ - uint32 timestamp; /* When to execute the command (0 == now) */ - uint32 cmd_id; /* Command ID, for cmd/response pairs, or channel id */ - uint32 misc[4]; /* Misc Parameters / Padding */ - uint8 cmd_data[0]; /* Command data */ + uint32 size; /* Command data size in dwords */ + uint32 cmd; /* Command ID */ + uint32 timestamp; /* When to execute the command (0 == now) */ + uint32 cmd_id; /* Command ID, for cmd/response pairs, or channel id */ + uint32 misc[4]; /* Misc Parameters / Padding */ + uint8 cmd_data[]; /* Command data */ } aica_cmd_t; /* Maximum command size -- 256 dwords */ @@ -45,18 +45,18 @@ typedef struct aica_cmd { /* This is the cmd_data for AICA_CMD_CHAN. Make this 16 dwords long for two aica bus queues. */ typedef struct aica_channel { - uint32 cmd; /* Command ID */ - uint32 base; /* Sample base in RAM */ - uint32 type; /* (8/16bit/ADPCM) */ - uint32 length; /* Sample length */ - uint32 loop; /* Sample looping */ - uint32 loopstart; /* Sample loop start */ - uint32 loopend; /* Sample loop end */ - uint32 freq; /* Frequency */ - uint32 vol; /* Volume 0-255 */ - uint32 pan; /* Pan 0-255 */ - uint32 pos; /* Sample playback pos */ - uint32 pad[5]; /* Padding */ + uint32 cmd; /* Command ID */ + uint32 base; /* Sample base in RAM */ + uint32 type; /* (8/16bit/ADPCM) */ + uint32 length; /* Sample length */ + uint32 loop; /* Sample looping */ + uint32 loopstart; /* Sample loop start */ + uint32 loopend; /* Sample loop end */ + uint32 freq; /* Frequency */ + uint32 vol; /* Volume 0-255 */ + uint32 pan; /* Pan 0-255 */ + uint32 pos; /* Sample playback pos */ + uint32 pad[5]; /* Padding */ } aica_channel_t; /* Declare an aica_cmd_t big enough to hold an aica_channel_t diff --git a/kernel/libc/koslib/Makefile b/kernel/libc/koslib/Makefile index d7c9878..6fdc05f 100644 --- a/kernel/libc/koslib/Makefile +++ b/kernel/libc/koslib/Makefile @@ -8,11 +8,18 @@ # useful in the context of KOS to go with the Newlib defaults. OBJS = abort.o byteorder.o memset2.o memset4.o memcpy2.o memcpy4.o \ - assert.o dbglog.o malloc.o crtbegin.o crtend.o atexit.o \ + assert.o dbglog.o malloc.o atexit.o \ opendir.o readdir.o closedir.o rewinddir.o scandir.o seekdir.o \ telldir.o usleep.o inet_addr.o realpath.o getcwd.o chdir.o mkdir.o \ creat.o sleep.o rmdir.o rename.o inet_pton.o inet_ntop.o \ inet_ntoa.o inet_aton.o poll.o select.o symlink.o readlink.o \ gethostbyname.o getaddrinfo.o dirfd.o nanosleep.o +GCC_MAJORMINOR = $(basename $(KOS_GCCVER)) +GCC_MAJOR = $(basename $(GCC_MAJORMINOR)) + +ifneq ($(strip $(GCC_MAJOR)), 4) +OBJS += crtbegin.o crtend.o +endif + include $(KOS_BASE)/Makefile.prefab diff --git a/kernel/thread/thread.c b/kernel/thread/thread.c index c3ba166..d65af39 100644 --- a/kernel/thread/thread.c +++ b/kernel/thread/thread.c @@ -654,7 +654,8 @@ int thd_join(kthread_t * thd, void **value_ptr) { return -1; if(irq_inside_int()) { - dbglog(DBG_WARNING, "thd_join(%p) called inside an interrupt!\n", thd); + dbglog(DBG_WARNING, "thd_join(%p) called inside an interrupt!\n", + (void *)thd); return -1; } hooks/post-receive -- A pseudo Operating System for the Dreamcast. |