Cycles: Use falltrhough attribute to help catching missing break statements
This commit is contained in:
@@ -195,7 +195,7 @@ template<typename T> struct texture_image {
|
||||
if(x < 0.0f || y < 0.0f || x > 1.0f || y > 1.0f) {
|
||||
return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
/* Fall through. */
|
||||
ATTR_FALLTHROUGH;
|
||||
case EXTENSION_EXTEND:
|
||||
ix = wrap_clamp(ix, width);
|
||||
iy = wrap_clamp(iy, height);
|
||||
@@ -222,7 +222,7 @@ template<typename T> struct texture_image {
|
||||
if(x < 0.0f || y < 0.0f || x > 1.0f || y > 1.0f) {
|
||||
return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
/* Fall through. */
|
||||
ATTR_FALLTHROUGH;
|
||||
case EXTENSION_EXTEND:
|
||||
nix = wrap_clamp(ix+1, width);
|
||||
niy = wrap_clamp(iy+1, height);
|
||||
@@ -265,7 +265,7 @@ template<typename T> struct texture_image {
|
||||
if(x < 0.0f || y < 0.0f || x > 1.0f || y > 1.0f) {
|
||||
return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
/* Fall through. */
|
||||
ATTR_FALLTHROUGH;
|
||||
case EXTENSION_EXTEND:
|
||||
pix = wrap_clamp(ix-1, width);
|
||||
piy = wrap_clamp(iy-1, height);
|
||||
@@ -335,7 +335,7 @@ template<typename T> struct texture_image {
|
||||
{
|
||||
return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
/* Fall through. */
|
||||
ATTR_FALLTHROUGH;
|
||||
case EXTENSION_EXTEND:
|
||||
ix = wrap_clamp(ix, width);
|
||||
iy = wrap_clamp(iy, height);
|
||||
@@ -374,7 +374,7 @@ template<typename T> struct texture_image {
|
||||
{
|
||||
return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
/* Fall through. */
|
||||
ATTR_FALLTHROUGH;
|
||||
case EXTENSION_EXTEND:
|
||||
nix = wrap_clamp(ix+1, width);
|
||||
niy = wrap_clamp(iy+1, height);
|
||||
@@ -449,7 +449,7 @@ template<typename T> struct texture_image {
|
||||
{
|
||||
return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
/* Fall through. */
|
||||
ATTR_FALLTHROUGH;
|
||||
case EXTENSION_EXTEND:
|
||||
pix = wrap_clamp(ix-1, width);
|
||||
piy = wrap_clamp(iy-1, height);
|
||||
|
@@ -55,6 +55,8 @@
|
||||
#define ccl_restrict __restrict__
|
||||
#define ccl_align(n) __align__(n)
|
||||
|
||||
#define ATTR_FALLTHROUGH
|
||||
|
||||
#define CCL_MAX_LOCAL_SIZE (CUDA_THREADS_BLOCK_WIDTH*CUDA_THREADS_BLOCK_WIDTH)
|
||||
|
||||
|
||||
|
@@ -50,6 +50,8 @@
|
||||
# define ccl_addr_space
|
||||
#endif
|
||||
|
||||
#define ATTR_FALLTHROUGH
|
||||
|
||||
#define ccl_local_id(d) get_local_id(d)
|
||||
#define ccl_global_id(d) get_global_id(d)
|
||||
|
||||
|
@@ -684,6 +684,7 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *
|
||||
#ifdef __CAUSTICS_TRICKS__
|
||||
if(!kernel_data.integrator.caustics_reflective && (path_flag & PATH_RAY_DIFFUSE))
|
||||
break;
|
||||
ATTR_FALLTHROUGH;
|
||||
#endif
|
||||
case CLOSURE_BSDF_DIFFUSE_TOON_ID: {
|
||||
float3 weight = sd->svm_closure_weight * mix_weight;
|
||||
|
@@ -68,6 +68,13 @@
|
||||
# define ccl_never_inline __attribute__((noinline))
|
||||
# define ccl_maybe_unused __attribute__((used))
|
||||
# endif /* _WIN32 && !FREE_WINDOWS */
|
||||
|
||||
/* Use to suppress '-Wimplicit-fallthrough' (in place of 'break'). */
|
||||
# if defined(__GNUC__) && (__GNUC__ >= 7) /* gcc7.0+ only */
|
||||
# define ATTR_FALLTHROUGH __attribute__((fallthrough))
|
||||
# else
|
||||
# define ATTR_FALLTHROUGH ((void)0)
|
||||
# endif
|
||||
#endif /* __KERNEL_GPU__ */
|
||||
|
||||
/* Standard Integer Types */
|
||||
|
Reference in New Issue
Block a user