From f370d70670bd5e30befe6fbfbc8d472e760f032b Mon Sep 17 00:00:00 2001 From: oharboe Date: Tue, 5 Aug 2008 12:27:18 +0000 Subject: Duane Ellis: fix warnings git-svn-id: svn://svn.berlios.de/openocd/trunk@890 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- configure.in | 14 +++++++++++++- src/flash/flash.c | 2 +- src/flash/flash.h | 2 +- src/helper/command.h | 2 +- src/helper/log.h | 4 ++-- src/helper/time_support.h | 2 +- src/jtag/amt_jtagaccel.c | 2 +- src/jtag/gw16012.c | 4 ++-- src/jtag/jtag.c | 6 +++--- src/jtag/jtag.h | 4 ++-- src/main.c | 4 ++-- src/server/gdb_server.c | 2 +- src/server/gdb_server.h | 2 +- src/server/server.c | 10 +++++----- src/server/server.h | 4 ++-- src/target/arm11.c | 2 +- src/target/arm720t.c | 4 ++-- src/target/arm7tdmi.c | 4 ++-- src/target/arm920t.c | 4 ++-- src/target/arm926ejs.c | 4 ++-- src/target/arm9tdmi.c | 4 ++-- src/target/cortex_m3.c | 4 ++-- src/target/feroceon.c | 5 +++-- src/target/mips32_pracc.c | 1 + src/target/mips_m4k.c | 6 +++--- src/target/target.c | 6 +++--- src/target/target.h | 4 ++-- src/target/xscale.c | 6 +++--- 28 files changed, 66 insertions(+), 52 deletions(-) diff --git a/configure.in b/configure.in index 8f9b56f3..2c2f3cde 100644 --- a/configure.in +++ b/configure.in @@ -27,6 +27,12 @@ is_cygwin=no is_mingw=no is_win32=no + +AC_ARG_ENABLE(gccwarnings, + AS_HELP_STRING([--enable-gccwarnings], [Enable compiler warnings, default yes]), + [gcc_warnings=$enablevalue], [gcc_warnings=yes]) + + AC_ARG_ENABLE(parport, AS_HELP_STRING([--enable-parport], [Enable building the pc parallel port driver]), [build_parport=$enableval], [build_parport=no]) @@ -298,11 +304,17 @@ if test $cross_compiling = yes; then CFLAGS_FOR_BUILD="-g -O2" else CC_FOR_BUILD=$CC - CFLAGS_FOR_BUILD=$CFLAGS + CFLAGS_FOR_BUILD="$CFLAGS $GCC_WARNINGS" fi + +if test $gcc_warnings = yes; then + CFLAGS_FOR_BUILD="$CFLAGS_FOR_BUILD -Wall -Wmissing-prototypes -Wstrict-prototypes" +fi + AC_MSG_RESULT([$CC_FOR_BUILD]) AC_SUBST(CC_FOR_BUILD) AC_SUBST(CFLAGS_FOR_BUILD) +AC_MSG_NOTICE([CFLAGS_FOR_BUILD = $CFLAGS_FOR_BUILD]) AC_MSG_CHECKING([for suffix of executable build tools]) if test $cross_compiling = yes; then diff --git a/src/flash/flash.c b/src/flash/flash.c index 95a983b7..71d054f5 100644 --- a/src/flash/flash.c +++ b/src/flash/flash.c @@ -233,7 +233,7 @@ flash_bank_t *get_flash_bank_by_num_noprobe(int num) return NULL; } -int flash_get_bank_count() +int flash_get_bank_count(void) { flash_bank_t *p; int i = 0; diff --git a/src/flash/flash.h b/src/flash/flash.h index 807914ad..1f5ee9b3 100644 --- a/src/flash/flash.h +++ b/src/flash/flash.h @@ -80,7 +80,7 @@ extern int flash_init_drivers(struct command_context_s *cmd_ctx); extern int flash_erase_address_range(target_t *target, u32 addr, u32 length); extern int flash_write(target_t *target, image_t *image, u32 *written, int erase); extern void flash_set_dirty(void); -extern int flash_get_bank_count(); +extern int flash_get_bank_count(void); extern int default_flash_blank_check(struct flash_bank_s *bank); extern int default_flash_mem_blank_check(struct flash_bank_s *bank); diff --git a/src/helper/command.h b/src/helper/command.h index d784af76..097a8d37 100644 --- a/src/helper/command.h +++ b/src/helper/command.h @@ -71,7 +71,7 @@ extern int unregister_all_commands(command_context_t *context); extern void command_set_output_handler(command_context_t* context, int (*output_handler)(struct command_context_s *context, const char* line), void *priv); extern command_context_t* copy_command_context(command_context_t* context); extern int command_context_mode(command_context_t *context, enum command_mode mode); -extern command_context_t* command_init(); +extern command_context_t* command_init(void); extern int command_done(command_context_t *context); extern void command_print(command_context_t *context, char *format, ...); extern void command_print_sameline(command_context_t *context, char *format, ...); diff --git a/src/helper/log.h b/src/helper/log.h index f57ed080..c329fb58 100644 --- a/src/helper/log.h +++ b/src/helper/log.h @@ -59,8 +59,8 @@ __attribute__ ((format (printf, 5, 6))); extern int log_register_commands(struct command_context_s *cmd_ctx); extern int log_init(struct command_context_s *cmd_ctx); extern int set_log_output(struct command_context_s *cmd_ctx, FILE *output); -extern void keep_alive(); -extern void kept_alive(); +extern void keep_alive(void); +extern void kept_alive(void); typedef void (*log_callback_fn)(void *priv, const char *file, int line, const char *function, const char *string); diff --git a/src/helper/time_support.h b/src/helper/time_support.h index 49c41c9d..0407a1c3 100644 --- a/src/helper/time_support.h +++ b/src/helper/time_support.h @@ -38,7 +38,7 @@ extern int timeval_subtract(struct timeval *result, struct timeval *x, struct ti extern int timeval_add(struct timeval *result, struct timeval *x, struct timeval *y); extern int timeval_add_time(struct timeval *result, int sec, int usec); /* gettimeofday() timeval in 64 bit ms */ -extern long long timeval_ms(); +extern long long timeval_ms(void); typedef struct duration_s { diff --git a/src/jtag/amt_jtagaccel.c b/src/jtag/amt_jtagaccel.c index b94b6f76..d29d092f 100644 --- a/src/jtag/amt_jtagaccel.c +++ b/src/jtag/amt_jtagaccel.c @@ -166,7 +166,7 @@ void amt_jtagaccel_end_state(state) } } -void amt_wait_scan_busy() +void amt_wait_scan_busy(void) { int timeout = 4096; u8 ar_status; diff --git a/src/jtag/gw16012.c b/src/jtag/gw16012.c index 8c7dc81b..b964a23a 100644 --- a/src/jtag/gw16012.c +++ b/src/jtag/gw16012.c @@ -194,7 +194,7 @@ int gw16012_speed(int speed) return ERROR_OK; } -void gw16012_end_state(state) +void gw16012_end_state(int state) { if (tap_move_map[state] != -1) end_state = state; @@ -526,7 +526,7 @@ int gw16012_init(void) LOG_WARNING("No gw16012 port specified, using default '0x378' (LPT1)"); } - LOG_DEBUG("requesting privileges for parallel port 0x%lx...", gw16012_port); + LOG_DEBUG("requesting privileges for parallel port 0x%lx...", (long unsigned)(gw16012_port) ); #if PARPORT_USE_GIVEIO == 1 if (gw16012_get_giveio_access() != 0) #else /* PARPORT_USE_GIVEIO */ diff --git a/src/jtag/jtag.c b/src/jtag/jtag.c index 04b3892d..d34cec5a 100644 --- a/src/jtag/jtag.c +++ b/src/jtag/jtag.c @@ -401,7 +401,7 @@ void* cmd_queue_alloc(size_t size) return t + offset; } -void cmd_queue_free() +void cmd_queue_free(void) { cmd_queue_page_t *page = cmd_queue_pages; @@ -416,7 +416,7 @@ void cmd_queue_free() cmd_queue_pages = NULL; } -static void jtag_prelude1() +static void jtag_prelude1(void) { if (jtag_trst == 1) { @@ -1433,7 +1433,7 @@ int jtag_examine_chain() return ERROR_OK; } -int jtag_validate_chain() +int jtag_validate_chain(void) { jtag_device_t *device = jtag_devices; int total_ir_length = 0; diff --git a/src/jtag/jtag.h b/src/jtag/jtag.h index f3f354a3..347777e4 100644 --- a/src/jtag/jtag.h +++ b/src/jtag/jtag.h @@ -282,8 +282,8 @@ extern int interface_jtag_add_plain_dr_scan(int num_fields, scan_field_t *fields /* run a TAP_TLR reset. End state is TAP_TLR, regardless * of start state. */ -extern void jtag_add_tlr(); -extern int interface_jtag_add_tlr(); +extern void jtag_add_tlr(void); +extern int interface_jtag_add_tlr(void); /* Do not use jtag_add_pathmove() unless you need to, but do use it * if you have to. * diff --git a/src/main.c b/src/main.c index 616aacd4..b7be8970 100644 --- a/src/main.c +++ b/src/main.c @@ -21,11 +21,11 @@ /* implementations of OpenOCD that uses multithreading needs to know when * OpenOCD is sleeping. No-op in vanilla OpenOCD */ -void openocd_sleep_prelude() +void openocd_sleep_prelude(void) { } -void openocd_sleep_postlude() +void openocd_sleep_postlude(void) { } diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index 040c614f..62999538 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -2002,7 +2002,7 @@ int gdb_input(connection_t *connection) return ERROR_OK; } -int gdb_init() +int gdb_init(void) { gdb_service_t *gdb_service; target_t *target = targets; diff --git a/src/server/gdb_server.h b/src/server/gdb_server.h index e81ee694..943d9d97 100644 --- a/src/server/gdb_server.h +++ b/src/server/gdb_server.h @@ -46,7 +46,7 @@ typedef struct gdb_service_s struct target_s *target; } gdb_service_t; -extern int gdb_init(); +extern int gdb_init(void); extern int gdb_register_commands(command_context_t *command_context); #define ERROR_GDB_BUFFER_TOO_SMALL (-800) diff --git a/src/server/server.c b/src/server/server.c index 97762838..aad98747 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -222,7 +222,7 @@ int remove_service(unsigned short port) return ERROR_OK; } -int remove_services() +int remove_services(void) { service_t *c = services; @@ -249,8 +249,8 @@ int remove_services() return ERROR_OK; } -extern void openocd_sleep_prelude(); -extern void openocd_sleep_postlude(); +extern void openocd_sleep_prelude(void); +extern void openocd_sleep_postlude(void); int server_loop(command_context_t *command_context) { @@ -434,7 +434,7 @@ void sig_handler(int sig) { } #endif -int server_init() +int server_init(void) { #ifdef _WIN32 WORD wVersionRequested; @@ -460,7 +460,7 @@ int server_init() return ERROR_OK; } -int server_quit() +int server_quit(void) { remove_services(); diff --git a/src/server/server.h b/src/server/server.h index 95410e80..6f0ec3e3 100644 --- a/src/server/server.h +++ b/src/server/server.h @@ -68,8 +68,8 @@ typedef struct service_s } service_t; extern int add_service(char *name, enum connection_type type, unsigned short port, int max_connections, new_connection_handler_t new_connection_handler, input_handler_t input_handler, connection_closed_handler_t connection_closed_handler, void *priv); -extern int server_init(); -extern int server_quit(); +extern int server_init(void); +extern int server_quit(void); extern int server_loop(command_context_t *command_context); extern int server_register_commands(command_context_t *context); diff --git a/src/target/arm11.c b/src/target/arm11.c index 9e131d8b..7c947fc2 100644 --- a/src/target/arm11.c +++ b/src/target/arm11.c @@ -1716,7 +1716,7 @@ int arm11_handle_mrc_mcr(struct command_context_s *cmd_ctx, char *cmd, char **ar if (values[i] > arm11_coproc_instruction_limits[i]) { LOG_ERROR("Parameter %ld out of bounds (%d max). %s", - i + 2, arm11_coproc_instruction_limits[i], + (long)(i + 2), arm11_coproc_instruction_limits[i], read ? arm11_mrc_syntax : arm11_mcr_syntax); return -1; } diff --git a/src/target/arm720t.c b/src/target/arm720t.c index cc45c9e6..e253e8ee 100644 --- a/src/target/arm720t.c +++ b/src/target/arm720t.c @@ -43,7 +43,7 @@ int arm720t_handle_mw_phys_command(struct command_context_s *cmd_ctx, char *cmd, /* forward declarations */ int arm720t_target_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct target_s *target); int arm720t_init_target(struct command_context_s *cmd_ctx, struct target_s *target); -int arm720t_quit(); +int arm720t_quit(void); int arm720t_arch_state(struct target_s *target); int arm720t_read_memory(struct target_s *target, u32 address, u32 size, u32 count, u8 *buffer); int arm720t_write_memory(struct target_s *target, u32 address, u32 size, u32 count, u8 *buffer); @@ -423,7 +423,7 @@ int arm720t_init_target(struct command_context_s *cmd_ctx, struct target_s *targ } -int arm720t_quit() +int arm720t_quit(void) { return ERROR_OK; diff --git a/src/target/arm7tdmi.c b/src/target/arm7tdmi.c index 41771ab1..af6837e4 100644 --- a/src/target/arm7tdmi.c +++ b/src/target/arm7tdmi.c @@ -46,7 +46,7 @@ int arm7tdmi_register_commands(struct command_context_s *cmd_ctx); /* forward declarations */ int arm7tdmi_target_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct target_s *target); int arm7tdmi_init_target(struct command_context_s *cmd_ctx, struct target_s *target); -int arm7tdmi_quit(); +int arm7tdmi_quit(void); /* target function declarations */ int arm7tdmi_poll(struct target_s *target); @@ -753,7 +753,7 @@ int arm7tdmi_init_target(struct command_context_s *cmd_ctx, struct target_s *tar } -int arm7tdmi_quit() +int arm7tdmi_quit(void) { return ERROR_OK; diff --git a/src/target/arm920t.c b/src/target/arm920t.c index 3a3c2f1f..c14f6ef8 100644 --- a/src/target/arm920t.c +++ b/src/target/arm920t.c @@ -48,7 +48,7 @@ int arm920t_handle_read_mmu_command(struct command_context_s *cmd_ctx, char *cmd /* forward declarations */ int arm920t_target_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct target_s *target); int arm920t_init_target(struct command_context_s *cmd_ctx, struct target_s *target); -int arm920t_quit(); +int arm920t_quit(void); int arm920t_arch_state(struct target_s *target); int arm920t_read_memory(struct target_s *target, u32 address, u32 size, u32 count, u8 *buffer); int arm920t_write_memory(struct target_s *target, u32 address, u32 size, u32 count, u8 *buffer); @@ -685,7 +685,7 @@ int arm920t_init_target(struct command_context_s *cmd_ctx, struct target_s *targ } -int arm920t_quit() +int arm920t_quit(void) { return ERROR_OK; diff --git a/src/target/arm926ejs.c b/src/target/arm926ejs.c index 386d4471..cec3d0f8 100644 --- a/src/target/arm926ejs.c +++ b/src/target/arm926ejs.c @@ -48,7 +48,7 @@ int arm926ejs_handle_read_mmu_command(struct command_context_s *cmd_ctx, char *c /* forward declarations */ int arm926ejs_target_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct target_s *target); int arm926ejs_init_target(struct command_context_s *cmd_ctx, struct target_s *target); -int arm926ejs_quit(); +int arm926ejs_quit(void); int arm926ejs_arch_state(struct target_s *target); int arm926ejs_read_memory(struct target_s *target, u32 address, u32 size, u32 count, u8 *buffer); int arm926ejs_write_memory(struct target_s *target, u32 address, u32 size, u32 count, u8 *buffer); @@ -666,7 +666,7 @@ int arm926ejs_init_target(struct command_context_s *cmd_ctx, struct target_s *ta } -int arm926ejs_quit() +int arm926ejs_quit(void) { return ERROR_OK; diff --git a/src/target/arm9tdmi.c b/src/target/arm9tdmi.c index adb21f79..c6a13adb 100644 --- a/src/target/arm9tdmi.c +++ b/src/target/arm9tdmi.c @@ -48,7 +48,7 @@ int handle_arm9tdmi_catch_vectors_command(struct command_context_s *cmd_ctx, cha /* forward declarations */ int arm9tdmi_target_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct target_s *target); int arm9tdmi_init_target(struct command_context_s *cmd_ctx, struct target_s *target); -int arm9tdmi_quit(); +int arm9tdmi_quit(void); target_type_t arm9tdmi_target = { @@ -896,7 +896,7 @@ int arm9tdmi_init_target(struct command_context_s *cmd_ctx, struct target_s *tar } -int arm9tdmi_quit() +int arm9tdmi_quit(void) { return ERROR_OK; diff --git a/src/target/cortex_m3.c b/src/target/cortex_m3.c index 255fcd03..9e0916ff 100644 --- a/src/target/cortex_m3.c +++ b/src/target/cortex_m3.c @@ -47,7 +47,7 @@ void cortex_m3_enable_breakpoints(struct target_s *target); void cortex_m3_enable_watchpoints(struct target_s *target); int cortex_m3_target_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct target_s *target); int cortex_m3_init_target(struct command_context_s *cmd_ctx, struct target_s *target); -int cortex_m3_quit(); +int cortex_m3_quit(void); int cortex_m3_load_core_reg_u32(target_t *target, enum armv7m_regtype type, u32 num, u32 *value); int cortex_m3_store_core_reg_u32(target_t *target, enum armv7m_regtype type, u32 num, u32 value); int cortex_m3_target_request_data(target_t *target, u32 size, u8 *buffer); @@ -1374,7 +1374,7 @@ int cortex_m3_examine(struct target_s *target) return ERROR_OK; } -int cortex_m3_quit() +int cortex_m3_quit(void) { return ERROR_OK; diff --git a/src/target/feroceon.c b/src/target/feroceon.c index 8178e556..9c774716 100644 --- a/src/target/feroceon.c +++ b/src/target/feroceon.c @@ -58,7 +58,7 @@ int feroceon_examine(struct target_s *target); int feroceon_target_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct target_s *target); int feroceon_bulk_write_memory(target_t *target, u32 address, u32 count, u8 *buffer); int feroceon_init_target(struct command_context_s *cmd_ctx, struct target_s *target); -int feroceon_quit(); +int feroceon_quit(void); target_type_t feroceon_target = { @@ -381,6 +381,7 @@ void feroceon_branch_resume_thumb(target_t *target) arm_jtag_t *jtag_info = &arm7_9->jtag_info; u32 r0 = buf_get_u32(armv4_5->core_cache->reg_list[0].value, 0, 32); u32 pc = buf_get_u32(armv4_5->core_cache->reg_list[15].value, 0, 32); + (void)(r0); // use R0... arm9tdmi_clock_out(jtag_info, ARMV4_5_NOP, 0, NULL, 0); arm9tdmi_clock_out(jtag_info, ARMV4_5_NOP, 0, NULL, 0); @@ -627,7 +628,7 @@ int feroceon_init_target(struct command_context_s *cmd_ctx, struct target_s *tar return ERROR_OK; } -int feroceon_quit() +int feroceon_quit(void) { return ERROR_OK; } diff --git a/src/target/mips32_pracc.c b/src/target/mips32_pracc.c index 400227e9..d6351f9e 100644 --- a/src/target/mips32_pracc.c +++ b/src/target/mips32_pracc.c @@ -23,6 +23,7 @@ #include "config.h" #endif +#include #include "log.h" #include "mips32.h" #include "mips32_pracc.h" diff --git a/src/target/mips_m4k.c b/src/target/mips_m4k.c index 2a34bd0b..4cefbf92 100644 --- a/src/target/mips_m4k.c +++ b/src/target/mips_m4k.c @@ -46,7 +46,7 @@ int mips_m4k_init_target(struct command_context_s *cmd_ctx, struct target_s *tar int mips_m4k_quit(); int mips_m4k_target_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct target_s *target); -int mips_m4k_examine(struct target_s *target); +int mips_m4k_examine(struct command_context_s *cmd_ctx, struct target_s *target); int mips_m4k_assert_reset(target_t *target); int mips_m4k_deassert_reset(target_t *target); @@ -569,7 +569,7 @@ int mips_m4k_init_target(struct command_context_s *cmd_ctx, struct target_s *tar return ERROR_OK; } -int mips_m4k_quit() +int mips_m4k_quit(void) { return ERROR_OK; } @@ -618,7 +618,7 @@ int mips_m4k_target_command(struct command_context_s *cmd_ctx, char *cmd, char * return ERROR_OK; } -int mips_m4k_examine(struct target_s *target) +int mips_m4k_examine(struct command_context_s *cmd_ctx, struct target_s *target) { int retval; mips32_common_t *mips32 = target->arch_info; diff --git a/src/target/target.c b/src/target/target.c index 0950e436..37e1b369 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -666,15 +666,15 @@ static int target_call_timer_callbacks_check_time(int checktime) return ERROR_OK; } -int target_call_timer_callbacks() +int target_call_timer_callbacks(void) { return target_call_timer_callbacks_check_time(1); } /* invoke periodic callbacks immediately */ -int target_call_timer_callbacks_now() +int target_call_timer_callbacks_now(void) { - return target_call_timer_callbacks(0); + return target_call_timer_callbacks(); } int target_alloc_working_area(struct target_s *target, u32 size, working_area_t **area) diff --git a/src/target/target.h b/src/target/target.h index 8673ddc0..2551ede7 100644 --- a/src/target/target.h +++ b/src/target/target.h @@ -266,11 +266,11 @@ extern int target_call_event_callbacks(target_t *target, enum target_event event */ extern int target_register_timer_callback(int (*callback)(void *priv), int time_ms, int periodic, void *priv); extern int target_unregister_timer_callback(int (*callback)(void *priv), void *priv); -extern int target_call_timer_callbacks(); +extern int target_call_timer_callbacks(void); /* invoke this to ensure that e.g. polling timer callbacks happen before * a syncrhonous command completes. */ -extern int target_call_timer_callbacks_now(); +extern int target_call_timer_callbacks_now(void); extern target_t* get_current_target(struct command_context_s *cmd_ctx); extern int get_num_by_target(target_t *query_target); diff --git a/src/target/xscale.c b/src/target/xscale.c index 0c99abf7..39378c01 100644 --- a/src/target/xscale.c +++ b/src/target/xscale.c @@ -55,7 +55,7 @@ int xscale_register_commands(struct command_context_s *cmd_ctx); /* forward declarations */ int xscale_target_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct target_s *target); int xscale_init_target(struct command_context_s *cmd_ctx, struct target_s *target); -int xscale_quit(); +int xscale_quit(void); int xscale_arch_state(struct target_s *target); int xscale_poll(target_t *target); @@ -1579,7 +1579,7 @@ int xscale_assert_reset(target_t *target) jtag_execute_queue(); target->state = TARGET_RESET; - + if (target->reset_halt) { int retval; @@ -2989,7 +2989,7 @@ int xscale_init_target(struct command_context_s *cmd_ctx, struct target_s *targe return ERROR_OK; } -int xscale_quit() +int xscale_quit(void) { return ERROR_OK; -- cgit v1.2.3