misc: Updates for gcc7.2 for x86
GCC 7.2 is much stricter than previous GCC versions. The following changes are needed: * There is now a warning if there is an implicit fallthrough between two case statments. C++17 adds the [[fallthrough]]; declaration. However, to support non C++17 standards (i.e., C++11), we use M5_FALLTHROUGH. M5_FALLTHROUGH checks for [[fallthrough]] compliant C++17 compiler and if that doesn't exist, it defaults to nothing (no older compilers generate warnings). * The above resulted in a couple of bugs that were found. This is noted in the review request on gerrit. * throw() for dynamic exception specification is deprecated * There were a couple of new uninitialized variable warnings * Can no longer perform bitwise operations on a bool. * Must now include <functional> for std::function * Compiler bug for void* lambda. Changed to auto as work around. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82878 Change-Id: I5d4c782a4e133fa4cdb119e35d9aff68c6e2958e Signed-off-by: Jason Lowe-Power <jason@lowepower.com> Reviewed-on: https://gem5-review.googlesource.com/5802 Reviewed-by: Gabe Black <gabeblack@google.com>
This commit is contained in:
@@ -428,47 +428,13 @@ inline int
|
||||
ip_cksum_add(const void *buf, size_t len, int cksum)
|
||||
{
|
||||
uint16_t *sp = (uint16_t *)buf;
|
||||
int n, sn;
|
||||
int sn;
|
||||
|
||||
sn = len / 2;
|
||||
n = (sn + 15) / 16;
|
||||
|
||||
/* XXX - unroll loop using Duff's device. */
|
||||
switch (sn % 16) {
|
||||
case 0: do {
|
||||
cksum += *sp++;
|
||||
case 15:
|
||||
cksum += *sp++;
|
||||
case 14:
|
||||
cksum += *sp++;
|
||||
case 13:
|
||||
cksum += *sp++;
|
||||
case 12:
|
||||
cksum += *sp++;
|
||||
case 11:
|
||||
cksum += *sp++;
|
||||
case 10:
|
||||
cksum += *sp++;
|
||||
case 9:
|
||||
cksum += *sp++;
|
||||
case 8:
|
||||
cksum += *sp++;
|
||||
case 7:
|
||||
cksum += *sp++;
|
||||
case 6:
|
||||
cksum += *sp++;
|
||||
case 5:
|
||||
cksum += *sp++;
|
||||
case 4:
|
||||
cksum += *sp++;
|
||||
case 3:
|
||||
cksum += *sp++;
|
||||
case 2:
|
||||
cksum += *sp++;
|
||||
case 1:
|
||||
cksum += *sp++;
|
||||
} while (--n > 0);
|
||||
}
|
||||
do {
|
||||
cksum += *sp++;
|
||||
} while (--sn > 0);
|
||||
if (len & 1)
|
||||
cksum += htons(*(u_char *)sp << 8);
|
||||
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
template<typename T>
|
||||
T fromString(const std::string& s,
|
||||
std::ios_base& (*f)(std::ios_base &) = std::dec)
|
||||
throw(std::runtime_error)
|
||||
{
|
||||
std::istringstream is(s);
|
||||
T t;
|
||||
|
||||
Reference in New Issue
Block a user