Controlling warnings in device code

I’m having trouble disabling warnings inside kernels. I have a template CUDA kernel that does something like:

template<uint i>
__global__ void warning() {
    if (i > 0)
        for (uint j = 0; j < i; ++j);
}

int main(int argc, char **argv) {
    warning<0><<<1,256>>>();
    cudaDeviceSynchronize();
    return 0;
}

When I compile this code I get the following (useless) warning:
warning.cu(4): warning: pointless comparison of unsigned integer with zero
detected during instantiation of “void warning() [with i=0U]”
(8): here

Is there any way to disable warnings on specific lines within a kernel?

Isn’t that really a pointless comparison though? Why not just fix the code?

template<uint i>
__global__ void warning() {
for (uint j = 0; j < i; ++j);
}

This code shouldn’t enter the loop when i == 0.

The warning is given for the loop, not the branch. Removing the if still gives the warning for the loop.

Since i is known at compile time, the loop after the branch is unreachable and I figured it would shut the compiler up, but it doesn’t.