You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR adds more translated symbols for brotli (enum values +
functions), socket (enums + macros), and ip (enums).
This is not straight forward because symbols like IPPROTO_TCP are
defined as enum on Linux and macro on macOS. To handle this, I modified
cpp_rule_preprocessor + mapper to match macros and VisitIntegerLiteral
to emit the translated macro.
Because on one platform the symbol is an enum and on the other it's a
macro, the AST of the translated program is also different. To be able
to generate the same code on both platforms, I use
`IsCastRedundantInRust` to normalize `(libc::IPPROTO_TCP as i32)`
(Linux) and `libc::IPPROTO_TCP` (macOS) to `libc::IPPROTO_TCP`. This
uses the fact that `libc::IPPROTO_TCP` is already an i32 in Rust, so the
cast is redundant.
0 commit comments