Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
V3Ast.cpp gives warning with -Winvalid-noreturn #1440
Compiling src/V3Ast.cpp produces the following warning when compiled with -Winvalid-noreturn (Apple LLVM version 10.0.0)
This is fixed pretty easily by adding VL_UNREACHABLE after the assert (patch attached). I'm not 100% sure that's the correct solution though, since assert may return if compiled with NDEBUG defined. Would it be better to turn the assert(0) into an abort()?
Original Redmine Comment
Your fix looks good, there were also two other similar sections of code I patched.
The assert will never get hit, as v3errorEnd exits before then. The assert is there to trick formal tools (that ignore the GNU attributes) into knowing the code is non-return.
Note Apple's LLVM 10.0.0 seems to have stuff not in the most recent clang++ 8.0 so there might be additional issues.