From 12eb0343784f52994110df7e7fce4a0b639a6ec3 Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Mon, 11 Jan 2016 05:52:20 -0500 Subject: scons: Enable -Wextra by default Make best use of the compiler, and enable -Wextra as well as -Wall. There are a few issues that had to be resolved, but they are all trivial. --- src/dev/net/ethertap.cc | 2 +- src/dev/net/ns_gige_reg.h | 3 ++- src/dev/net/pktfifo.hh | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src/dev/net') diff --git a/src/dev/net/ethertap.cc b/src/dev/net/ethertap.cc index e8d6a363c..e8ece152e 100644 --- a/src/dev/net/ethertap.cc +++ b/src/dev/net/ethertap.cc @@ -241,8 +241,8 @@ EtherTap::process(int revent) packet->length = data_len; memcpy(packet->data, data, data_len); + assert(buffer_offset >= data_len + sizeof(uint32_t)); buffer_offset -= data_len + sizeof(uint32_t); - assert(buffer_offset >= 0); if (buffer_offset > 0) { memmove(buffer, data + data_len, buffer_offset); data_len = ntohl(*(uint32_t *)buffer); diff --git a/src/dev/net/ns_gige_reg.h b/src/dev/net/ns_gige_reg.h index c37c06aed..4cecbb158 100644 --- a/src/dev/net/ns_gige_reg.h +++ b/src/dev/net/ns_gige_reg.h @@ -93,6 +93,7 @@ enum ChipCommandRegister { /* configuration register */ enum ConfigurationRegisters { + CFGR_ZERO = 0x00000000, CFGR_LNKSTS = 0x80000000, CFGR_SPDSTS = 0x60000000, CFGR_SPDSTS1 = 0x40000000, @@ -395,7 +396,7 @@ static inline int SPDSTS_POLARITY(int lnksts) { return (CFGR_SPDSTS1 | CFGR_SPDSTS0 | CFGR_DUPSTS | - (lnksts ? CFGR_LNKSTS : 0)); + (lnksts ? CFGR_LNKSTS : CFGR_ZERO)); } #endif /* __DEV_NS_GIGE_REG_H__ */ diff --git a/src/dev/net/pktfifo.hh b/src/dev/net/pktfifo.hh index 5ef75423c..456c4433b 100644 --- a/src/dev/net/pktfifo.hh +++ b/src/dev/net/pktfifo.hh @@ -106,8 +106,8 @@ class PacketFifo unsigned reserve(unsigned len = 0) { + assert(avail() >= len); _reserved += len; - assert(avail() >= 0); return _reserved; } -- cgit v1.2.3