kenba/opencl3

Putting deprecation notices behind conditional attributes

Closed this issue · 2 comments

vmx commented

I'm compiling with only the CL_VERSION_1_2 feature set. When I use CommandQueue::create() I get a deprecation warning like this:

warning: use of deprecated associated function `opencl3::command_queue::CommandQueue::create`: From CL_VERSION_2_0 use create_command_queue_with_properties

This doesn't really apply, as I'm not using OpenCL 2.0.

I suggest enabling this warning only if CL_VERSION_2_0 or above is set via cfg_attr. In this case it would like like this:

    #[cfg_attr(any(feature = "CL_VERSION_2_0", feature = "CL_VERSION_2_1", feature = "CL_VERSION_2_2", feature = "CL_VERSION_3_0"), deprecated(
        since = "0.1.0",
        note = "From CL_VERSION_2_0 use create_command_queue_with_properties"
    ))]
kenba commented

Thanks Volker, that's a great way of tying the deprecated notices to the correct OpenCL versions!

I've changed all the deprecated methods in this crate. I'll now go back to cl3 and opencl-sys and fix the deprecated functions in those crates.

kenba commented

Changes pushed to crates.io.