-
Notifications
You must be signed in to change notification settings - Fork 246
fix(cpp): escape cpp keywords #1420
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
Conversation
1450ef8 to
e6f0f3a
Compare
- remove keywords.wit from expected failures - use std::optional for ResultLift to avoid default constructor issues std::expected doesn't have a default constructor when the value type lacks one. Use std::optional wrapper to defer construction until the result is known. Fixes bytecodealliance#1419 Signed-off-by: Bailey Hayes <[email protected]>
|
A bit of an adventure but I am now able to successfully run a wasi:http server. Check it out here: https://github.com/ricochet/sample-wasi-http-cpp |
| "ret" => "ret_".into(), | ||
| "err" => "err_".into(), | ||
| // C standard library macros that conflict when used as identifiers | ||
| "stdin" => "stdin_".into(), |
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.
heads up this is for c as well as C++. Extra care that this is correct should be taken here.
alexcrichton
left a comment
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.
Thanks!
|
|
||
| let tmp = self.tmp(); | ||
| let resultname = self.tempname("result", tmp); | ||
| // Use std::optional to avoid default constructor issues with std::expected |
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.
I believe this is the best approach given the available options, but it was a technique new to me.
This is what this generates:
https://github.com/ricochet/sample-wasi-http-cpp/blob/main/bindings/http_server.cpp#L1268-L1278
f11a006
Fixes #1419
Signed-off-by: Bailey Hayes [email protected]