CMake: Use GCC7's -Wimplicit-fallthrough=5
authorCampbell Barton <ideasman42@gmail.com>
Sat, 20 May 2017 04:01:03 +0000 (14:01 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 20 May 2017 04:01:03 +0000 (14:01 +1000)
Use to avoid accidental missing break statements,
use ATTR_FALLTHROUGH to suppress.

44 files changed:
CMakeLists.txt
intern/string/STR_HashedString.h
source/blender/alembic/intern/abc_curves.cc
source/blender/blenkernel/intern/image.c
source/blender/blenkernel/intern/mball_tessellate.c
source/blender/blenkernel/intern/packedFile.c
source/blender/blenkernel/intern/particle.c
source/blender/blenkernel/intern/rigidbody.c
source/blender/blenlib/BLI_compiler_attrs.h
source/blender/blenlib/intern/hash_mm2a.c
source/blender/blenlib/intern/string.c
source/blender/blenlib/intern/string_utf8.c
source/blender/blenloader/intern/readfile.c
source/blender/editors/animation/anim_draw.c
source/blender/editors/animation/anim_markers.c
source/blender/editors/interface/interface_handlers.c
source/blender/editors/mask/mask_ops.c
source/blender/editors/render/render_opengl.c
source/blender/editors/space_clip/space_clip.c
source/blender/editors/space_clip/tracking_ops.c
source/blender/editors/space_clip/tracking_ops_plane.c
source/blender/editors/space_image/image_buttons.c
source/blender/editors/space_nla/nla_draw.c
source/blender/editors/space_sequencer/sequencer_edit.c
source/blender/editors/space_text/space_text.c
source/blender/editors/space_text/text_autocomplete.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform_manipulator.c
source/blender/editors/transform/transform_orientations.c
source/blender/editors/util/numinput.c
source/blender/editors/uvedit/uvedit_smart_stitch.c
source/blender/gpu/intern/gpu_debug.c
source/blender/python/intern/bpy_rna.c
source/blender/python/mathutils/mathutils_Color.c
source/blender/python/mathutils/mathutils_Euler.c
source/blender/python/mathutils/mathutils_Matrix.c
source/blender/python/mathutils/mathutils_Quaternion.c
source/blender/render/intern/source/render_texture.c
source/blender/render/intern/source/volumetric.c
source/gameengine/Expressions/intern/PyObjectPlus.cpp
source/gameengine/GameLogic/SCA_PropertySensor.cpp
source/gameengine/Ketsji/KX_ObstacleSimulation.cpp
source/gameengine/Ketsji/KX_SoundActuator.cpp

index 1dac082459f17bd2ec3e5e44d0dd39e6a3c04d6d..2284146b3ab1bdf3d4b819745039e2d2cacbb3cb 100644 (file)
@@ -1380,9 +1380,16 @@ if(CMAKE_COMPILER_IS_GNUCC)
                ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_MISSING_DECLARATIONS -Wmissing-declarations)
        endif()
 
+       # Use 'ATTR_FALLTHROUGH' macro to suppress.
+       if(CMAKE_COMPILER_IS_GNUCC AND (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "7.0"))
+               ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_IMPLICIT_FALLTHROUGH -Wimplicit-fallthrough=5)
+               ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_IMPLICIT_FALLTHROUGH -Wimplicit-fallthrough=5)
+       endif()
+
        # flags to undo strict flags
        ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_DEPRECATED_DECLARATIONS -Wno-deprecated-declarations)
        ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER        -Wno-unused-parameter)
+       ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_IMPLICIT_FALLTHROUGH    -Wno-implicit-fallthrough)
 
        if(NOT APPLE)
                ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_ERROR_UNUSED_BUT_SET_VARIABLE -Wno-error=unused-but-set-variable)
index 8bfbde65895ba59ecc1ef4b0ba1cc3a820e8a120..ce790f398a093d7d5bd151868d06bac953435adb 100644 (file)
 
 #include "STR_String.h"
 
+/* copied from 'BLI_compiler_attrs.h' */
+/* 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
+
 
 // Hash Mix utility function, by Bob Jenkins - Mix 3 32-bit values reversibly
 //
@@ -102,16 +110,16 @@ static dword STR_gHash(const void *in, int len, dword init_val)
        // Handle the last 11 bytes
        c += len;
        switch (length) {
-               case 11: c += ((dword)p_in[10] << 24);
-               case 10: c += ((dword)p_in[9]  << 16);
-               case  9: c += ((dword)p_in[8]  << 8);  /* the first byte of c is reserved for the length */
-               case  8: b += ((dword)p_in[7]  << 24);
-               case  7: b += ((dword)p_in[6]  << 16);
-               case  6: b += ((dword)p_in[5]  << 8);
-               case  5: b += p_in[4];
-               case  4: a += ((dword)p_in[3]  << 24);
-               case  3: a += ((dword)p_in[2]  << 16);
-               case  2: a += ((dword)p_in[1]  << 8);
+               case 11: c += ((dword)p_in[10] << 24); ATTR_FALLTHROUGH;
+               case 10: c += ((dword)p_in[9]  << 16); ATTR_FALLTHROUGH;
+               case  9: c += ((dword)p_in[8]  << 8);  ATTR_FALLTHROUGH; /* the first byte of c is reserved for the length */
+               case  8: b += ((dword)p_in[7]  << 24); ATTR_FALLTHROUGH;
+               case  7: b += ((dword)p_in[6]  << 16); ATTR_FALLTHROUGH;
+               case  6: b += ((dword)p_in[5]  << 8);  ATTR_FALLTHROUGH;
+               case  5: b += p_in[4];                 ATTR_FALLTHROUGH;
+               case  4: a += ((dword)p_in[3]  << 24); ATTR_FALLTHROUGH;
+               case  3: a += ((dword)p_in[2]  << 16); ATTR_FALLTHROUGH;
+               case  2: a += ((dword)p_in[1]  << 8);  ATTR_FALLTHROUGH;
                case  1: a += p_in[0];
        }
        STR_gHashMix(a, b, c);
index 67b2cb8ae8c1b545a3c2ade33258f8ab4088e9e2..f54abd6563ece5009c0591252dab58399c2c7683 100644 (file)
@@ -297,6 +297,7 @@ void read_curve_sample(Curve *cu, const ICurvesSchema &schema, const ISampleSele
                                        nu->orderu = static_cast<short>((*orders)[i]);
                                        break;
                                }
+                               ATTR_FALLTHROUGH;
                        case Alembic::AbcGeom::kLinear:
                        default:
                                nu->orderu = 2;
index 2db13f9c7787619db1931f481cfacf8a751febfb..026e8aea74f13994f0b723a9fda0182d7faacf3b 100644 (file)
@@ -1238,7 +1238,7 @@ char BKE_imtype_valid_channels(const char imtype, bool write_file)
        switch (imtype) {
                case R_IMF_IMTYPE_BMP:
                        if (write_file) break;
-                       /* fall-through */
+                       ATTR_FALLTHROUGH;
                case R_IMF_IMTYPE_TARGA:
                case R_IMF_IMTYPE_RAWTGA:
                case R_IMF_IMTYPE_IRIS:
index c8b75f3e457fc24ebfe4141e6555c261e3d1be8e..76965176be82325262d669763d22b8be0a5ba26b 100644 (file)
@@ -316,12 +316,12 @@ static float densfunc(const MetaElem *ball, float x, float y, float z)
                        if      (dvec[2] > ball->expz)  dvec[2] -= ball->expz;
                        else if (dvec[2] < -ball->expz) dvec[2] += ball->expz;
                        else                            dvec[2] = 0.0;
-                       /* fall through */
+                       ATTR_FALLTHROUGH;
                case MB_PLANE:
                        if      (dvec[1] >  ball->expy) dvec[1] -= ball->expy;
                        else if (dvec[1] < -ball->expy) dvec[1] += ball->expy;
                        else                            dvec[1] = 0.0;
-                       /* fall through */
+                       ATTR_FALLTHROUGH;
                case MB_TUBE:
                        if      (dvec[0] >  ball->expx) dvec[0] -= ball->expx;
                        else if (dvec[0] < -ball->expx) dvec[0] += ball->expx;
@@ -1194,10 +1194,10 @@ static void init_meta(EvaluationContext *eval_ctx, PROCESS *process, Scene *scen
                                                                break;
                                                        case MB_CUBE: /* cube is "expanded" by expz, expy and expx */
                                                                expz += ml->expz;
-                                                               /* fall through */
+                                                               ATTR_FALLTHROUGH;
                                                        case MB_PLANE: /* plane is "expanded" by expy and expx */
                                                                expy += ml->expy;
-                                                               /* fall through */
+                                                               ATTR_FALLTHROUGH;
                                                        case MB_TUBE: /* tube is "expanded" by expx */
                                                                expx += ml->expx;
                                                                break;
index 489fc2f371044c5c79cc45c7dc3829de811ccbb7..64f90ef5c520be61568451bd1b0bedd9abdd60fc 100644 (file)
@@ -450,7 +450,7 @@ char *unpackFile(ReportList *reports, const char *abs_name, const char *local_na
                                        break;
                                }
                                /* else create it */
-                               /* fall-through */
+                               ATTR_FALLTHROUGH;
                        }
                        case PF_WRITE_LOCAL:
                                if (writePackedFile(reports, local_name, pf, 1) == RET_OK) {
@@ -471,7 +471,7 @@ char *unpackFile(ReportList *reports, const char *abs_name, const char *local_na
                                        break;
                                }
                                /* else create it */
-                               /* fall-through */
+                               ATTR_FALLTHROUGH;
                        }
                        case PF_WRITE_ORIGINAL:
                                if (writePackedFile(reports, abs_name, pf, 1) == RET_OK) {
index 228ae6afaba2274ed393db53bd69746fd8c8e09a..bb5cea9dcc707a17f6c53c31c25c5124b8be33f7 100644 (file)
@@ -3466,7 +3466,8 @@ static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSetti
                                case TEXCO_UV:
                                        if (fw && get_particle_uv(dm, NULL, face_index, fw, mtex->uvname, texvec))
                                                break;
-                               /* no break, failed to get uv's, so let's try orco's */
+                                       /* no break, failed to get uv's, so let's try orco's */
+                                       ATTR_FALLTHROUGH;
                                case TEXCO_ORCO:
                                        copy_v3_v3(texvec, orco);
                                        break;
@@ -3538,7 +3539,8 @@ void psys_get_texture(ParticleSimulationData *sim, ParticleData *pa, ParticleTex
                                case TEXCO_UV:
                                        if (get_particle_uv(sim->psmd->dm_final, pa, 0, pa->fuv, mtex->uvname, texvec))
                                                break;
-                               /* no break, failed to get uv's, so let's try orco's */
+                                       /* no break, failed to get uv's, so let's try orco's */
+                                       ATTR_FALLTHROUGH;
                                case TEXCO_ORCO:
                                        psys_particle_on_emitter(sim->psmd, sim->psys->part->from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, co, 0, 0, 0, texvec, 0);
                                        
index 5353cc26295046a9d1b1a225173b04f581d350af..b3a36bfb08938c3cb2536e419a133dd028037dd7 100644 (file)
@@ -822,7 +822,7 @@ static void rigidbody_validate_sim_constraint(RigidBodyWorld *rbw, Object *ob, b
                                        RB_constraint_set_damping_6dof_spring(rbc->physics_constraint, RB_LIMIT_ANG_Z, rbc->spring_damping_ang_z);
 
                                        RB_constraint_set_equilibrium_6dof_spring(rbc->physics_constraint);
-                                       /* fall-through */
+                                       ATTR_FALLTHROUGH;
                                case RBC_TYPE_6DOF:
                                        if (rbc->type == RBC_TYPE_6DOF) /* a litte awkward but avoids duplicate code for limits */
                                                rbc->physics_constraint = RB_constraint_new_6dof(loc, rot, rb1, rb2);
index f0d32670229e761e9ec429af544cfb850dd56436..4c548654e33ff01267ac676f05463424beff1c90 100644 (file)
 #  define ATTR_PRINTF_FORMAT(format_param, dots_param)
 #endif
 
+/* 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  /* __BLI_COMPILER_ATTRS_H__ */
index af6ef4f355fcc2430affd9e3ca3ce8b254a100da..e8ca9244f25c26b05d0da199067f3144d417b634 100644 (file)
@@ -36,6 +36,8 @@
  *          for temporary data.
  */
 
+#include "BLI_compiler_attrs.h"
+
 #include "BLI_hash_mm2a.h"  /* own include */
 
 /* Helpers. */
@@ -128,10 +130,10 @@ uint32_t BLI_hash_mm2(const unsigned char *data, size_t len, uint32_t seed)
        switch (len) {
                case 3:
                        h ^= data[2] << 16;
-                       /* fall through */
+                       ATTR_FALLTHROUGH;
                case 2:
                        h ^= data[1] << 8;
-                       /* fall through */
+                       ATTR_FALLTHROUGH;
                case 1:
                        h ^= data[0];
                        h *= MM2A_M;
index f62ffe9e985ef0ab1c4e2f3f2a1f8bc08612aad2..6022732025b7994372a2d1b52a20e7763867020b 100644 (file)
@@ -332,7 +332,7 @@ size_t BLI_strescape(char *__restrict dst, const char *__restrict src, const siz
                                goto escape_finish;
                        case '\\':
                        case '"':
-                               /* fall-through */
+                               ATTR_FALLTHROUGH;
 
                        /* less common but should also be support */
                        case '\t':
@@ -346,7 +346,7 @@ size_t BLI_strescape(char *__restrict dst, const char *__restrict src, const siz
                                        /* not enough space to escape */
                                        break;
                                }
-                               /* fall-through */
+                               ATTR_FALLTHROUGH;
                        default:
                                *dst = *src;
                                break;
index 83d4a75952ffee4b131bb8f4658cb4e1c6906d75..b7e5e3e101ed5fd908a06967155f7699a99d5eb1 100644 (file)
@@ -205,11 +205,11 @@ int BLI_utf8_invalid_strip(char *str, size_t length)
                while (*src != '\0' && (utf8_size = utf8_skip_data[*src]) < maxncpy) {\
                        maxncpy -= utf8_size;                                             \
                        switch (utf8_size) {                                              \
-                               case 6: *dst ++ = *src ++;                                    \
-                               case 5: *dst ++ = *src ++;                                    \
-                               case 4: *dst ++ = *src ++;                                    \
-                               case 3: *dst ++ = *src ++;                                    \
-                               case 2: *dst ++ = *src ++;                                    \
+                               case 6: *dst ++ = *src ++; ATTR_FALLTHROUGH;                  \
+                               case 5: *dst ++ = *src ++; ATTR_FALLTHROUGH;                  \
+                               case 4: *dst ++ = *src ++; ATTR_FALLTHROUGH;                  \
+                               case 3: *dst ++ = *src ++; ATTR_FALLTHROUGH;                  \
+                               case 2: *dst ++ = *src ++; ATTR_FALLTHROUGH;                  \
                                case 1: *dst ++ = *src ++;                                    \
                        }                                                                 \
                }                                                                     \
index 1d74e126d955785543d66534d05bd478e8404de8..b909205392e33d5db319967852b19223b5a4cc64 100644 (file)
@@ -8685,7 +8685,8 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath)
                        /* in 2.50+ files, the file identifier for screens is patched, forward compatibility */
                case ID_SCRN:
                        bhead->code = ID_SCR;
-                       /* deliberate pass on to default */
+                       /* pass on to default */
+                       ATTR_FALLTHROUGH;
                default:
                        if (fd->skip_flags & BLO_READ_SKIP_DATA) {
                                bhead = blo_nextbhead(fd, bhead);
index 98900812bb2fa2498e5504f08d658a3a0aab8664..a6febdb575ed69f40b9f3bb5dd1537aaf8054445 100644 (file)
@@ -579,6 +579,7 @@ void ANIM_center_frame(struct bContext *C, int smooth_viewtx)
                                break;
                        }
                        /* else drop through, keep range instead */
+                       ATTR_FALLTHROUGH;
 
                case ZOOM_FRAME_MODE_KEEP_RANGE:
                default:
index 823cde75334c1c00caa62546ddabc9bdc7cc8797..aafd7ebb1f96f1bad637347eea49827cbf11163f 100644 (file)
@@ -888,7 +888,8 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, const wmEvent *even
                                        ed_marker_move_cancel(C, op);
                                        return OPERATOR_CANCELLED;
                                }
-                       /* else continue; <--- see if release event should be caught for tweak-end */
+                               /* else continue; <--- see if release event should be caught for tweak-end */
+                               ATTR_FALLTHROUGH;
 
                        case RETKEY:
                        case PADENTER:
index bb30f82729464fca3ce271376c11c08f474e2fd9..a3f0e29065d9da86850b55401d01dfcadbef1761 100644 (file)
@@ -3378,7 +3378,7 @@ static void ui_do_but_textedit(
                                if (event->type == WHEELDOWNMOUSE) {
                                        break;
                                }
-                               /* fall-through */
+                               ATTR_FALLTHROUGH;
                        case ENDKEY:
                                ui_textedit_move(but, data, STRCUR_DIR_NEXT,
                                                 event->shift != 0, STRCUR_JUMP_ALL);
@@ -3396,7 +3396,7 @@ static void ui_do_but_textedit(
                                if (event->type == WHEELUPMOUSE) {
                                        break;
                                }
-                               /* fall-through */
+                               ATTR_FALLTHROUGH;
                        case HOMEKEY:
                                ui_textedit_move(but, data, STRCUR_DIR_PREV,
                                                 event->shift != 0, STRCUR_JUMP_ALL);
@@ -8408,7 +8408,7 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but)
                        case MIDDLEMOUSE:
                        case MOUSEPAN:
                                UI_but_tooltip_timer_remove(C, but);
-                               /* fall-through */
+                               ATTR_FALLTHROUGH;
                        default:
                                /* handle button type specific events */
                                retval = ui_do_button(C, block, but, event);
@@ -9202,23 +9202,23 @@ static int ui_handle_menu_event(
                                        break;
 
                                case ONEKEY:    case PAD1:
-                                       act = 1;
+                                       act = 1; ATTR_FALLTHROUGH;
                                case TWOKEY:    case PAD2:
-                                       if (act == 0) act = 2;
+                                       if (act == 0) act = 2; ATTR_FALLTHROUGH;
                                case THREEKEY:  case PAD3:
-                                       if (act == 0) act = 3;
+                                       if (act == 0) act = 3; ATTR_FALLTHROUGH;
                                case FOURKEY:   case PAD4:
-                                       if (act == 0) act = 4;
+                                       if (act == 0) act = 4; ATTR_FALLTHROUGH;
                                case FIVEKEY:   case PAD5:
-                                       if (act == 0) act = 5;
+                                       if (act == 0) act = 5; ATTR_FALLTHROUGH;
                                case SIXKEY:    case PAD6:
-                                       if (act == 0) act = 6;
+                                       if (act == 0) act = 6; ATTR_FALLTHROUGH;
                                case SEVENKEY:  case PAD7:
-                                       if (act == 0) act = 7;
+                                       if (act == 0) act = 7; ATTR_FALLTHROUGH;
                                case EIGHTKEY:  case PAD8:
-                                       if (act == 0) act = 8;
+                                       if (act == 0) act = 8; ATTR_FALLTHROUGH;
                                case NINEKEY:   case PAD9:
-                                       if (act == 0) act = 9;
+                                       if (act == 0) act = 9; ATTR_FALLTHROUGH;
                                case ZEROKEY:   case PAD0:
                                        if (act == 0) act = 10;
 
@@ -9813,13 +9813,13 @@ static int ui_pie_handler(bContext *C, const wmEvent *event, uiPopupBlockHandle
                        case (ZEROKEY + n): case (PAD0 + n): \
                                { if (num_dir == UI_RADIAL_NONE) num_dir = d; } (void)0
 
-                               CASE_NUM_TO_DIR(1, UI_RADIAL_SW);
-                               CASE_NUM_TO_DIR(2, UI_RADIAL_S);
-                               CASE_NUM_TO_DIR(3, UI_RADIAL_SE);
-                               CASE_NUM_TO_DIR(4, UI_RADIAL_W);
-                               CASE_NUM_TO_DIR(6, UI_RADIAL_E);
-                               CASE_NUM_TO_DIR(7, UI_RADIAL_NW);
-                               CASE_NUM_TO_DIR(8, UI_RADIAL_N);
+                               CASE_NUM_TO_DIR(1, UI_RADIAL_SW); ATTR_FALLTHROUGH;
+                               CASE_NUM_TO_DIR(2, UI_RADIAL_S);  ATTR_FALLTHROUGH;
+                               CASE_NUM_TO_DIR(3, UI_RADIAL_SE); ATTR_FALLTHROUGH;
+                               CASE_NUM_TO_DIR(4, UI_RADIAL_W);  ATTR_FALLTHROUGH;
+                               CASE_NUM_TO_DIR(6, UI_RADIAL_E);  ATTR_FALLTHROUGH;
+                               CASE_NUM_TO_DIR(7, UI_RADIAL_NW); ATTR_FALLTHROUGH;
+                               CASE_NUM_TO_DIR(8, UI_RADIAL_N);  ATTR_FALLTHROUGH;
                                CASE_NUM_TO_DIR(9, UI_RADIAL_NE);
                                {
                                        but = ui_block_pie_dir_activate(block, event, num_dir);
index eef03852007232fa7c07c8cb2f37bb1497f93bcc..35de390274c5e21d13538791a164c66c2744a9b9 100644 (file)
@@ -889,7 +889,7 @@ static int slide_point_modal(bContext *C, wmOperator *op, const wmEvent *event)
                        if (ELEM(event->type, LEFTSHIFTKEY, RIGHTSHIFTKEY))
                                data->is_accurate = (event->val == KM_PRESS);
 
-                       /* fall-through */  /* update CV position */
+                       ATTR_FALLTHROUGH;  /* update CV position */
                case MOUSEMOVE:
                {
                        ScrArea *sa = CTX_wm_area(C);
@@ -1376,7 +1376,7 @@ static int slide_spline_curvature_modal(bContext *C, wmOperator *op, const wmEve
 
                        }
 
-                       /* fall-through */  /* update CV position */
+                       ATTR_FALLTHROUGH;  /* update CV position */
                case MOUSEMOVE:
                {
                        float B[2], mouse_coord[2], delta[2];
index c7ee57240cfab0a8c131f5364f23e689827c4274..01050eda70ba5d777bc82d096b3de566188bc490 100644 (file)
@@ -1083,7 +1083,7 @@ static int screen_opengl_render_modal(bContext *C, wmOperator *op, const wmEvent
                        /* render frame? */
                        if (oglrender->timer == event->customdata)
                                break;
-                       /* fall-through */
+                       ATTR_FALLTHROUGH;
                default:
                        /* nothing to do */
                        return OPERATOR_RUNNING_MODAL;
index 05e69968e356c47e7defe6168110599e5198ffcf..237082f948b789a5b6105368b29be1529d8617c0 100644 (file)
@@ -337,7 +337,7 @@ static void clip_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn)
                        switch (wmn->data) {
                                case ND_FRAME:
                                        clip_scopes_tag_refresh(sa);
-                                       /* fall-through */
+                                       ATTR_FALLTHROUGH;
 
                                case ND_FRAME_RANGE:
                                        ED_area_tag_redraw(sa);
index 169eb76399ba1a52572e56bf92d08dbdb826e1d9..56c240c3d208251992452be7b438874eb678f2bc 100644 (file)
@@ -875,8 +875,7 @@ static int slide_marker_modal(bContext *C, wmOperator *op, const wmEvent *event)
                        if (ELEM(event->type, LEFTSHIFTKEY, RIGHTSHIFTKEY)) {
                                data->accurate = event->val == KM_PRESS;
                        }
-
-                       /* fall-through */
+                       ATTR_FALLTHROUGH;
                case MOUSEMOVE:
                        mdelta[0] = event->mval[0] - data->mval[0];
                        mdelta[1] = event->mval[1] - data->mval[1];
index 4332f3ea7651f08ca906c55bf9a9e84fd35972cc..aa8518befaa2bcc4a81c75fb6836a34433c163bf 100644 (file)
@@ -301,8 +301,7 @@ static int slide_plane_marker_modal(bContext *C,
                        if (ELEM(event->type, LEFTSHIFTKEY, RIGHTSHIFTKEY)) {
                                data->accurate = event->val == KM_PRESS;
                        }
-
-                       /* fall-through */
+                       ATTR_FALLTHROUGH;
                case MOUSEMOVE:
                        mdelta[0] = event->mval[0] - data->previous_mval[0];
                        mdelta[1] = event->mval[1] - data->previous_mval[1];
index ad9fb49baef134dff23b472bb9759e5758617917..8037c2deb5bc84c5d02ee368134f3a28d36af724 100644 (file)
@@ -1208,7 +1208,7 @@ void uiTemplateImageStereo3d(uiLayout *layout, PointerRNA *stereo3d_format_ptr)
                case S3D_DISPLAY_SIDEBYSIDE:
                {
                        uiItemR(col, stereo3d_format_ptr, "use_sidebyside_crosseyed", 0, NULL, ICON_NONE);
-                       /* fall-through */
+                       ATTR_FALLTHROUGH;
                }
                case S3D_DISPLAY_TOPBOTTOM:
                {
index 93dcdbb5c026af2df36504b76b6bb6d91d2f0024..255fc0d6f8f5e266deb58f823ad5d3344908016c 100644 (file)
@@ -362,7 +362,7 @@ static void nla_draw_strip(SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStri
                                        glVertex2f(strip->start, yminc);
                                        glEnd();
                                }
-                               /* fall-through */
+                               ATTR_FALLTHROUGH;
 
                        /* this only draws after the strip */
                        case NLASTRIP_EXTEND_HOLD_FORWARD: 
index 8ae89941bdbb6e73677395ae287342f2bbb64fa2..2d6892c1091a74d4de7eda33a811b946b53b3489 100644 (file)
@@ -562,7 +562,7 @@ int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequen
                        }
                        if (seq1 == NULL) seq1 = seq2;
                        if (seq3 == NULL) seq3 = seq2;
-                       /* fall-through */
+                       ATTR_FALLTHROUGH;
                case 2:
                        if (seq1 == NULL || seq2 == NULL) {
                                *error_str = N_("2 selected sequence strips are needed");
index 686a10fc785bfecade38705dfc9b62e86e19e507..ca2380e510f9fdf645840a057aeed4f27d642f79 100644 (file)
@@ -158,7 +158,7 @@ static void text_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn)
                                        }
 
                                        ED_area_tag_redraw(sa);
-                                       /* fall-through */  /* fall down to tag redraw */
+                                       ATTR_FALLTHROUGH;  /* fall down to tag redraw */
                                case NA_ADDED:
                                case NA_REMOVED:
                                        ED_area_tag_redraw(sa);
index c38c57b952860e953495def09b836c763d15f7f1..9b0bd30ff11f993a44b58d19fda4d20dd8485dd6 100644 (file)
@@ -455,7 +455,7 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e
                        break;
                case PAGEDOWNKEY:
                        scroll = SUGG_LIST_SIZE - 1;
-                       /* fall-through */
+                       ATTR_FALLTHROUGH;
                case WHEELDOWNMOUSE:
                case DOWNARROWKEY:
                        if (event->val == KM_PRESS) {
@@ -489,7 +489,7 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e
                        break;
                case PAGEUPKEY:
                        scroll = SUGG_LIST_SIZE - 1;
-                       /* fall-through */
+                       ATTR_FALLTHROUGH;
                case WHEELUPMOUSE:
                case UPARROWKEY:
                        if (event->val == KM_PRESS) {
index a47623da56e30b276dd4c773d8645fdbfc1b8186..884bc6b83ba407cf0503d8f2ccf99100c0842382 100644 (file)
@@ -5120,7 +5120,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
                        copy_m4_m4(imat, rv3d->viewinv);
                        normalize_v3(imat[0]);
                        normalize_v3(imat[1]);
-                       /* fall-through */
+                       ATTR_FALLTHROUGH;
                case PART_DRAW_CROSS:
                case PART_DRAW_AXIS:
                        /* lets calculate the scale: */
index 7d9063c32855bb04d0fc42a33139182586e98409..cebc024fab96cd129356db5c6ad131b142a2e137 100644 (file)
@@ -1605,7 +1605,7 @@ static void drawArrow(ArrowDirection d, short offset, short length, short size)
                        offset = -offset;
                        length = -length;
                        size = -size;
-                       /* fall-through */
+                       ATTR_FALLTHROUGH;
                case RIGHT:
                        glBegin(GL_LINES);
                        glVertex2s(offset, 0);
@@ -1621,7 +1621,7 @@ static void drawArrow(ArrowDirection d, short offset, short length, short size)
                        offset = -offset;
                        length = -length;
                        size = -size;
-                       /* fall-through */
+                       ATTR_FALLTHROUGH;
                case UP:
                        glBegin(GL_LINES);
                        glVertex2s(0, offset);
@@ -1640,7 +1640,7 @@ static void drawArrowHead(ArrowDirection d, short size)
        switch (d) {
                case LEFT:
                        size = -size;
-                       /* fall-through */
+                       ATTR_FALLTHROUGH;
                case RIGHT:
                        glBegin(GL_LINES);
                        glVertex2s(0, 0);
@@ -1652,7 +1652,7 @@ static void drawArrowHead(ArrowDirection d, short size)
 
                case DOWN:
                        size = -size;
-                       /* fall-through */
+                       ATTR_FALLTHROUGH;
                case UP:
                        glBegin(GL_LINES);
                        glVertex2s(0, 0);
index 641e028a3cfa6d8a9085899095273761faecdf34..ab2a0225abcc7d37e899bb5f4be48551d357b9d5 100644 (file)
@@ -619,7 +619,7 @@ static int calc_manipulator_stats(const bContext *C)
                                        break;
                                }
                                /* if not gimbal, fall through to normal */
-                               /* fall-through */
+                               ATTR_FALLTHROUGH;
                        }
                        case V3D_MANIP_NORMAL:
                        {
@@ -630,7 +630,7 @@ static int calc_manipulator_stats(const bContext *C)
                                        break;
                                }
                                /* no break we define 'normal' as 'local' in Object mode */
-                               /* fall-through */
+                               ATTR_FALLTHROUGH;
                        }
                        case V3D_MANIP_LOCAL:
                        {
index 674d2c376bba3f486d575995d1edcac1b0f64ba4..23158495b44a220675d3e6944c2b93a859744898 100644 (file)
@@ -455,14 +455,14 @@ void initTransformOrientation(bContext *C, TransInfo *t)
                                BLI_strncpy(t->spacename, IFACE_("gimbal"), sizeof(t->spacename));
                                break;
                        }
-                       /* fall-through */  /* no gimbal fallthrough to normal */
+                       ATTR_FALLTHROUGH;  /* no gimbal fallthrough to normal */
                case V3D_MANIP_NORMAL:
                        if (obedit || (ob && ob->mode & OB_MODE_POSE)) {
                                BLI_strncpy(t->spacename, IFACE_("normal"), sizeof(t->spacename));
                                ED_getTransformOrientationMatrix(C, t->spacemtx, t->around);
                                break;
                        }
-                       /* fall-through */  /* we define 'normal' as 'local' in Object mode */
+                       ATTR_FALLTHROUGH;  /* we define 'normal' as 'local' in Object mode */
                case V3D_MANIP_LOCAL:
                        BLI_strncpy(t->spacename, IFACE_("local"), sizeof(t->spacename));
                
index 3727be1842ccc1582ee1ab96ed1d66a9be843a80..61142fdc8876e090da7a34fe896965b794782e37 100644 (file)
@@ -296,7 +296,7 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event)
                        }
                        /* Else, common behavior with DELKEY, only difference is remove char(s) before/after the cursor. */
                        dir = STRCUR_DIR_PREV;
-                       /* fall-through */
+                       ATTR_FALLTHROUGH;
                case DELKEY:
                        if ((n->val_flag[idx] & NUM_EDITED) && n->str[0]) {
                                int t_cur = cur = n->str_cur;
@@ -322,7 +322,7 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event)
                        break;
                case LEFTARROWKEY:
                        dir = STRCUR_DIR_PREV;
-                       /* fall-through */
+                       ATTR_FALLTHROUGH;
                case RIGHTARROWKEY:
                        cur = n->str_cur;
                        if (event->ctrl) {
index 50aec737c8ef0ebe05be7434b4009cd10be8e66c..d5233f0ed28e2ae57c43d37fc2b2f07a96e90984 100644 (file)
@@ -2116,6 +2116,7 @@ static int stitch_modal(bContext *C, wmOperator *op, const wmEvent *event)
                                }
                                break;
                        }
+                       ATTR_FALLTHROUGH;
                case PADENTER:
                case RETKEY:
                        if (event->val == KM_PRESS) {
index ba68d1a6a0fcdce5b0bf144faea364b50fb9f55c..7a0562617d67506797b7322011e67e48c883674e 100644 (file)
@@ -29,6 +29,7 @@
  *  \ingroup gpu
  */
 
+#include "BLI_compiler_attrs.h"
 #include "BLI_utildefines.h"
 #include "BLI_sys_types.h"
 #include "BLI_system.h"
@@ -219,7 +220,7 @@ static void APIENTRY gpu_debug_proc(
        switch (severity) {
                case GL_DEBUG_SEVERITY_HIGH:
                        backtrace = true;
-                       /* fall through */
+                       ATTR_FALLTHROUGH;
                case GL_DEBUG_SEVERITY_MEDIUM:
                case GL_DEBUG_SEVERITY_LOW:
                case GL_DEBUG_SEVERITY_NOTIFICATION: /* KHR has this, ARB does not */
@@ -249,7 +250,7 @@ static void APIENTRY gpu_debug_proc_amd(
        switch (severity) {
                case GL_DEBUG_SEVERITY_HIGH:
                        backtrace = true;
-                       /* fall through */
+                       ATTR_FALLTHROUGH;
                case GL_DEBUG_SEVERITY_MEDIUM:
                case GL_DEBUG_SEVERITY_LOW:
                        fprintf(stderr, "GL %s: %s\n", category_name_amd(category), message);
index 7b9019e202ebbb35010d7097a99ca1d7aa037e18..6613bb8a5f7a60570d869b2693fa8abe48524fbd 100644 (file)
@@ -806,7 +806,7 @@ static PyObject *pyrna_struct_richcmp(PyObject *a, PyObject *b, int op)
        switch (op) {
                case Py_NE:
                        ok = !ok;
-                       /* fall-through */
+                       ATTR_FALLTHROUGH;
                case Py_EQ:
                        res = ok ? Py_False : Py_True;
                        break;
@@ -836,7 +836,7 @@ static PyObject *pyrna_prop_richcmp(PyObject *a, PyObject *b, int op)
        switch (op) {
                case Py_NE:
                        ok = !ok;
-                       /* fall-through */
+                       ATTR_FALLTHROUGH;
                case Py_EQ:
                        res = ok ? Py_False : Py_True;
                        break;
@@ -5168,7 +5168,7 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
                                                        ret = Matrix_CreatePyObject(data, 3, 3, NULL);
                                                        break;
                                                }
-                                               /* fall-through */
+                                               ATTR_FALLTHROUGH;
 #endif
                                        default:
                                                ret = PyTuple_New(len);
index add8c2451ff2864d8b75a492ae42e5c04a7053f9..9997cd9c1f589c0b90e272b678458ec300e52eca 100644 (file)
@@ -173,7 +173,7 @@ static PyObject *Color_richcmpr(PyObject *a, PyObject *b, int op)
        switch (op) {
                case Py_NE:
                        ok = !ok;
-                       /* fall-through */
+                       ATTR_FALLTHROUGH;
                case Py_EQ:
                        res = ok ? Py_False : Py_True;
                        break;
index 54adc826af7e234cbe0ec74610a247c06252c775..9492b6d67f3dcd4bb15bffa1a929d7c89088bba9 100644 (file)
@@ -65,7 +65,7 @@ static PyObject *Euler_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
                case 2:
                        if ((order = euler_order_from_string(order_str, "mathutils.Euler()")) == -1)
                                return NULL;
-                       /* fall-through */
+                       ATTR_FALLTHROUGH;
                case 1:
                        if (mathutils_array_parse(eul, EULER_SIZE, EULER_SIZE, seq, "mathutils.Euler()") == -1)
                                return NULL;
@@ -370,7 +370,7 @@ static PyObject *Euler_richcmpr(PyObject *a, PyObject *b, int op)
        switch (op) {
                case Py_NE:
                        ok = !ok;
-                       /* fall-through */
+                       ATTR_FALLTHROUGH;
                case Py_EQ:
                        res = ok ? Py_False : Py_True;
                        break;
index 10f428ba355396c489e6fcdd57814ee6529946fd..bfd23af257b88e9f77ffa91de4c51a4d4cd2cba0 100644 (file)
@@ -2034,7 +2034,7 @@ static PyObject *Matrix_richcmpr(PyObject *a, PyObject *b, int op)
        switch (op) {
                case Py_NE:
                        ok = !ok;
-                       /* fall-through */
+                       ATTR_FALLTHROUGH;
                case Py_EQ:
                        res = ok ? Py_False : Py_True;
                        break;
index 71b3cf8ddac354fa12f27913b59ed2d9728cda09..d283c717a46f7bbb4c083649f94637162cea03ab 100644 (file)
@@ -552,7 +552,7 @@ static PyObject *Quaternion_richcmpr(PyObject *a, PyObject *b, int op)
        switch (op) {
                case Py_NE:
                        ok = !ok;
-                       /* fall-through */
+                       ATTR_FALLTHROUGH;
                case Py_EQ:
                        res = ok ? Py_False : Py_True;
                        break;
index 42e4d4f27f611a98eb87a61ecd5730968c8fcf0e..22dc2b2890090d71b59130e805e3d6b6b2a2b2a8 100644 (file)
@@ -1495,6 +1495,7 @@ void texture_rgb_blend(float in[3], const float tex[3], const float out[3], floa
                
        case MTEX_SUB:
                fact= -fact;
+               ATTR_FALLTHROUGH;
        case MTEX_ADD:
                fact*= facg;
                in[0]= (fact*tex[0] + out[0]);
@@ -1609,6 +1610,7 @@ float texture_value_blend(float tex, float out, float fact, float facg, int blen
 
        case MTEX_SUB:
                fact= -fact;
+               ATTR_FALLTHROUGH;
        case MTEX_ADD:
                in= fact*tex + out;
                break;
index 610e86caa13cf589b26fc18caf849657015bc478..7fe52328781a7537ed4ec29979a688fbbd6cf28d 100644 (file)
@@ -275,10 +275,12 @@ static float metadensity(Object *ob, const float co[3])
                                break;
                        case MB_CUBE:
                                tp[2] = (tp[2] > ml->expz) ? (tp[2] - ml->expz) : ((tp[2] < -ml->expz) ? (tp[2] + ml->expz) : 0.f);
-                       /* no break, xy as plane */
+                               /* no break, xy as plane */
+                               ATTR_FALLTHROUGH;
                        case MB_PLANE:
                                tp[1] = (tp[1] > ml->expy) ? (tp[1] - ml->expy) : ((tp[1] < -ml->expy) ? (tp[1] + ml->expy) : 0.f);
-                       /* no break, x as tube */
+                               /* no break, x as tube */
+                               ATTR_FALLTHROUGH;
                        case MB_TUBE:
                                tp[0] = (tp[0] > ml->expx) ? (tp[0] - ml->expx) : ((tp[0] < -ml->expx) ? (tp[0] + ml->expx) : 0.f);
                }
index de45bee76a70f3c116fb0e60b58653a436eb9ec2..1e4a59aeb5c66e1fc588b20a2c2a538c01fdb23e 100644 (file)
@@ -335,7 +335,7 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef *
                                        Py_DECREF(resultlist);
                                        return NULL;
                                }
-                               // walkthrough
+                               ATTR_FALLTHROUGH;
                        case KX_PYATTRIBUTE_TYPE_INT:
                                {
                                        int *val = reinterpret_cast<int*>(ptr);
@@ -406,7 +406,7 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef *
                        {
                                return NULL;
                        }
-                       // walkthrough
+                       ATTR_FALLTHROUGH;
                case KX_PYATTRIBUTE_TYPE_INT:
                        {
                                int *val = reinterpret_cast<int*>(ptr);
@@ -638,7 +638,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
                                        PyErr_Format(PyExc_AttributeError, "Size check error for attribute, \"%s\", report to blender.org", attrdef->m_name);
                                        goto UNDO_AND_ERROR;
                                }
-                               // walkthrough
+                               ATTR_FALLTHROUGH;
                        case KX_PYATTRIBUTE_TYPE_INT:
                                {
                                        int *var = reinterpret_cast<int*>(ptr);
@@ -883,7 +883,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
                                PyErr_Format(PyExc_AttributeError, "attribute size check error for attribute \"%s\", report to blender.org", attrdef->m_name);
                                goto FREE_AND_ERROR;
                        }
-                       // walkthrough
+                       ATTR_FALLTHROUGH;
                case KX_PYATTRIBUTE_TYPE_INT:
                        {
                                int *var = reinterpret_cast<int*>(ptr);
index abb64cf1733efc46f02a9b95aba0cbfc80dd4eba..e34a5296139a2740b8fb6c0c79ca633b66065225 100644 (file)
@@ -133,7 +133,7 @@ bool        SCA_PropertySensor::CheckPropertyCondition()
        {
        case KX_PROPSENSOR_NOTEQUAL:
                reverse = true;
-               /* fall-through */
+               ATTR_FALLTHROUGH;
        case KX_PROPSENSOR_EQUAL:
                {
                        CValue* orgprop = GetParent()->FindIdentifier(m_checkpropname);
@@ -231,7 +231,7 @@ bool        SCA_PropertySensor::CheckPropertyCondition()
                }
        case KX_PROPSENSOR_LESSTHAN:
                reverse = true;
-               /* fall-through */
+               ATTR_FALLTHROUGH;
        case KX_PROPSENSOR_GREATERTHAN:
                {
                        CValue* orgprop = GetParent()->FindIdentifier(m_checkpropname);
index 239bfde4c98c5adc863f332934697e49ed7a20e6..c84b2474c9020e60e220abf58d84030b59bae7b0 100644 (file)
@@ -345,6 +345,7 @@ static MT_Point3 nearestPointToObstacle(MT_Point3& pos ,KX_Obstacle* obstacle)
                        MT_Point3 res = obstacle->m_pos + abdir*proj;
                        return res;
                }
+               ATTR_FALLTHROUGH;
        }
        case KX_OBSTACLE_CIRCLE :
        default:
index a27f37c0441343f10e1325942c6559ab451c63c5..822f2e054f86dd96a6932700e36723b6c7bb2e58 100644 (file)
@@ -108,7 +108,7 @@ void KX_SoundActuator::play()
        case KX_SOUNDACT_LOOPBIDIRECTIONAL:
        case KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP:
                sound = AUD_Sound_pingpong(sound);
-               // fall through
+               ATTR_FALLTHROUGH;
        case KX_SOUNDACT_LOOPEND:
        case KX_SOUNDACT_LOOPSTOP:
                loop = true;