Port argument-non-c-like-enum to Rust

This commit is contained in:
许杰友 Jieyou Xu (Joe) 2024-03-27 23:34:16 +00:00
parent 142d02d472
commit fd7bc59363
No known key found for this signature in database
GPG Key ID: 95DDEBD74A1DC2C0
2 changed files with 20 additions and 8 deletions

View File

@ -1,8 +0,0 @@
# ignore-cross-compile
include ../tools.mk
all:
$(RUSTC) --crate-type=staticlib nonclike.rs
$(CC) test.c $(call STATICLIB,nonclike) $(call OUT_EXE,test) \
$(EXTRACFLAGS) $(EXTRACXXFLAGS)
$(call RUN,test)

View File

@ -0,0 +1,20 @@
//! Check that non-trivial `repr(C)` enum in Rust has valid C layout.
//@ ignore-cross-compile
extern crate run_make_support;
use run_make_support::{cc, extra_c_flags, extra_cxx_flags, run, rustc, static_lib};
pub fn main() {
use std::path::Path;
rustc().input("nonclike.rs").crate_type("staticlib").run();
cc().input("test.c")
.input(static_lib("nonclike"))
.out_exe("test")
.args(&extra_c_flags())
.args(&extra_cxx_flags())
.inspect(|cmd| eprintln!("{cmd:?}"))
.run();
run("test");
}