diff --git a/include/verilated.cpp b/include/verilated.cpp index 4370a5b75..38ecdf221 100644 --- a/include/verilated.cpp +++ b/include/verilated.cpp @@ -2836,7 +2836,7 @@ const char* Verilated::productVersion() VL_PURE { return VERILATOR_VERSION; } void Verilated::nullPointerError(const char* filename, int linenum) VL_MT_SAFE { // Slowpath - Called only on error VL_FATAL_MT(filename, linenum, "", "Null pointer dereferenced"); - VL_UNREACHABLE + VL_UNREACHABLE; } void Verilated::overWidthError(const char* signame) VL_MT_SAFE { @@ -2844,7 +2844,7 @@ void Verilated::overWidthError(const char* signame) VL_MT_SAFE { const std::string msg = (std::string{"Testbench C set input '"} + signame + "' to value that overflows what the signal's width can fit"); VL_FATAL_MT("unknown", 0, "", msg.c_str()); - VL_UNREACHABLE + VL_UNREACHABLE; } void Verilated::mkdir(const char* dirname) VL_MT_UNSAFE { diff --git a/include/verilatedos.h b/include/verilatedos.h index 2e1456852..d4d64ea96 100644 --- a/include/verilatedos.h +++ b/include/verilatedos.h @@ -69,9 +69,9 @@ # define VL_EXCLUDES(x) __attribute__((locks_excluded(x))) # define VL_SCOPED_CAPABILITY __attribute__((scoped_lockable)) # endif -# define VL_LIKELY(x) __builtin_expect(!!(x), 1) -# define VL_UNLIKELY(x) __builtin_expect(!!(x), 0) -# define VL_UNREACHABLE __builtin_unreachable(); +# define VL_LIKELY(x) __builtin_expect(!!(x), 1) // Prefer over C++20 [[likely]] +# define VL_UNLIKELY(x) __builtin_expect(!!(x), 0) // Prefer over C++20 [[unlikely]] +# define VL_UNREACHABLE __builtin_unreachable() // C++23 std::unreachable() # define VL_PREFETCH_RD(p) __builtin_prefetch((p), 0) # define VL_PREFETCH_RW(p) __builtin_prefetch((p), 1) #endif diff --git a/src/V3Ast.cpp b/src/V3Ast.cpp index 1bd1ab6b9..27b52f353 100644 --- a/src/V3Ast.cpp +++ b/src/V3Ast.cpp @@ -1187,7 +1187,7 @@ void AstNode::dumpTreeDotFile(const string& filename, bool append, bool doDump) void AstNode::v3errorEndFatal(std::ostringstream& str) const { v3errorEnd(str); assert(0); // LCOV_EXCL_LINE - VL_UNREACHABLE + VL_UNREACHABLE; } string AstNode::instanceStr() const { diff --git a/src/V3Error.h b/src/V3Error.h index d5be7e005..d103866d6 100644 --- a/src/V3Error.h +++ b/src/V3Error.h @@ -330,7 +330,7 @@ inline void v3errorEnd(std::ostringstream& sstr) { V3Error::v3errorEnd(sstr); } inline void v3errorEndFatal(std::ostringstream& sstr) { V3Error::v3errorEnd(sstr); assert(0); // LCOV_EXCL_LINE - VL_UNREACHABLE + VL_UNREACHABLE; } // Theses allow errors using << operators: v3error("foo"<<"bar"); diff --git a/src/V3FileLine.h b/src/V3FileLine.h index 0737b0783..f6c53bfb1 100644 --- a/src/V3FileLine.h +++ b/src/V3FileLine.h @@ -307,7 +307,7 @@ public: void v3errorEndFatal(std::ostringstream& str) VL_ATTR_NORETURN { v3errorEnd(str); assert(0); // LCOV_EXCL_LINE - VL_UNREACHABLE + VL_UNREACHABLE; } /// When building an error, prefix for printing continuation lines /// e.g. information referring to the same FileLine as before diff --git a/src/V3Graph.cpp b/src/V3Graph.cpp index faffb7b41..4218394fa 100644 --- a/src/V3Graph.cpp +++ b/src/V3Graph.cpp @@ -144,7 +144,7 @@ void V3GraphVertex::v3errorEnd(std::ostringstream& str) const { void V3GraphVertex::v3errorEndFatal(std::ostringstream& str) const { v3errorEnd(str); assert(0); // LCOV_EXCL_LINE - VL_UNREACHABLE + VL_UNREACHABLE; } std::ostream& operator<<(std::ostream& os, V3GraphVertex* vertexp) { diff --git a/src/V3Number.cpp b/src/V3Number.cpp index 3dcfc88e2..00e7b1524 100644 --- a/src/V3Number.cpp +++ b/src/V3Number.cpp @@ -91,7 +91,7 @@ void V3Number::v3errorEnd(std::ostringstream& str) const { void V3Number::v3errorEndFatal(std::ostringstream& str) const { v3errorEnd(str); assert(0); // LCOV_EXCL_LINE - VL_UNREACHABLE + VL_UNREACHABLE; } //======================================================================