From 12311c5540e69750b39f1f2e476546cdf05d1f3e Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Mon, 26 Nov 2018 17:51:16 -0800 Subject: arch, base, cpu, gpu, mem: Replace assert(0 or false with panic. Neither assert(0) nor assert(false) give any hint as to why control getting to them is bad, and their more descriptive versions, assert(0 && "description") and assert(false && "description"), jury rig assert to add an error message when the utility function panic() already does that directly with better formatting options. This change replaces that flavor of call to assert with panic, except in the actual code which processes the formatting that panic uses (to avoid infinitely recurring error handling), and in some *.sm files since I don't know what rules those have to follow and don't want to accidentaly break them. Change-Id: I8addfbfaf77eaed94ec8191f2ae4efb477cefdd0 Reviewed-on: https://gem5-review.googlesource.com/c/14636 Reviewed-by: Brandon Potter Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power --- src/base/inet.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/base') diff --git a/src/base/inet.cc b/src/base/inet.cc index 57af0e56c..44a37d280 100644 --- a/src/base/inet.cc +++ b/src/base/inet.cc @@ -51,6 +51,7 @@ #include #include "base/cprintf.hh" +#include "base/logging.hh" #include "base/types.hh" using namespace std; @@ -238,7 +239,7 @@ cksum(const TcpPtr &tcp) } else if (Ip6Ptr(tcp.packet())) { return __tu_cksum6(Ip6Ptr(tcp.packet())); } else { - assert(0); + panic("Unrecognized IP packet format"); } // Should never reach here return 0; @@ -252,7 +253,7 @@ cksum(const UdpPtr &udp) } else if (Ip6Ptr(udp.packet())) { return __tu_cksum6(Ip6Ptr(udp.packet())); } else { - assert(0); + panic("Unrecognized IP packet format"); } return 0; } -- cgit v1.2.3