pragma

How to disable all warnings using pragma directives in GCC

萝らか妹 提交于 2021-02-07 04:56:52
问题 I am seeking for a way to suppress all possible warnings that i may get with Gcc with pragma directives. I had made some guard macros that help me silence 3rd party headers from warnings, and for now they work like charm for msvc and clang. I am still missing the correct way to use Gcc diagnostic pragmas in order to suppress every warning in a section. Let me give you some examples: In msvc we can do this: #pragma warning(push, 0) // Code that produces warnings... #pragma warning(pop) And in

How to disable all warnings using pragma directives in GCC

*爱你&永不变心* 提交于 2021-02-07 04:56:23
问题 I am seeking for a way to suppress all possible warnings that i may get with Gcc with pragma directives. I had made some guard macros that help me silence 3rd party headers from warnings, and for now they work like charm for msvc and clang. I am still missing the correct way to use Gcc diagnostic pragmas in order to suppress every warning in a section. Let me give you some examples: In msvc we can do this: #pragma warning(push, 0) // Code that produces warnings... #pragma warning(pop) And in

How to hint to GCC that a line should be unreachable at compile time?

余生长醉 提交于 2020-12-25 01:55:10
问题 It's common for compilers to provide a switch to warn when code is unreachable. I've also seen macros for some libraries, that provide assertions for unreachable code. Is there a hint, such as through a pragma, or builtin that I can pass to GCC (or any other compilers for that matter), that will warn or error during compilation if it's determined that a line expected to be unreachable can actually be reached? Here's an example: if (!conf->devpath) { conf->devpath = arg; return 0; } // pass

How to hint to GCC that a line should be unreachable at compile time?

烂漫一生 提交于 2020-12-25 01:52:29
问题 It's common for compilers to provide a switch to warn when code is unreachable. I've also seen macros for some libraries, that provide assertions for unreachable code. Is there a hint, such as through a pragma, or builtin that I can pass to GCC (or any other compilers for that matter), that will warn or error during compilation if it's determined that a line expected to be unreachable can actually be reached? Here's an example: if (!conf->devpath) { conf->devpath = arg; return 0; } // pass

How to hint to GCC that a line should be unreachable at compile time?

╄→尐↘猪︶ㄣ 提交于 2020-12-25 01:50:49
问题 It's common for compilers to provide a switch to warn when code is unreachable. I've also seen macros for some libraries, that provide assertions for unreachable code. Is there a hint, such as through a pragma, or builtin that I can pass to GCC (or any other compilers for that matter), that will warn or error during compilation if it's determined that a line expected to be unreachable can actually be reached? Here's an example: if (!conf->devpath) { conf->devpath = arg; return 0; } // pass

What does #pragma unroll do exactly? Does it affect the number of threads?

孤人 提交于 2020-11-30 02:38:02
问题 I'm new to CUDA, and I can't understand loop unrolling. I've written a piece of code to understand the technique __global__ void kernel(float *b, int size) { int tid = blockDim.x * blockIdx.x + threadIdx.x; #pragma unroll for(int i=0;i<size;i++) b[i]=i; } Above is my kernel function. In main I call it like below int main() { float * a; //host array float * b; //device array int size=100; a=(float*)malloc(size*sizeof(float)); cudaMalloc((float**)&b,size); cudaMemcpy(b, a, size,

What does #pragma unroll do exactly? Does it affect the number of threads?

时间秒杀一切 提交于 2020-11-30 02:37:02
问题 I'm new to CUDA, and I can't understand loop unrolling. I've written a piece of code to understand the technique __global__ void kernel(float *b, int size) { int tid = blockDim.x * blockIdx.x + threadIdx.x; #pragma unroll for(int i=0;i<size;i++) b[i]=i; } Above is my kernel function. In main I call it like below int main() { float * a; //host array float * b; //device array int size=100; a=(float*)malloc(size*sizeof(float)); cudaMalloc((float**)&b,size); cudaMemcpy(b, a, size,

How to disable fast math for a header file function

别说谁变了你拦得住时间么 提交于 2020-06-01 05:12:49
问题 How do I disable fast math for a function defined in header file or for the entire source file? #pragma GCC optimize ("no-fast-math") Adding the line above to both (source file and header file) doesn't seem to work in this case. 来源: https://stackoverflow.com/questions/61941592/how-to-disable-fast-math-for-a-header-file-function