diff libpam-sys/src/constants.rs @ 134:6c1e1bdb4164

Use standard #[cfg] directives rather than custom proc macros. Instead of having to do a bunch of custom parsing and other logic that tools often choke on, this change introduces an easy way to depend upon custom #[cfg]s provided by the libpam-sys crate.
author Paul Fisher <paul@pfish.zone>
date Thu, 03 Jul 2025 11:03:36 -0400
parents 32b2a545ca3e
children
line wrap: on
line diff
--- a/libpam-sys/src/constants.rs	Wed Jul 02 03:33:09 2025 -0400
+++ b/libpam-sys/src/constants.rs	Thu Jul 03 11:03:36 2025 -0400
@@ -3,8 +3,6 @@
 //! These constants are tested on a per-platform basis by `libpam-sys-test`'s
 //! `test_constants.rs`.
 
-use libpam_sys_impls::cfg_pam_impl;
-
 /// Macro to make defining a bunch of constants way easier.
 macro_rules! define {
     ($(#[$attr:meta])* $($name:ident = $value:expr);+$(;)?) => {
@@ -70,9 +68,9 @@
     PAM_MAX_RESP_SIZE = 512;
 );
 
-#[cfg_pam_impl("LinuxPam")]
+#[cfg(pam_impl = "LinuxPam")]
 pub use linux_pam::*;
-#[cfg_pam_impl("LinuxPam")]
+#[cfg(pam_impl = "LinuxPam")]
 mod linux_pam {
     c_enum!(
         /// An error return code.
@@ -147,9 +145,9 @@
     pub const PAM_MODUTIL_NGROUPS: i32 = 64;
 }
 
-#[cfg_pam_impl(any("OpenPam", "Sun", "XSso"))]
+#[cfg(any(pam_impl = "OpenPam", pam_impl = "Sun", pam_impl = "XSso"))]
 pub use xsso_shared::*;
-#[cfg_pam_impl(any("OpenPam", "Sun", "XSso"))]
+#[cfg(any(pam_impl = "OpenPam", pam_impl = "Sun", pam_impl = "XSso"))]
 mod xsso_shared {
     c_enum!(
         /// An error return code.
@@ -206,9 +204,9 @@
     );
 }
 
-#[cfg_pam_impl("OpenPam")]
+#[cfg(pam_impl = "OpenPam")]
 pub use openpam::*;
-#[cfg_pam_impl("OpenPam")]
+#[cfg(pam_impl = "OpenPam")]
 mod openpam {
     c_enum!(
         /// An error return code.
@@ -266,9 +264,9 @@
 }
 
 /// Constants exclusive to Illumos.
-#[cfg_pam_impl("Sun")]
+#[cfg(pam_impl = "Sun")]
 pub use sun::*;
-#[cfg_pam_impl("Sun")]
+#[cfg(pam_impl = "Sun")]
 mod sun {
     /// The total number of PAM error codes.
     pub const PAM_TOTAL_ERRNUM: i32 = 28;