From 1c1fa836b9e5538bc72fbf10cb12c279b767f528 Mon Sep 17 00:00:00 2001 From: Rutger Hofman Date: Wed, 22 Apr 2009 12:07:05 +0000 Subject: [PATCH] Enable -Wmissing-prototypes git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1514 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- urjtag/configure.ac | 2 +- urjtag/include/fclock.h | 14 +++++++--- urjtag/src/bus/ejtag_dma.c | 18 ++++++------- urjtag/src/flash/detectflash.c | 8 ++---- urjtag/src/flash/jedec.c | 2 ++ urjtag/src/flash/jedec.h | 37 ++++++++++++++++++++++++++ urjtag/src/lib/fclock.c | 10 ++++--- urjtag/src/svf/svf.c | 7 +++++ urjtag/src/svf/svf_flex.l | 1 + urjtag/src/tap/cable/generic.c | 4 +-- urjtag/src/tap/cable/generic_parport.c | 2 +- urjtag/src/tap/cable/jlink.c | 4 +-- urjtag/src/tap/cable/usbblaster.c | 4 +-- urjtag/src/tap/cable/xpc.c | 18 +++++++------ urjtag/src/tap/detect.c | 2 +- urjtag/src/tap/discovery.c | 2 +- urjtag/src/tap/parport/direct.c | 2 +- urjtag/src/tap/parport/ppdev.c | 2 +- urjtag/src/tap/usbconn/libftd2xx.c | 4 +-- urjtag/src/tap/usbconn/libftdi.c | 4 +-- urjtag/src/tap/usbconn/libusb.c | 2 +- 21 files changed, 102 insertions(+), 47 deletions(-) create mode 100644 urjtag/src/flash/jedec.h diff --git a/urjtag/configure.ac b/urjtag/configure.ac index 48e36701..fcab49f3 100644 --- a/urjtag/configure.ac +++ b/urjtag/configure.ac @@ -264,7 +264,7 @@ AS_IF([test "x$with_inpout32" = xyes], [ ]) -CFLAGS="$CFLAGS -Wall" +CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wstrict-prototypes" CPPFLAGS="-I\$(top_srcdir) -I\$(top_srcdir)/include $CPPFLAGS" diff --git a/urjtag/include/fclock.h b/urjtag/include/fclock.h index 2a5c8f6d..37270dfc 100644 --- a/urjtag/include/fclock.h +++ b/urjtag/include/fclock.h @@ -28,15 +28,23 @@ #ifdef __cplusplus extern "C" { -#endif + +# ifndef CVOID +# define CVOID +# endif +#else /* def __cplusplus */ +# ifndef CVOID +# define CVOID void +# endif +#endif /* def __cplusplus */ /* return real time in seconds starting at some arbitrary point in time*/ - long double frealtime (); + long double frealtime (CVOID); /* return the CPU time used by this process (seconds) */ - long double fcputime (); + long double fcputime (CVOID); #ifdef __cplusplus diff --git a/urjtag/src/bus/ejtag_dma.c b/urjtag/src/bus/ejtag_dma.c index 7c6d1216..6256d30b 100644 --- a/urjtag/src/bus/ejtag_dma.c +++ b/urjtag/src/bus/ejtag_dma.c @@ -362,7 +362,7 @@ ejtag_dma_read (unsigned int addr, int sz) * bus->driver->(*initbus) * */ -int +static int ejtag_dma_bus_init (bus_t *bus) { data_register *ejctrl = NULL, *ejimpl = NULL, *ejaddr = NULL, *ejdata = @@ -516,7 +516,7 @@ ejtag_dma_bus_init (bus_t *bus) * bus->driver->(*prepare) * */ -void +static void ejtag_dma_bus_prepare (bus_t *bus) { if (!INITIALIZED) @@ -527,7 +527,7 @@ ejtag_dma_bus_prepare (bus_t *bus) * bus->driver->(*area) * */ -int +static int ejtag_dma_bus_area (bus_t *bus, uint32_t adr, bus_area_t *area) { @@ -584,7 +584,7 @@ ejtag_dma_bus_area (bus_t *bus, uint32_t adr, bus_area_t *area) return URJTAG_STATUS_OK; } -int +static int get_sz (uint32_t adr) { static bus_area_t area; @@ -611,7 +611,7 @@ get_sz (uint32_t adr) * bus->driver->(*write) * */ -void +static void ejtag_dma_bus_write (bus_t *bus, uint32_t adr, uint32_t data) { //printf("%s:adr=0x%x,data=0x%x\n",__FUNCTION__,adr,data); @@ -622,7 +622,7 @@ ejtag_dma_bus_write (bus_t *bus, uint32_t adr, uint32_t data) * bus->driver->(*read) * */ -unsigned int +static unsigned int ejtag_dma_bus_read (bus_t *bus, uint32_t adr) { int data = ejtag_dma_read (adr, get_sz (adr)); @@ -635,7 +635,7 @@ static unsigned int _data_read; * bus->driver->(*read_start) * */ -void +static void ejtag_dma_bus_read_start (bus_t *bus, uint32_t adr) { _data_read = ejtag_dma_read (adr, get_sz (adr)); @@ -647,7 +647,7 @@ ejtag_dma_bus_read_start (bus_t *bus, uint32_t adr) * bus->driver->(*read_next) * */ -unsigned int +static unsigned int ejtag_dma_bus_read_next (bus_t *bus, uint32_t adr) { unsigned int tmp_value = _data_read; @@ -660,7 +660,7 @@ ejtag_dma_bus_read_next (bus_t *bus, uint32_t adr) * bus->driver->(*read_end) * */ -unsigned int +static unsigned int ejtag_dma_bus_read_end (bus_t *bus) { return _data_read; diff --git a/urjtag/src/flash/detectflash.c b/urjtag/src/flash/detectflash.c index dae35e93..bb84a27c 100644 --- a/urjtag/src/flash/detectflash.c +++ b/urjtag/src/flash/detectflash.c @@ -39,13 +39,9 @@ #include #include -cfi_array_t *cfi_array = NULL; - -extern int jedec_exp_detect (bus_t *bus, uint32_t adr, - cfi_array_t **cfi_array); -extern int jedec_detect (bus_t *bus, uint32_t adr, cfi_array_t **cfi_array); +#include "jedec.h" -extern int amd_detect (bus_t *bus, uint32_t adr, cfi_array_t **cfi_array); //Ajith +cfi_array_t *cfi_array = NULL; void detectflash (bus_t *bus, uint32_t adr) diff --git a/urjtag/src/flash/jedec.c b/urjtag/src/flash/jedec.c index 2a4193f2..5cc9bb85 100644 --- a/urjtag/src/flash/jedec.c +++ b/urjtag/src/flash/jedec.c @@ -34,6 +34,8 @@ #include #include +#include "jedec.h" + /* Manufacturers */ #define MANUFACTURER_AMD 0x0001 #define MANUFACTURER_ATMEL 0x001F diff --git a/urjtag/src/flash/jedec.h b/urjtag/src/flash/jedec.h new file mode 100644 index 00000000..394bed74 --- /dev/null +++ b/urjtag/src/flash/jedec.h @@ -0,0 +1,37 @@ +/* + * $Id: jedec.h 1510 2009-04-21 17:29:52Z rfhh $ + * + * Copyright (C) 2003 Matan Ziv-Av + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + * Written by Matan Ziv-Av, 2003. + * + */ + +#ifndef URJ_SRC_FLASH_JEDEC_H +#define URJ_SRC_FLASH_JEDEC_H + +#include +#include + +int jedec_detect (bus_t *bus, uint32_t adr, cfi_array_t **cfi_array); +#ifdef JEDEC_EXP +int jedec_exp_detect (bus_t *bus, uint32_t adr, cfi_array_t **cfi_array); +#endif +int amd_detect (bus_t *bus, uint32_t adr, cfi_array_t **cfi_array); + +#endif /* ndef URJ_SRC_FLASH_JEDEC_H */ diff --git a/urjtag/src/lib/fclock.c b/urjtag/src/lib/fclock.c index d83e67e5..9da8f290 100644 --- a/urjtag/src/lib/fclock.c +++ b/urjtag/src/lib/fclock.c @@ -39,8 +39,10 @@ #include #include +#include "fclock.h" + long double -frealtime () +frealtime (void) { long double result; static uint64_t start_mat; @@ -73,7 +75,7 @@ frealtime () #ifdef _POSIX_TIMERS long double -frealtime () +frealtime (void) { long double result; @@ -100,7 +102,7 @@ frealtime () #include long double -frealtime () +frealtime (void) { long double result; @@ -137,7 +139,7 @@ set_clk_tck (void) #endif long double -frealtime () +frealtime (void) { long double result; diff --git a/urjtag/src/svf/svf.c b/urjtag/src/svf/svf.c index 231b3d36..da4377e2 100644 --- a/urjtag/src/svf/svf.c +++ b/urjtag/src/svf/svf.c @@ -45,6 +45,13 @@ #include #include +#if 0 +#include /* two include files w/ the same name + * this will be resolved when we will have + * include/urjtag/svf.h + * RFHH */ +#endif + #include #include "svf.h" diff --git a/urjtag/src/svf/svf_flex.l b/urjtag/src/svf/svf_flex.l index 546b23e2..5d19beea 100644 --- a/urjtag/src/svf/svf_flex.l +++ b/urjtag/src/svf/svf_flex.l @@ -52,6 +52,7 @@ static void fix_yylloc(YYLTYPE *, char *); static void fix_yylloc_nl(YYLTYPE *, char *, YY_EXTRA_TYPE); static void progress_nl(YYLTYPE *, YY_EXTRA_TYPE); +int yywrap(yyscan_t scanner); int yywrap(yyscan_t scanner) { return(1); diff --git a/urjtag/src/tap/cable/generic.c b/urjtag/src/tap/cable/generic.c index 2972be04..4e746e59 100644 --- a/urjtag/src/tap/cable/generic.c +++ b/urjtag/src/tap/cable/generic.c @@ -49,7 +49,7 @@ #undef VERBOSE #ifdef VERBOSE -void +static void print_vector (int len, char *vec) { int i; @@ -91,7 +91,7 @@ generic_get_signal (cable_t *cable, pod_sigsel_t sig) return (((PARAM_SIGNALS (cable)) & sig) != 0) ? 1 : 0; } -int +static int do_one_queued_action (cable_t *cable) { int i; diff --git a/urjtag/src/tap/cable/generic_parport.c b/urjtag/src/tap/cable/generic_parport.c index 9b1b337c..b192d160 100644 --- a/urjtag/src/tap/cable/generic_parport.c +++ b/urjtag/src/tap/cable/generic_parport.c @@ -39,7 +39,7 @@ #undef VERBOSE #ifdef VERBOSE -void +static void print_vector (int len, char *vec) { int i; diff --git a/urjtag/src/tap/cable/jlink.c b/urjtag/src/tap/cable/jlink.c index 42b017b5..15ae6dfb 100644 --- a/urjtag/src/tap/cable/jlink.c +++ b/urjtag/src/tap/cable/jlink.c @@ -519,7 +519,7 @@ jlink_get_tdo (cable_t *cable) /* ---------------------------------------------------------------------- */ -void +static void jlink_copy_out_data (jlink_usbconn_data_t *data, int len, int offset, char *buf) { @@ -532,7 +532,7 @@ jlink_copy_out_data (jlink_usbconn_data_t *data, int len, int offset, } } -int +static int jlink_transfer (cable_t *cable, int len, char *in, char *out) { int i, j; diff --git a/urjtag/src/tap/cable/usbblaster.c b/urjtag/src/tap/cable/usbblaster.c index 3b3e4b09..2366c49a 100644 --- a/urjtag/src/tap/cable/usbblaster.c +++ b/urjtag/src/tap/cable/usbblaster.c @@ -96,7 +96,7 @@ usbblaster_connect (char *params[], cable_t *cable) return 0; } -void +static void usbblaster_set_frequency (cable_t *cable, uint32_t new_frequency) { if (new_frequency != FIXED_FREQUENCY) @@ -474,7 +474,7 @@ usbblaster_flush (cable_t *cable, cable_flush_amount_t how_much) } } -void +static void usbblaster_help (const char *cablename) { printf (_ diff --git a/urjtag/src/tap/cable/xpc.c b/urjtag/src/tap/cable/xpc.c index 495d511e..ed227e7c 100644 --- a/urjtag/src/tap/cable/xpc.c +++ b/urjtag/src/tap/cable/xpc.c @@ -75,7 +75,7 @@ static int last_tdo; /* ---------------------------------------------------------------------- */ -int +static int xpcu_output_enable (struct usb_dev_handle *xpcu, int enable) { if (usb_control_msg @@ -90,7 +90,8 @@ xpcu_output_enable (struct usb_dev_handle *xpcu, int enable) /* ---------------------------------------------------------------------- */ -int +#ifdef UNUSED /* RFHH */ +static int xpcu_bit_reverse (struct usb_dev_handle *xpcu, uint8_t bits_in, uint8_t *bits_out) { @@ -103,10 +104,11 @@ xpcu_bit_reverse (struct usb_dev_handle *xpcu, uint8_t bits_in, return 0; } +#endif /* ----------------------------------------------------------------- */ -int +static int xpcu_request_28 (struct usb_dev_handle *xpcu, int value) { /* Typical values seen during autodetection of chain configuration: 0x11, 0x12 */ @@ -122,7 +124,7 @@ xpcu_request_28 (struct usb_dev_handle *xpcu, int value) /* ---------------------------------------------------------------------- */ -int +static int xpcu_write_gpio (struct usb_dev_handle *xpcu, uint8_t bits) { if (usb_control_msg (xpcu, 0x40, 0xB0, 0x0030, bits, NULL, 0, 1000) < 0) @@ -136,7 +138,7 @@ xpcu_write_gpio (struct usb_dev_handle *xpcu, uint8_t bits) /* ---------------------------------------------------------------------- */ -int +static int xpcu_read_gpio (struct usb_dev_handle *xpcu, uint8_t *bits) { if (usb_control_msg (xpcu, 0xC0, 0xB0, 0x0038, 0, (char *) bits, 1, 1000) @@ -152,7 +154,7 @@ xpcu_read_gpio (struct usb_dev_handle *xpcu, uint8_t *bits) /* ---------------------------------------------------------------------- */ -int +static int xpcu_read_cpld_version (struct usb_dev_handle *xpcu, uint16_t *buf) { if (usb_control_msg @@ -166,7 +168,7 @@ xpcu_read_cpld_version (struct usb_dev_handle *xpcu, uint16_t *buf) /* ---------------------------------------------------------------------- */ -int +static int xpcu_read_firmware_version (struct usb_dev_handle *xpcu, uint16_t *buf) { if (usb_control_msg @@ -181,7 +183,7 @@ xpcu_read_firmware_version (struct usb_dev_handle *xpcu, uint16_t *buf) /* ----------------------------------------------------------------- */ -int +static int xpcu_select_gpio (struct usb_dev_handle *xpcu, int int_or_ext) { if (usb_control_msg (xpcu, 0x40, 0xB0, 0x0052, int_or_ext, NULL, 0, 1000) diff --git a/urjtag/src/tap/detect.c b/urjtag/src/tap/detect.c index e941eaa4..b5050f08 100644 --- a/urjtag/src/tap/detect.c +++ b/urjtag/src/tap/detect.c @@ -167,7 +167,7 @@ find_record (char *filename, tap_register *key, struct id_record *idr) return r; } -uint64_t +static uint64_t bits_to_uint64 (tap_register *t) { int i; diff --git a/urjtag/src/tap/discovery.c b/urjtag/src/tap/discovery.c index 17b9d499..06e5ae73 100644 --- a/urjtag/src/tap/discovery.c +++ b/urjtag/src/tap/discovery.c @@ -119,7 +119,7 @@ detect_register_size (chain_t *chain) return -1; } -void +static void jtag_reset (chain_t *chain) { chain_set_trst (chain, 0); diff --git a/urjtag/src/tap/parport/direct.c b/urjtag/src/tap/parport/direct.c index 914d3b8d..5ad2b475 100644 --- a/urjtag/src/tap/parport/direct.c +++ b/urjtag/src/tap/parport/direct.c @@ -198,7 +198,7 @@ direct_parport_free (parport_t *port) #endif } -parport_t * +static parport_t * direct_connect (const char **par, int parnum) { long int port_scan_val; diff --git a/urjtag/src/tap/parport/ppdev.c b/urjtag/src/tap/parport/ppdev.c index 72ed33c0..c0b71c4c 100644 --- a/urjtag/src/tap/parport/ppdev.c +++ b/urjtag/src/tap/parport/ppdev.c @@ -113,7 +113,7 @@ ppdev_parport_free (parport_t *port) free (port); } -parport_t * +static parport_t * ppdev_connect (const char **par, int parnum) { port_node_t *pn; diff --git a/urjtag/src/tap/usbconn/libftd2xx.c b/urjtag/src/tap/usbconn/libftd2xx.c index 6334b0c9..820ec8b0 100644 --- a/urjtag/src/tap/usbconn/libftd2xx.c +++ b/urjtag/src/tap/usbconn/libftd2xx.c @@ -271,7 +271,7 @@ usbconn_ftd2xx_write (usbconn_t *conn, uint8_t *buf, int len, int recv) /* ---------------------------------------------------------------------- */ -usbconn_t * +static usbconn_t * usbconn_ftd2xx_connect (const char **param, int paramc, usbconn_cable_t *template) { @@ -329,7 +329,7 @@ usbconn_ftd2xx_connect (const char **param, int paramc, } -usbconn_t * +static usbconn_t * usbconn_ftd2xx_mpsse_connect (const char **param, int paramc, usbconn_cable_t *template) { diff --git a/urjtag/src/tap/usbconn/libftdi.c b/urjtag/src/tap/usbconn/libftdi.c index 1c584274..18e2c34c 100644 --- a/urjtag/src/tap/usbconn/libftdi.c +++ b/urjtag/src/tap/usbconn/libftdi.c @@ -234,7 +234,7 @@ usbconn_ftdi_write (usbconn_t *conn, uint8_t *buf, int len, int recv) /* ---------------------------------------------------------------------- */ -usbconn_t * +static usbconn_t * usbconn_ftdi_connect (const char **param, int paramc, usbconn_cable_t *template) { @@ -296,7 +296,7 @@ usbconn_ftdi_connect (const char **param, int paramc, } -usbconn_t * +static usbconn_t * usbconn_ftdi_mpsse_connect (const char **param, int paramc, usbconn_cable_t *template) { diff --git a/urjtag/src/tap/usbconn/libusb.c b/urjtag/src/tap/usbconn/libusb.c index 5d955d5d..8bd9a1bc 100644 --- a/urjtag/src/tap/usbconn/libusb.c +++ b/urjtag/src/tap/usbconn/libusb.c @@ -109,7 +109,7 @@ libusb_match_desc (struct usb_device *dev, char *desc) /* ---------------------------------------------------------------------- */ -usbconn_t * +static usbconn_t * usbconn_libusb_connect (const char **param, int paramc, usbconn_cable_t *template) {