Skip to content

Commit

Permalink
Fixed compiler error when all compilers are enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
syrusakbary committed Apr 29, 2020
1 parent 257089f commit c57d509
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/compiler.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! Common module with common used structures across different
//! commands.

use crate::common::WasmFeatures;
use anyhow::{bail, Result};
use structopt::StructOpt;
Expand Down Expand Up @@ -43,14 +44,13 @@ impl CompilerOptions {
// Auto mode, we choose the best compiler for that platform
if cfg!(feature = "compiler-cranelift") && cfg!(target_arch = "x86_64") {
return Ok(Compiler::Cranelift);
}
if cfg!(feature = "compiler-singlepass") && cfg!(target_arch = "x86_64") {
} else if cfg!(feature = "compiler-singlepass") && cfg!(target_arch = "x86_64") {
return Ok(Compiler::Singlepass);
}
if cfg!(feature = "compiler-llvm") {
} else if cfg!(feature = "compiler-llvm") {
return Ok(Compiler::LLVM);
} else {
bail!("There are no available compilers for your architecture")
}
bail!("There are no available compilers for your architecture");
}
}

Expand All @@ -73,6 +73,11 @@ impl CompilerOptions {
let config = LLVMConfig::default();
return Ok(Box::new(config));
}
#[cfg(not(all(
feature = "compiler-singlepass",
feature = "compiler-cranelift",
feature = "compiler-llvm",
)))]
compiler => bail!(
"The compiler {:?} is not included in this binary.",
compiler
Expand Down

0 comments on commit c57d509

Please sign in to comment.