Store all macros in a separate module

This commit is contained in:
Tobie Morgan Hitchcock 2022-07-23 15:48:48 +01:00
parent 428fcf697a
commit db2208a33a
2 changed files with 6 additions and 6 deletions

View file

@ -2,12 +2,6 @@ use crate::cnf::PKG_NAME;
use crate::cnf::PKG_VERS; use crate::cnf::PKG_VERS;
use crate::err::Error; use crate::err::Error;
macro_rules! get_cfg {
($i:ident : $($s:expr),+) => (
let $i = || { $( if cfg!($i=$s) { return $s; } );+ "unknown"};
)
}
pub fn init(_: &clap::ArgMatches) -> Result<(), Error> { pub fn init(_: &clap::ArgMatches) -> Result<(), Error> {
get_cfg!(target_os: "windows", "macos", "ios", "linux", "android", "freebsd", "openbsd", "netbsd"); get_cfg!(target_os: "windows", "macos", "ios", "linux", "android", "freebsd", "openbsd", "netbsd");
get_cfg!(target_arch: "x86", "x86_64", "mips", "powerpc", "powerpc64", "arm", "aarch64"); get_cfg!(target_arch: "x86", "x86_64", "mips", "powerpc", "powerpc64", "arm", "aarch64");

View file

@ -13,3 +13,9 @@ macro_rules! mrg {
$($m)+ $($m)+
}}; }};
} }
macro_rules! get_cfg {
($i:ident : $($s:expr),+) => (
let $i = || { $( if cfg!($i=$s) { return $s; } );+ "unknown"};
)
}