From 5cb49e8b07342a0e0cfc48b54ff15accae16ce6e Mon Sep 17 00:00:00 2001 From: Lionel Debroux Date: Sat, 19 Feb 2011 08:25:29 +0000 Subject: [PATCH] Several compiler warning fixes: * msp430: fix "implicit declaration of function" warnings in clock.c, by including watchdog.h; * sky: fix a couple pointer target signedness warnings; * core: fix several signed/unsigned comparison warnings; * framer-802154: "const static" -> "static const" to fix compiler warnings; * core: comment or remove unused variables and function definitions. Signed-off-by: Lionel Debroux Signed-off-by: Mariano Alvira --- core/dev/cc2420.c | 2 +- core/net/mac/cxmac.c | 2 +- core/net/mac/framer-802154.c | 4 ++-- core/net/mac/xmac.c | 8 ++++++-- core/net/rime/collect-link-estimate.c | 3 --- core/net/rpl/rpl-dag.c | 2 +- core/net/uip-debug.c | 5 +++-- core/net/uiplib.c | 3 ++- core/sys/timetable-aggregate.c | 5 +++-- core/sys/timetable.c | 2 +- platform/sky/dev/xmem.c | 2 +- 11 files changed, 21 insertions(+), 17 deletions(-) diff --git a/core/dev/cc2420.c b/core/dev/cc2420.c index 7a5d35a93..8e8a1b657 100644 --- a/core/dev/cc2420.c +++ b/core/dev/cc2420.c @@ -139,7 +139,7 @@ static int cc2420_send(const void *data, unsigned short len); static int cc2420_receiving_packet(void); static int pending_packet(void); static int cc2420_cca(void); -static int detected_energy(void); +/*static int detected_energy(void);*/ signed char cc2420_last_rssi; uint8_t cc2420_last_correlation; diff --git a/core/net/mac/cxmac.c b/core/net/mac/cxmac.c index d01750156..84e945ead 100644 --- a/core/net/mac/cxmac.c +++ b/core/net/mac/cxmac.c @@ -454,7 +454,7 @@ send_packet(void) packetbuf_attr(PACKETBUF_ATTR_ERELIABLE); len = NETSTACK_FRAMER.create(); strobe_len = len + sizeof(struct cxmac_hdr); - if(len == 0 || strobe_len > sizeof(strobe)) { + if(len == 0 || strobe_len > (int)sizeof(strobe)) { /* Failed to send */ PRINTF("cxmac: send failed, too large header\n"); return MAC_TX_ERR_FATAL; diff --git a/core/net/mac/framer-802154.c b/core/net/mac/framer-802154.c index 02ea4bfe1..ba566de78 100644 --- a/core/net/mac/framer-802154.c +++ b/core/net/mac/framer-802154.c @@ -56,8 +56,8 @@ static uint8_t mac_dsn; static uint8_t initialized = 0; -const static uint16_t mac_dst_pan_id = IEEE802154_PANID; -const static uint16_t mac_src_pan_id = IEEE802154_PANID; +static const uint16_t mac_dst_pan_id = IEEE802154_PANID; +static const uint16_t mac_src_pan_id = IEEE802154_PANID; /*---------------------------------------------------------------------------*/ static int diff --git a/core/net/mac/xmac.c b/core/net/mac/xmac.c index fcdb88924..547e93b8f 100644 --- a/core/net/mac/xmac.c +++ b/core/net/mac/xmac.c @@ -455,7 +455,9 @@ send_packet(void) rtimer_clock_t t; rtimer_clock_t encounter_time = 0; int strobes; +#if 0 struct xmac_hdr *hdr; +#endif uint8_t got_strobe_ack = 0; uint8_t got_ack = 0; uint8_t strobe[MAX_STROBE_SIZE]; @@ -495,7 +497,7 @@ send_packet(void) packetbuf_set_attr(PACKETBUF_ATTR_MAC_ACK, 1); len = NETSTACK_FRAMER.create(); strobe_len = len + sizeof(struct xmac_hdr); - if(len == 0 || strobe_len > sizeof(strobe)) { + if(len == 0 || strobe_len > (int)sizeof(strobe)) { /* Failed to send */ PRINTF("xmac: send failed, too large header\n"); return MAC_TX_ERR_FATAL; @@ -602,9 +604,9 @@ send_packet(void) while(got_strobe_ack == 0 && RTIMER_CLOCK_LT(RTIMER_NOW(), t + xmac_config.strobe_wait_time)) { +#if 0 rtimer_clock_t now = RTIMER_NOW(); -#if 0 /* See if we got an ACK */ packetbuf_clear(); len = NETSTACK_RADIO.read(packetbuf_dataptr(), PACKETBUF_SIZE); @@ -647,7 +649,9 @@ send_packet(void) #endif off(); } else { +#if 0 rtimer_clock_t wt; +#endif on(); NETSTACK_RADIO.send(strobe, strobe_len); #if 0 diff --git a/core/net/rime/collect-link-estimate.c b/core/net/rime/collect-link-estimate.c index ff93cdbbb..50b0ac40e 100644 --- a/core/net/rime/collect-link-estimate.c +++ b/core/net/rime/collect-link-estimate.c @@ -108,9 +108,6 @@ collect_link_estimate_update_rx(struct collect_link_estimate *n) uint16_t collect_link_estimate(struct collect_link_estimate *le) { - int i; - uint16_t etx; - if(le->num_estimates == 0) { return INITIAL_LINK_ESTIMATE * COLLECT_LINK_ESTIMATE_UNIT; } diff --git a/core/net/rpl/rpl-dag.c b/core/net/rpl/rpl-dag.c index 330d79b21..10c57039d 100644 --- a/core/net/rpl/rpl-dag.c +++ b/core/net/rpl/rpl-dag.c @@ -419,7 +419,7 @@ rpl_get_dag(int instance_id) rpl_of_t * rpl_find_of(rpl_ocp_t ocp) { - int i; + unsigned int i; for(i = 0; i < sizeof(objective_functions) / sizeof(objective_functions[0]); diff --git a/core/net/uip-debug.c b/core/net/uip-debug.c index 2695169f5..60ec30f86 100644 --- a/core/net/uip-debug.c +++ b/core/net/uip-debug.c @@ -46,7 +46,8 @@ uip_debug_ipaddr_print(const uip_ipaddr_t *addr) { #if UIP_CONF_IPV6 uint16_t a; - int i, f; + unsigned int i; + int f; for(i = 0, f = 0; i < sizeof(uip_ipaddr_t); i += 2) { a = (addr->u8[i] << 8) + addr->u8[i + 1]; if(a == 0 && f >= 0) { @@ -70,7 +71,7 @@ uip_debug_ipaddr_print(const uip_ipaddr_t *addr) void uip_debug_lladdr_print(const uip_lladdr_t *addr) { - int i; + unsigned int i; for(i = 0; i < sizeof(uip_lladdr_t); i++) { if(i > 0) { printf(":"); diff --git a/core/net/uiplib.c b/core/net/uiplib.c index 3add7dd2c..630385373 100644 --- a/core/net/uiplib.c +++ b/core/net/uiplib.c @@ -47,7 +47,8 @@ uiplib_ipaddrconv(const char *addrstr, uip_ipaddr_t *ipaddr) { #if UIP_CONF_IPV6 uint16_t value; - int tmp, len, zero; + int tmp, zero; + unsigned int len; char c = 0; //gcc warning if not initialized value = 0; diff --git a/core/sys/timetable-aggregate.c b/core/sys/timetable-aggregate.c index 5c35b035d..391f472dd 100644 --- a/core/sys/timetable-aggregate.c +++ b/core/sys/timetable-aggregate.c @@ -147,7 +147,7 @@ void timetable_aggregate_compute_detailed(struct timetable_aggregate *a, struct timetable *timetable) { - int i; + unsigned int i; rtimer_clock_t t; t = timetable->timestamps[0].time; @@ -179,7 +179,8 @@ void timetable_aggregate_compute_categories(struct timetable_aggregate *a, struct timetable *timetable) { - int i,j; + unsigned int i; + int j; rtimer_clock_t t; uint16_t categories[XXX_HACK_MAX_CATEGORIES]; int categories_ptr = 0; diff --git a/core/sys/timetable.c b/core/sys/timetable.c index 5fc1481b1..fe30ac166 100644 --- a/core/sys/timetable.c +++ b/core/sys/timetable.c @@ -118,7 +118,7 @@ timetable_init(void) void timetable_print(struct timetable *t) { - int i; + unsigned int i; int time; time = t->timestamps[0].time; diff --git a/platform/sky/dev/xmem.c b/platform/sky/dev/xmem.c index f7f3dee3a..46315d3fa 100644 --- a/platform/sky/dev/xmem.c +++ b/platform/sky/dev/xmem.c @@ -200,7 +200,7 @@ xmem_pread(void *_p, int size, unsigned long offset) return size; } /*---------------------------------------------------------------------------*/ -static const char * +static const unsigned char * program_page(unsigned long offset, const unsigned char *p, int nbytes) { const unsigned char *end = p + nbytes;