diff --git a/Changes b/Changes index 4624fc8c8..30a6b5a14 100644 --- a/Changes +++ b/Changes @@ -10,6 +10,8 @@ The contributors that suggested a given feature are shown in []. Thanks! **** Fix enum ranges without colons, bug1204. [Mike Popoloski] +**** Fix GCC noreturn compile error, bug1209. [Mike Popoloski] + * Verilator 3.910 2017-09-07 diff --git a/include/verilatedos.h b/include/verilatedos.h index f18772da5..ac6a9a1cd 100644 --- a/include/verilatedos.h +++ b/include/verilatedos.h @@ -46,6 +46,7 @@ # define VL_FUNC __func__ # define VL_LIKELY(x) __builtin_expect(!!(x), 1) # define VL_UNLIKELY(x) __builtin_expect(!!(x), 0) +# define VL_UNREACHABLE __builtin_unreachable(); # define VL_PREFETCH_RD(p) __builtin_prefetch((p),0) # define VL_PREFETCH_RW(p) __builtin_prefetch((p),1) #elif defined(_MSC_VER) @@ -57,6 +58,7 @@ # define VL_FUNC __FUNCTION__ # define VL_LIKELY(x) (!!(x)) # define VL_UNLIKELY(x) (!!(x)) +# define VL_UNREACHABLE # define VL_PREFETCH_RD(p) # define VL_PREFETCH_RW(p) #else @@ -68,6 +70,7 @@ # define VL_FUNC "__func__" ///< Name of current function for error macros # define VL_LIKELY(x) (!!(x)) ///< Boolean expression more often true than false # define VL_UNLIKELY(x) (!!(x)) ///< Boolean expression more often false than true +# define VL_UNREACHABLE ///< Point that may never be reached # define VL_PREFETCH_RD(p) ///< Prefetch data with read intent # define VL_PREFETCH_RW(p) ///< Prefetch data with read/write intent #endif diff --git a/src/V3Error.h b/src/V3Error.h index e0c95df7d..faf6ef94b 100644 --- a/src/V3Error.h +++ b/src/V3Error.h @@ -254,8 +254,7 @@ class V3Error { // Global versions, so that if the class doesn't define a operator, we get the functions anyways. inline int debug() { return V3Error::debugDefault(); } inline void v3errorEnd(ostringstream& sstr) { V3Error::v3errorEnd(sstr); } -inline void v3errorEndFatal(ostringstream& sstr) VL_ATTR_NORETURN; -inline void v3errorEndFatal(ostringstream& sstr) { V3Error::v3errorEnd(sstr); assert(0); } +inline void v3errorEndFatal(ostringstream& sstr) { V3Error::v3errorEnd(sstr); assert(0); VL_UNREACHABLE } // Theses allow errors using << operators: v3error("foo"<<"bar"); // Careful, you can't put () around msg, as you would in most macro definitions diff --git a/src/V3FileLine.h b/src/V3FileLine.h index 9ee5a3ee1..b8d76c6e3 100644 --- a/src/V3FileLine.h +++ b/src/V3FileLine.h @@ -161,11 +161,13 @@ public: // OPERATORS void v3errorEnd(ostringstream& str); - void v3errorEndFatal(ostringstream& str) VL_ATTR_NORETURN; + void v3errorEndFatal(ostringstream& str); string warnMore() const; inline bool operator==(FileLine rhs) const { return (m_lineno==rhs.m_lineno && m_filenameno==rhs.m_filenameno && m_warnOn==rhs.m_warnOn); } +private: + void v3errorEndFatalGuts(ostringstream& str); }; ostream& operator<<(ostream& os, FileLine* fileline);