dlib icon indicating copy to clipboard operation
dlib copied to clipboard

Allow attributes in macro invocations

Open ids1024 opened this issue 1 year ago • 3 comments

Allows #[cfg] to be used to make certain definitions conditional. Such as for library version feature flags.

Needed for https://github.com/Smithay/wayland-rs/pull/735 so it can have a feature flag for the libwayland version.

Seems to work, but still needs to be added to dlib-test, with CI to test with and without the feature.

ids1024 avatar Oct 15 '24 00:10 ids1024

Added some testing improvements. I see some issues trying to test statics: and varargs: (https://github.com/elinorbgr/dlib/issues/23, https://github.com/elinorbgr/dlib/issues/24), but I think the changes here are good, and aren't causing issues that don't already exist.

I don't think those block this from being merged and released. Though a semver breaking version of the crate will probably be needed at some point to fix those.

ids1024 avatar Oct 16 '24 20:10 ids1024

Just to confirm, have you tested that this changes actually makes it possible to add a feature flag to https://github.com/Smithay/wayland-rs/pull/735 ?

elinorbgr avatar Oct 30 '24 08:10 elinorbgr

Yes. Simply adding #[cfg(feature = "libwayland_1_22")] appears to work as expected in wayland-sys if it uses this version of dlib.

ids1024 avatar Oct 31 '24 23:10 ids1024