wiggle: allow disable tracing in Wiggle-generated code (#5146)
Wiggle generates code that instruments APIs with tracing code. This is handy for diagnosing issues at runtime, but when inspecting the output of Wiggle, it can make the generated code difficult for a human to decipher. This change makes tracing a default but optional feature, allowing users to avoid tracing code with commands like `cargo expand --no-default-features`. This should be no change for current crates depending on `wiggle`, `wiggle-macro`, and `wiggle-generate`. review: add 'tracing' feature to wasi-common review: switch to using macro configuration parsing Co-authored-by: Andrew Brown <andrew.brown@intel.com>
This commit is contained in:
@@ -153,6 +153,7 @@ pub fn from_witx(args: TokenStream) -> TokenStream {
|
||||
&config.async_,
|
||||
&doc,
|
||||
config.wasmtime,
|
||||
config.tracing,
|
||||
)
|
||||
.expect("validating codegen settings");
|
||||
|
||||
@@ -189,9 +190,14 @@ pub fn wasmtime_integration(args: TokenStream) -> TokenStream {
|
||||
let doc = config.c.load_document();
|
||||
let names = wiggle_generate::Names::new(quote!(wiggle));
|
||||
|
||||
let settings =
|
||||
wiggle_generate::CodegenSettings::new(&config.c.errors, &config.c.async_, &doc, true)
|
||||
.expect("validating codegen settings");
|
||||
let settings = wiggle_generate::CodegenSettings::new(
|
||||
&config.c.errors,
|
||||
&config.c.async_,
|
||||
&doc,
|
||||
true,
|
||||
config.c.tracing,
|
||||
)
|
||||
.expect("validating codegen settings");
|
||||
|
||||
let modules = doc.modules().map(|module| {
|
||||
wiggle_generate::wasmtime::link_module(&module, &names, Some(&config.target), &settings)
|
||||
|
||||
Reference in New Issue
Block a user