When code depends on environment/build features (SIMD/FP16 availability, OpenCV versioned APIs, packing layout support, OS/ABI-specific macros), you must (1) gate the code at compile time with the correct macros and (2) reflect the real capability in the backend’s support_* flags so the framework won’t select an unsupported execution path.

Apply this as a standard checklist:

Example patterns:

// 1) Version-gated optional headers
#if (CV_MAJOR_VERSION >= 3)
#include <opencv2/videoio/videoio.hpp>
#endif

// 2) SIMD/FP16 gated implementation
#if defined(__ARM_NEON) && (__ARM_FP & 2)
static int lstm_fp16(...){ /* fp16 NEON path */ }
#endif

// 3) Capability flags match implementation
int InnerProduct_arm::create_pipeline(const Option& opt)
{
    if (axis == 1)
        support_packing = false; // packing/layout not implemented for this axis
    return 0;
}

// 4) If you disable packing support, don’t keep unpacking logic around
if (!support_vulkan_packing && !support_vulkan_any_packing)
{
    // avoid selecting unpack/convert glue; only accept supported layouts
}

This prevents build-breaks on unsupported platforms, avoids dead/incorrect code paths, and ensures runtime execution matches what the backend actually supports.