async_tensorrt/ffi/pre/
helpers.rs

1use cpp::cpp;
2
3cpp! {{
4    // Simple wrapper function for all destroyable TensorRT classes. Their
5    // destroy methods are all deprecated but still required to correctly
6    // free resources so we need them anyway. This function will make sure
7    // that any deprecation warnings are ignored.
8    template<typename T>
9    void destroy(T* destroyable) {
10        #pragma GCC diagnostic push
11        #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
12        #if NV_TENSORRT_MAJOR >= 10
13        delete destroyable;
14        #else
15        destroyable->destroy();
16        #endif
17        #pragma GCC diagnostic pop
18    }
19}}