Skip to content

Commit

Permalink
fix implicit fallthrough gcc warnings
Browse files Browse the repository at this point in the history
This patch addresses implicit fallthrough warnings on the
newer gcc compiler. Proper comment to silence the warning or appropriate comments
have been added in the case statements.

Signed-off-by: Ani Sinha <ani@anisinha.ca>
  • Loading branch information
ani-sinha committed Jun 4, 2022
1 parent ad45238 commit 5513cf5
Show file tree
Hide file tree
Showing 21 changed files with 40 additions and 1 deletion.
1 change: 1 addition & 0 deletions grub-core/commands/hdparm.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ grub_cmd_hdparm (grub_extcmd_context_t ctxt, int argc, char **args)
ata = ((struct grub_scsi *) disk->data)->data;
break;
}
// fall through
default:
return grub_error (GRUB_ERR_IO, "not an ATA device");
}
Expand Down
1 change: 1 addition & 0 deletions grub-core/disk/cryptodisk.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ grub_cryptodisk_endecrypt (struct grub_cryptodisk *dev,
break;
case GRUB_CRYPTODISK_MODE_IV_PLAIN64:
iv[1] = grub_cpu_to_le32 (sector >> 32);
// fall through
case GRUB_CRYPTODISK_MODE_IV_PLAIN:
iv[0] = grub_cpu_to_le32 (sector & 0xFFFFFFFF);
break;
Expand Down
2 changes: 2 additions & 0 deletions grub-core/disk/diskfilter.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ is_lv_readable (struct grub_diskfilter_lv *lv, int easily)
case GRUB_DISKFILTER_RAID6:
if (!easily)
need--;
// fall through
case GRUB_DISKFILTER_RAID4:
case GRUB_DISKFILTER_RAID5:
if (!easily)
Expand Down Expand Up @@ -507,6 +508,7 @@ read_segment (struct grub_diskfilter_segment *seg, grub_disk_addr_t sector,
if (seg->node_count == 1)
return grub_diskfilter_read_node (&seg->nodes[0],
sector, size, buf);
// fall through
case GRUB_DISKFILTER_MIRROR:
case GRUB_DISKFILTER_RAID10:
{
Expand Down
3 changes: 3 additions & 0 deletions grub-core/disk/efi/efidisk.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,9 @@ name_devices (struct grub_efidisk_data *devices)
{
case GRUB_EFI_HARD_DRIVE_DEVICE_PATH_SUBTYPE:
is_hard_drive = 1;
#if defined(__GNUC__) && __GNUC__ >= 7
__attribute__ ((fallthrough));
#endif
/* Fall through by intention. */
case GRUB_EFI_CDROM_DEVICE_PATH_SUBTYPE:
{
Expand Down
1 change: 1 addition & 0 deletions grub-core/efiemu/mm.c
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ grub_efiemu_mmap_fill (void)
default:
grub_dprintf ("efiemu",
"Unknown memory type %d. Assuming unusable\n", type);
// fall through
case GRUB_MEMORY_RESERVED:
return grub_efiemu_add_to_mmap (addr, size,
GRUB_EFI_UNUSABLE_MEMORY);
Expand Down
2 changes: 2 additions & 0 deletions grub-core/font/font.c
Original file line number Diff line number Diff line change
Expand Up @@ -1297,6 +1297,7 @@ blit_comb (const struct grub_unicode_glyph *glyph_id,
- grub_font_get_xheight (combining_glyphs[i]->font) - 1;
if (space <= 0)
space = 1 + (grub_font_get_xheight (main_glyph->font)) / 8;
// fall through

case GRUB_UNICODE_STACK_ATTACHED_ABOVE:
do_blit (combining_glyphs[i], targetx,
Expand Down Expand Up @@ -1338,6 +1339,7 @@ blit_comb (const struct grub_unicode_glyph *glyph_id,
+ combining_glyphs[i]->height);
if (space <= 0)
space = 1 + (grub_font_get_xheight (main_glyph->font)) / 8;
// fall through

case GRUB_UNICODE_STACK_ATTACHED_BELOW:
do_blit (combining_glyphs[i], targetx, -(bounds.y - space));
Expand Down
1 change: 1 addition & 0 deletions grub-core/fs/udf.c
Original file line number Diff line number Diff line change
Expand Up @@ -970,6 +970,7 @@ grub_udf_read_symlink (grub_fshelp_node_t node)
case 1:
if (ptr[1])
goto fail;
// fall through
case 2:
/* in 4 bytes. out: 1 byte. */
optr = out;
Expand Down
1 change: 1 addition & 0 deletions grub-core/gdb/cstub.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ grub_gdb_trap (int trap_no)
/* sAA..AA: Step one instruction from AA..AA(optional). */
case 's':
stepping = 1;
// fall through

/* cAA..AA: Continue at address AA..AA(optional). */
case 'c':
Expand Down
2 changes: 1 addition & 1 deletion grub-core/gnulib/regexec.c
Original file line number Diff line number Diff line change
Expand Up @@ -4104,8 +4104,8 @@ check_node_accept (const re_match_context_t *mctx, const re_token_t *node,
case OP_UTF8_PERIOD:
if (ch >= ASCII_CHARS)
return false;
/* FALLTHROUGH */
#endif
// fall through
case OP_PERIOD:
if ((ch == '\n' && !(mctx->dfa->syntax & RE_DOT_NEWLINE))
|| (ch == '\0' && (mctx->dfa->syntax & RE_DOT_NOT_NULL)))
Expand Down
1 change: 1 addition & 0 deletions grub-core/lib/legacy_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,7 @@ grub_legacy_parse (const char *buf, char **entryname, char **suffix)
{
case TYPE_FILE_NO_CONSUME:
hold_arg = 1;
// fall through
case TYPE_PARTITION:
case TYPE_FILE:
args[i] = adjust_file (curarg, curarglen);
Expand Down
2 changes: 2 additions & 0 deletions grub-core/lib/xzembed/xz_dec_lzma2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,7 @@ enum xz_ret xz_dec_lzma2_run(
return XZ_DATA_ERROR;

s->lzma2.sequence = SEQ_LZMA_PREPARE;
//fall through

case SEQ_LZMA_PREPARE:
if (s->lzma2.compressed < RC_INIT_BYTES)
Expand All @@ -1051,6 +1052,7 @@ enum xz_ret xz_dec_lzma2_run(

s->lzma2.compressed -= RC_INIT_BYTES;
s->lzma2.sequence = SEQ_LZMA_RUN;
// fall through

case SEQ_LZMA_RUN:
/*
Expand Down
8 changes: 8 additions & 0 deletions grub-core/lib/xzembed/xz_dec_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
return ret;

s->sequence = SEQ_BLOCK_START;
// fall through

case SEQ_BLOCK_START:
/* We need one byte of input to continue. */
Expand All @@ -771,6 +772,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
s->temp.size = s->block_header.size;
s->temp.pos = 0;
s->sequence = SEQ_BLOCK_HEADER;
// fall through

case SEQ_BLOCK_HEADER:
if (!fill_temp(s, b))
Expand All @@ -781,13 +783,15 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
return ret;

s->sequence = SEQ_BLOCK_UNCOMPRESS;
// fall through

case SEQ_BLOCK_UNCOMPRESS:
ret = dec_block(s, b);
if (ret != XZ_STREAM_END)
return ret;

s->sequence = SEQ_BLOCK_PADDING;
// fall through

case SEQ_BLOCK_PADDING:
/*
Expand All @@ -808,6 +812,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
}

s->sequence = SEQ_BLOCK_CHECK;
// fall through

case SEQ_BLOCK_CHECK:
ret = hash_validate(s, b, 0);
Expand All @@ -823,6 +828,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
return ret;

s->sequence = SEQ_INDEX_PADDING;
// fall through

case SEQ_INDEX_PADDING:
while ((s->index.size + (b->in_pos - s->in_start))
Expand Down Expand Up @@ -862,6 +868,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
#endif

s->sequence = SEQ_INDEX_CRC32;
// fall through

case SEQ_INDEX_CRC32:
ret = hash_validate(s, b, 1);
Expand All @@ -870,6 +877,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)

s->temp.size = STREAM_HEADER_SIZE;
s->sequence = SEQ_STREAM_FOOTER;
// fall through

case SEQ_STREAM_FOOTER:
if (!fill_temp(s, b))
Expand Down
3 changes: 3 additions & 0 deletions grub-core/loader/i386/linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -977,10 +977,13 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
{
case 'g':
shift += 10;
// fall through
case 'm':
shift += 10;
// fall through
case 'k':
shift += 10;
// fall through
default:
break;
}
Expand Down
3 changes: 3 additions & 0 deletions grub-core/loader/i386/pc/linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,13 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
{
case 'g':
shift += 10;
// fall through
case 'm':
shift += 10;
// fall through
case 'k':
shift += 10;
// fall through
default:
break;
}
Expand Down
3 changes: 3 additions & 0 deletions grub-core/mmap/efi/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ grub_efi_mmap_iterate (grub_memory_hook_t hook, int avoid_efi_boot_services)
GRUB_MEMORY_AVAILABLE);
break;
}
break;
case GRUB_EFI_RUNTIME_SERVICES_CODE:
hook (desc->physical_start, desc->num_pages * 4096,
GRUB_MEMORY_CODE);
Expand All @@ -85,6 +86,7 @@ grub_efi_mmap_iterate (grub_memory_hook_t hook, int avoid_efi_boot_services)
default:
grub_printf ("Unknown memory type %d, considering reserved\n",
desc->type);
break;

case GRUB_EFI_BOOT_SERVICES_DATA:
if (!avoid_efi_boot_services)
Expand All @@ -93,6 +95,7 @@ grub_efi_mmap_iterate (grub_memory_hook_t hook, int avoid_efi_boot_services)
GRUB_MEMORY_AVAILABLE);
break;
}
break;
case GRUB_EFI_RESERVED_MEMORY_TYPE:
case GRUB_EFI_RUNTIME_SERVICES_DATA:
case GRUB_EFI_MEMORY_MAPPED_IO:
Expand Down
1 change: 1 addition & 0 deletions grub-core/normal/charset.c
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,7 @@ grub_bidi_line_logical_to_visual (const grub_uint32_t *logical,
case GRUB_BIDI_TYPE_R:
case GRUB_BIDI_TYPE_AL:
bidi_needed = 1;
// fall through
default:
{
if (join_state == JOIN_FORCE)
Expand Down
1 change: 1 addition & 0 deletions grub-core/video/bochs.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ grub_video_bochs_setup (unsigned int width, unsigned int height,
case 32:
framebuffer.mode_info.reserved_mask_size = 8;
framebuffer.mode_info.reserved_field_pos = 24;
// fall through

case 24:
framebuffer.mode_info.red_mask_size = 8;
Expand Down
1 change: 1 addition & 0 deletions grub-core/video/cirrus.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ grub_video_cirrus_setup (unsigned int width, unsigned int height,
case 32:
framebuffer.mode_info.reserved_mask_size = 8;
framebuffer.mode_info.reserved_field_pos = 24;
// fall through

case 24:
framebuffer.mode_info.red_mask_size = 8;
Expand Down
2 changes: 2 additions & 0 deletions grub-core/video/i386/pc/vbe.c
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,7 @@ vbe2videoinfo (grub_uint32_t mode,
/* CGA is basically 4-bit packed pixel. */
case GRUB_VBE_MEMORY_MODEL_CGA:
mode_info->mode_type |= GRUB_VIDEO_MODE_TYPE_CGA;
// fall through
case GRUB_VBE_MEMORY_MODEL_PACKED_PIXEL:
mode_info->mode_type |= GRUB_VIDEO_MODE_TYPE_INDEX_COLOR;
break;
Expand All @@ -892,6 +893,7 @@ vbe2videoinfo (grub_uint32_t mode,
/* Non chain 4 is a special case of planar. */
case GRUB_VBE_MEMORY_MODEL_NONCHAIN4_256:
mode_info->mode_type |= GRUB_VIDEO_MODE_TYPE_NONCHAIN4;
// fall through
case GRUB_VBE_MEMORY_MODEL_PLANAR:
mode_info->mode_type |= GRUB_VIDEO_MODE_TYPE_PLANAR
| GRUB_VIDEO_MODE_TYPE_INDEX_COLOR;
Expand Down
1 change: 1 addition & 0 deletions grub-core/video/readers/jpeg.c
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,7 @@ grub_jpeg_decode_jpeg (struct grub_jpeg_data *data)
case JPEG_MARKER_SOS: /* Start Of Scan. */
if (grub_jpeg_decode_sos (data))
break;
// fall through
case JPEG_MARKER_RST0: /* Restart. */
case JPEG_MARKER_RST1:
case JPEG_MARKER_RST2:
Expand Down
1 change: 1 addition & 0 deletions util/grub-mkimagexx.c
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections,
+ sym->st_value
- image_target->vaddr_offset));
}
// fall through
case R_IA64_LTOFF_FPTR22:
*gpptr = grub_host_to_target64 (addend + sym_addr);
add_value_to_slot_21 ((grub_addr_t) target,
Expand Down

0 comments on commit 5513cf5

Please sign in to comment.