Skip to content

Commit

Permalink
targets: Add .0 for clang warning
Browse files Browse the repository at this point in the history
.os_version() returns "12.3" for example but clang expects "12.3.0"

fix #281
  • Loading branch information
yhara committed Aug 3, 2022
1 parent e1ef462 commit 5411adb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/targets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ pub fn default_triple() -> inkwell::targets::TargetTriple {
// #281: get_default_triple returns `darwin` but clang shows warning for it
let arch = info.cpu_info().architecture();
let ver = info.os_info().os_version();
let s = format!("{}-apple-macosx{}", arch, ver);
// #281: Add .0
let n_dots = ver.chars().filter(|c| *c == '.').count();
let zero = if n_dots >= 2 { "" } else { ".0" };
let s = format!("{}-apple-macosx{}{}", arch, ver, zero);
inkwell::targets::TargetTriple::create(&s)
} else {
inkwell::targets::TargetMachine::get_default_triple()
Expand Down

0 comments on commit 5411adb

Please sign in to comment.