AeneasVerif / eurydice

Eurydice compiles (a modest subset of) Rust to C. Verify programs in Rust, still get C code for legacy environments.
Apache License 2.0
21 stars 1 forks source link

Fix Compound literals for MSVC C++ #24

Closed franziskuskiefer closed 2 months ago

franziskuskiefer commented 3 months ago

The MSVC C++ compiler does not support compound literals. So we need to update the code generation to properly generate code that can be used from C++.

In eurydice_glue.h we add something like this.

#if defined(__cplusplus)
    #define CLITERAL(type)      type
#else
    #define CLITERAL(type)      (type)
#endif

Then every such invocation needs to change to

CLITERAL(type){...}

In eurydice_glue.h manually, but in the generated code we need this pattern as well.

I'm not sure if the fix is here or in karamel.

msprotz commented 2 months ago

https://github.com/AeneasVerif/eurydice/commit/81373480992bc1088818884d8572bf2711d25d63