TheDan64 / inkwell

It's a New Kind of Wrapper for Exposing LLVM (Safely)
https://thedan64.github.io/inkwell/
Apache License 2.0
2.22k stars 217 forks source link

Update `llvm_versions` macro syntax to match Rust ranges #493

Closed DaniPopes closed 1 month ago

DaniPopes commented 2 months ago

Description

Refactor the llvm_versions internal macro implementation and update its syntax to more closely match normal Rust syntax.

This means removing the latest special case in favor of half-open ranges (x..) and allowing to specify up to x (..x). This is also useful to have 2 different implementations of a function that changed at version y by having two items with llvm_version(..y) and llvm_version(y..), just like when slicing a string or a vector.

Since currently all supported versions are <major>.0.0, I've also allowed version specifiers to be just integers which represent just the major version.

This refactoring is in preparation to add a new cfg_attr-style macro for conditional attributes, for example deprecated, and to migrate remaining manual #[cfg(any(...))] to this macro.

The enum macro implementation is untouched, it was just moved to its own module.

How This Has Been Tested

Compiling a few selected LLVM versions.

Option\<Breaking Changes>

Only to the llvm_versions internal macro.

Checklist