Unverified Commit ded35731 authored by Alex Gaynor's avatar Alex Gaynor Committed by GitHub
Browse files

Merge pull request #1863 from alex/drop-autocfg

Drop dependency on autocfg
parents 9d91e732 c906f184
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@ bindgen = { version = "0.64.0", optional = true, features = ["experimental"] }
cc = "1.0"
openssl-src = { version = "111", optional = true }
pkg-config = "0.3.9"
autocfg = "1.0"

[target.'cfg(target_env = "msvc")'.build-dependencies]
vcpkg = "0.2.8"
+0 −11
Original line number Diff line number Diff line
@@ -4,7 +4,6 @@
    clippy::unusual_byte_groupings
)]

extern crate autocfg;
#[cfg(feature = "bindgen")]
extern crate bindgen;
extern crate cc;
@@ -74,8 +73,6 @@ fn check_ssl_kind() {
}

fn main() {
    check_rustc_versions();

    check_ssl_kind();

    let target = env::var("TARGET").unwrap();
@@ -134,14 +131,6 @@ fn main() {
    }
}

fn check_rustc_versions() {
    let cfg = autocfg::new();

    if cfg.probe_rustc_version(1, 31) {
        println!("cargo:rustc-cfg=const_fn");
    }
}

#[allow(clippy::let_and_return)]
fn postprocess(include_dirs: &[PathBuf]) -> Version {
    let version = validate_headers(include_dirs);
+32 −36
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ cfg_if! {

        pub const ERR_RFLAG_FATAL: c_ulong = 0x1 << ERR_RFLAGS_OFFSET;

        const_fn! {
        pub const fn ERR_SYSTEM_ERROR(errcode: c_ulong) -> bool {
            errcode & ERR_SYSTEM_FLAG != 0
        }
@@ -45,9 +44,7 @@ cfg_if! {
            ((lib as c_ulong & ERR_LIB_MASK) << ERR_LIB_OFFSET) |
            (reason as c_ulong & ERR_REASON_MASK)
        }
        }
    } else {
        const_fn! {
        pub const fn ERR_PACK(l: c_int, f: c_int, r: c_int) -> c_ulong {
            ((l as c_ulong & 0x0FF) << 24) |
            ((f as c_ulong & 0xFFF) << 12) |
@@ -67,4 +64,3 @@ cfg_if! {
        }
    }
}
}
+0 −18
Original line number Diff line number Diff line
@@ -70,24 +70,6 @@ macro_rules! stack {
    };
}

#[cfg(const_fn)]
macro_rules! const_fn {
    ($(pub const fn $name:ident($($arg:ident: $t:ty),*) -> $ret:ty $b:block)*) => {
        $(
            pub const fn $name($($arg: $t),*) -> $ret $b
        )*
    }
}

#[cfg(not(const_fn))]
macro_rules! const_fn {
    ($(pub const fn $name:ident($($arg:ident: $t:ty),*) -> $ret:ty $b:block)*) => {
        $(
            pub fn $name($($arg: $t),*) -> $ret $b
        )*
    }
}

// openssl changes `*mut` to `*const` in certain parameters in certain versions;
// in C this is ABI and (mostly) API compatible.
//