Whamcloud - gitweb
e2fsprogs: annotate intentional fallthroughs in case statements
authorEric Sandeen <sandeen@redhat.com>
Fri, 16 Sep 2011 20:49:23 +0000 (15:49 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 16 Sep 2011 22:43:05 +0000 (18:43 -0400)
Using the /* fallthrough */ comment lets Coverity (and humans)
know that we really do want to fall through in these case statements.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/e2p/feature.c
lib/e2p/mntopts.c
lib/e2p/parse_num.c
lib/ext2fs/dirhash.c
lib/ext2fs/extent.c

index 5188483..ef4376a 100644 (file)
@@ -307,6 +307,7 @@ int e2p_edit_feature2(const char *str, __u32 *compat_array, __u32 *ok_array,
                case '-':
                case '^':
                        neg++;
+                       /* fallthrough */
                case '+':
                        cp++;
                        break;
index dfdd0ef..9d3879e 100644 (file)
@@ -122,6 +122,7 @@ int e2p_edit_mntopts(const char *str, __u32 *mntopts, __u32 ok)
                case '-':
                case '^':
                        neg++;
+                       /* fallthrough */
                case '+':
                        cp++;
                        break;
index 83a329a..9ca6799 100644 (file)
@@ -26,10 +26,13 @@ unsigned long long parse_num_blocks2(const char *arg, int log_block_size)
        switch (*p) {           /* Using fall-through logic */
        case 'T': case 't':
                num <<= 10;
+               /* fallthrough */
        case 'G': case 'g':
                num <<= 10;
+               /* fallthrough */
        case 'M': case 'm':
                num <<= 10;
+               /* fallthrough */
        case 'K': case 'k':
                num >>= log_block_size;
                break;
index a069706..5477bfb 100644 (file)
@@ -217,11 +217,13 @@ errcode_t ext2fs_dirhash(int version, const char *name, int len,
        switch (version) {
        case EXT2_HASH_LEGACY_UNSIGNED:
                unsigned_flag++;
+               /* fallthrough */
        case EXT2_HASH_LEGACY:
                hash = dx_hack_hash(name, len, unsigned_flag);
                break;
        case EXT2_HASH_HALF_MD4_UNSIGNED:
                unsigned_flag++;
+               /* fallthrough */
        case EXT2_HASH_HALF_MD4:
                p = name;
                while (len > 0) {
@@ -235,6 +237,7 @@ errcode_t ext2fs_dirhash(int version, const char *name, int len,
                break;
        case EXT2_HASH_TEA_UNSIGNED:
                unsigned_flag++;
+               /* fallthrough */
        case EXT2_HASH_TEA:
                p = name;
                while (len > 0) {
index abb60dd..6d2afb0 100644 (file)
@@ -373,9 +373,11 @@ retry:
        case EXT2_EXTENT_ROOT:
                handle->level = 0;
                path = handle->path + handle->level;
+               /* fallthrough */
        case EXT2_EXTENT_FIRST_SIB:
                path->left = path->entries;
                path->curr = 0;
+               /* fallthrough */
        case EXT2_EXTENT_NEXT_SIB:
                if (path->left <= 0)
                        return EXT2_ET_EXTENT_NO_NEXT;