-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix build with GCC. #73
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Piotr Sikora <[email protected]>
cc @rossberg |
@@ -605,6 +605,7 @@ auto ExternType::copy() const -> own<ExternType*> { | |||
case EXTERN_GLOBAL: return global()->copy(); | |||
case EXTERN_TABLE: return table()->copy(); | |||
case EXTERN_MEMORY: return memory()->copy(); | |||
default: assert(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, wouldn't having a branch with no return trip up other compilers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Funnily enough, I've added all those asserts (with the exception of the one in src/wasm-v8.cc:2199
, which I added for completeness) to silence the no return errors in GCC:
error: control reaches end of non-void function [-Werror=return-type]
so this works fine for both: clang
and gcc
, at least using default CFLAGS
.
But now that you pointed this out, I realized that this will indeed break when building with -DNDEBUG
(i.e. when assert()
is omitted), but this is already the case in master
, since the same pattern is used in a few other places, e.g. in src/wasm-bin.cc:220
:
Line 220 in dc8cc29
assert(false); |
Perhaps all those assert(false)
should be replaced with UNIMPLEMENTED()
? What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ping.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, though I don't think we want to abuse UNIMPLEMENTED, but define a similar UNREACHABLE. Do you mind including that with this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the long delay!
@@ -605,6 +605,7 @@ auto ExternType::copy() const -> own<ExternType*> { | |||
case EXTERN_GLOBAL: return global()->copy(); | |||
case EXTERN_TABLE: return table()->copy(); | |||
case EXTERN_MEMORY: return memory()->copy(); | |||
default: assert(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, though I don't think we want to abuse UNIMPLEMENTED, but define a similar UNREACHABLE. Do you mind including that with this PR?
Signed-off-by: Piotr Sikora [email protected]