Add rules for stdlib, rustls, and stdio#183
Conversation
| @@ -0,0 +1,2869 @@ | |||
| #ifndef RUSTLS_H | |||
| #define RUSTLS_H | |||
There was a problem hiding this comment.
why is this file needed and what's the origin?
There was a problem hiding this comment.
It's needed to get the C symbols that we translate to rust, similar to brotli: https://github.com/Cpp2Rust/cpp2rust/tree/master/rules/brotli/brotli
This is the origin: https://github.com/rustls/rustls-ffi/blob/main/librustls/src/rustls.h
I installed the deb package (https://github.com/rustls/rustls-ffi/releases/tag/v0.15.3) for rustls-ffi on my system and copied /usr/include/rustls.h into rules/rustls/rustls.h
There was a problem hiding this comment.
I removed the copy-pasted file, see the new description of the PR
6ffc47e to
3e48952
Compare
|
|
||
| add_custom_command( | ||
| OUTPUT ${rust_rules_ir_outputs} | ||
| COMMAND cargo +${RUST_STABLE_VERSION} build --release --manifest-path "${PROJECT_SOURCE_DIR}/rules/Cargo.toml" |
There was a problem hiding this comment.
this change doesn't look intended
There was a problem hiding this comment.
Yes, that was a mistake. It was asymptomatic because I already had rustls.h generated on my machine
This mainly adds translation rules for rustls_ffi. I needed to do a few modifications in
cpp2rust/to be able to add translation rules for typedef'ed integers, for example rustls_ffi::rustls_result (typedef uint32_t rustls_result):typedefin C andusingin C++. rustls.h uses C specific features, hence the source rules must be put in a src.c file. For example in rustls.h uses the following which is valid C but invalid C++:rustls_result r = 0rules/build.rstakes care of this