i386, x86_64, ppc: fix switch fallthrough cases with GCC7
In util/getroot and efidisk slightly modify exitsing comment to mostly retain it but still make GCC7 compliant with respect to fall through annotation. In grub-core/lib/xzembed/xz_dec_lzma2.c it adds same comments as upstream. In grub-core/tests/setjmp_tets.c declare functions as "noreturn" to suppress GCC7 warning. In grub-core/gnulib/regexec.c use new __attribute__, because existing annotation is not recognized by GCC7 parser (which requires that comment immediately precedes case statement). Otherwise add FALLTHROUGH comment. Closes: 50598
This commit is contained in:
parent
6cef7f6079
commit
4bd4a88725
17 changed files with 32 additions and 3 deletions
|
@ -328,6 +328,7 @@ grub_cmd_hdparm (grub_extcmd_context_t ctxt, int argc, char **args)
|
||||||
ata = ((struct grub_scsi *) disk->data)->data;
|
ata = ((struct grub_scsi *) disk->data)->data;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
/* FALLTHROUGH */
|
||||||
default:
|
default:
|
||||||
grub_disk_close (disk);
|
grub_disk_close (disk);
|
||||||
return grub_error (GRUB_ERR_IO, "not an ATA device");
|
return grub_error (GRUB_ERR_IO, "not an ATA device");
|
||||||
|
|
|
@ -79,6 +79,7 @@ get_uuid (const char *name, char **uuid, int getnative)
|
||||||
case GRUB_DISK_DEVICE_XEN:
|
case GRUB_DISK_DEVICE_XEN:
|
||||||
if (getnative)
|
if (getnative)
|
||||||
break;
|
break;
|
||||||
|
/* FALLTHROUGH */
|
||||||
|
|
||||||
/* Virtual disks. */
|
/* Virtual disks. */
|
||||||
/* GRUB dynamically generated files. */
|
/* GRUB dynamically generated files. */
|
||||||
|
|
|
@ -282,6 +282,7 @@ grub_cryptodisk_endecrypt (struct grub_cryptodisk *dev,
|
||||||
break;
|
break;
|
||||||
case GRUB_CRYPTODISK_MODE_IV_PLAIN64:
|
case GRUB_CRYPTODISK_MODE_IV_PLAIN64:
|
||||||
iv[1] = grub_cpu_to_le32 (sector >> 32);
|
iv[1] = grub_cpu_to_le32 (sector >> 32);
|
||||||
|
/* FALLTHROUGH */
|
||||||
case GRUB_CRYPTODISK_MODE_IV_PLAIN:
|
case GRUB_CRYPTODISK_MODE_IV_PLAIN:
|
||||||
iv[0] = grub_cpu_to_le32 (sector & 0xFFFFFFFF);
|
iv[0] = grub_cpu_to_le32 (sector & 0xFFFFFFFF);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -224,7 +224,7 @@ name_devices (struct grub_efidisk_data *devices)
|
||||||
{
|
{
|
||||||
case GRUB_EFI_HARD_DRIVE_DEVICE_PATH_SUBTYPE:
|
case GRUB_EFI_HARD_DRIVE_DEVICE_PATH_SUBTYPE:
|
||||||
is_hard_drive = 1;
|
is_hard_drive = 1;
|
||||||
/* Fall through by intention. */
|
/* Intentionally fall through. */
|
||||||
case GRUB_EFI_CDROM_DEVICE_PATH_SUBTYPE:
|
case GRUB_EFI_CDROM_DEVICE_PATH_SUBTYPE:
|
||||||
{
|
{
|
||||||
struct grub_efidisk_data *parent, *parent2;
|
struct grub_efidisk_data *parent, *parent2;
|
||||||
|
|
|
@ -417,6 +417,7 @@ fill_hook (grub_uint64_t addr, grub_uint64_t size, grub_memory_type_t type,
|
||||||
default:
|
default:
|
||||||
grub_dprintf ("efiemu",
|
grub_dprintf ("efiemu",
|
||||||
"Unknown memory type %d. Assuming unusable\n", type);
|
"Unknown memory type %d. Assuming unusable\n", type);
|
||||||
|
/* FALLTHROUGH */
|
||||||
case GRUB_MEMORY_RESERVED:
|
case GRUB_MEMORY_RESERVED:
|
||||||
return grub_efiemu_add_to_mmap (addr, size,
|
return grub_efiemu_add_to_mmap (addr, size,
|
||||||
GRUB_EFI_UNUSABLE_MEMORY);
|
GRUB_EFI_UNUSABLE_MEMORY);
|
||||||
|
|
|
@ -336,6 +336,7 @@ grub_gdb_trap (int trap_no)
|
||||||
/* sAA..AA: Step one instruction from AA..AA(optional). */
|
/* sAA..AA: Step one instruction from AA..AA(optional). */
|
||||||
case 's':
|
case 's':
|
||||||
stepping = 1;
|
stepping = 1;
|
||||||
|
/* FALLTHROUGH */
|
||||||
|
|
||||||
/* cAA..AA: Continue at address AA..AA(optional). */
|
/* cAA..AA: Continue at address AA..AA(optional). */
|
||||||
case 'c':
|
case 'c':
|
||||||
|
|
|
@ -4099,6 +4099,9 @@ check_node_accept (const re_match_context_t *mctx, const re_token_t *node,
|
||||||
case OP_UTF8_PERIOD:
|
case OP_UTF8_PERIOD:
|
||||||
if (ch >= ASCII_CHARS)
|
if (ch >= ASCII_CHARS)
|
||||||
return false;
|
return false;
|
||||||
|
#if defined __GNUC__ && __GNUC__ >= 7
|
||||||
|
__attribute__ ((fallthrough));
|
||||||
|
#endif
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
#endif
|
#endif
|
||||||
case OP_PERIOD:
|
case OP_PERIOD:
|
||||||
|
|
|
@ -1044,6 +1044,8 @@ enum xz_ret xz_dec_lzma2_run(
|
||||||
|
|
||||||
s->lzma2.sequence = SEQ_LZMA_PREPARE;
|
s->lzma2.sequence = SEQ_LZMA_PREPARE;
|
||||||
|
|
||||||
|
/* Fall through */
|
||||||
|
|
||||||
case SEQ_LZMA_PREPARE:
|
case SEQ_LZMA_PREPARE:
|
||||||
if (s->lzma2.compressed < RC_INIT_BYTES)
|
if (s->lzma2.compressed < RC_INIT_BYTES)
|
||||||
return XZ_DATA_ERROR;
|
return XZ_DATA_ERROR;
|
||||||
|
@ -1054,6 +1056,8 @@ enum xz_ret xz_dec_lzma2_run(
|
||||||
s->lzma2.compressed -= RC_INIT_BYTES;
|
s->lzma2.compressed -= RC_INIT_BYTES;
|
||||||
s->lzma2.sequence = SEQ_LZMA_RUN;
|
s->lzma2.sequence = SEQ_LZMA_RUN;
|
||||||
|
|
||||||
|
/* Fall through */
|
||||||
|
|
||||||
case SEQ_LZMA_RUN:
|
case SEQ_LZMA_RUN:
|
||||||
/*
|
/*
|
||||||
* Set dictionary limit to indicate how much we want
|
* Set dictionary limit to indicate how much we want
|
||||||
|
|
|
@ -750,6 +750,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
|
||||||
|
|
||||||
s->sequence = SEQ_BLOCK_START;
|
s->sequence = SEQ_BLOCK_START;
|
||||||
|
|
||||||
|
/* FALLTHROUGH */
|
||||||
case SEQ_BLOCK_START:
|
case SEQ_BLOCK_START:
|
||||||
/* We need one byte of input to continue. */
|
/* We need one byte of input to continue. */
|
||||||
if (b->in_pos == b->in_size)
|
if (b->in_pos == b->in_size)
|
||||||
|
@ -773,6 +774,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
|
||||||
s->temp.pos = 0;
|
s->temp.pos = 0;
|
||||||
s->sequence = SEQ_BLOCK_HEADER;
|
s->sequence = SEQ_BLOCK_HEADER;
|
||||||
|
|
||||||
|
/* FALLTHROUGH */
|
||||||
case SEQ_BLOCK_HEADER:
|
case SEQ_BLOCK_HEADER:
|
||||||
if (!fill_temp(s, b))
|
if (!fill_temp(s, b))
|
||||||
return XZ_OK;
|
return XZ_OK;
|
||||||
|
@ -783,6 +785,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
|
||||||
|
|
||||||
s->sequence = SEQ_BLOCK_UNCOMPRESS;
|
s->sequence = SEQ_BLOCK_UNCOMPRESS;
|
||||||
|
|
||||||
|
/* FALLTHROUGH */
|
||||||
case SEQ_BLOCK_UNCOMPRESS:
|
case SEQ_BLOCK_UNCOMPRESS:
|
||||||
ret = dec_block(s, b);
|
ret = dec_block(s, b);
|
||||||
if (ret != XZ_STREAM_END)
|
if (ret != XZ_STREAM_END)
|
||||||
|
@ -810,6 +813,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
|
||||||
|
|
||||||
s->sequence = SEQ_BLOCK_CHECK;
|
s->sequence = SEQ_BLOCK_CHECK;
|
||||||
|
|
||||||
|
/* FALLTHROUGH */
|
||||||
case SEQ_BLOCK_CHECK:
|
case SEQ_BLOCK_CHECK:
|
||||||
ret = hash_validate(s, b, 0);
|
ret = hash_validate(s, b, 0);
|
||||||
if (ret != XZ_STREAM_END)
|
if (ret != XZ_STREAM_END)
|
||||||
|
@ -858,6 +862,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
|
||||||
|
|
||||||
s->sequence = SEQ_INDEX_CRC32;
|
s->sequence = SEQ_INDEX_CRC32;
|
||||||
|
|
||||||
|
/* FALLTHROUGH */
|
||||||
case SEQ_INDEX_CRC32:
|
case SEQ_INDEX_CRC32:
|
||||||
ret = hash_validate(s, b, 1);
|
ret = hash_validate(s, b, 1);
|
||||||
if (ret != XZ_STREAM_END)
|
if (ret != XZ_STREAM_END)
|
||||||
|
@ -866,6 +871,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
|
||||||
s->temp.size = STREAM_HEADER_SIZE;
|
s->temp.size = STREAM_HEADER_SIZE;
|
||||||
s->sequence = SEQ_STREAM_FOOTER;
|
s->sequence = SEQ_STREAM_FOOTER;
|
||||||
|
|
||||||
|
/* FALLTHROUGH */
|
||||||
case SEQ_STREAM_FOOTER:
|
case SEQ_STREAM_FOOTER:
|
||||||
if (!fill_temp(s, b))
|
if (!fill_temp(s, b))
|
||||||
return XZ_OK;
|
return XZ_OK;
|
||||||
|
|
|
@ -984,10 +984,13 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
||||||
{
|
{
|
||||||
case 'g':
|
case 'g':
|
||||||
shift += 10;
|
shift += 10;
|
||||||
|
/* FALLTHROUGH */
|
||||||
case 'm':
|
case 'm':
|
||||||
shift += 10;
|
shift += 10;
|
||||||
|
/* FALLTHROUGH */
|
||||||
case 'k':
|
case 'k':
|
||||||
shift += 10;
|
shift += 10;
|
||||||
|
/* FALLTHROUGH */
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,10 @@ GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
static grub_jmp_buf jmp_point;
|
static grub_jmp_buf jmp_point;
|
||||||
static int expected, ctr;
|
static int expected, ctr;
|
||||||
|
|
||||||
#pragma GCC diagnostic ignored "-Wmissing-noreturn"
|
/* This fixes GCC7 "unintentional fallthrough" warning */
|
||||||
|
static void jmp0 (void) __attribute__ ((noreturn));
|
||||||
|
static void jmp1 (void) __attribute__ ((noreturn));
|
||||||
|
static void jmp2 (void) __attribute__ ((noreturn));
|
||||||
|
|
||||||
static void
|
static void
|
||||||
jmp0 (void)
|
jmp0 (void)
|
||||||
|
|
|
@ -181,6 +181,7 @@ grub_video_ieee1275_fill_mode_info (grub_ieee1275_phandle_t dev,
|
||||||
case 32:
|
case 32:
|
||||||
out->reserved_mask_size = 8;
|
out->reserved_mask_size = 8;
|
||||||
out->reserved_field_pos = 24;
|
out->reserved_field_pos = 24;
|
||||||
|
/* FALLTHROUGH */
|
||||||
|
|
||||||
case 24:
|
case 24:
|
||||||
out->red_mask_size = 8;
|
out->red_mask_size = 8;
|
||||||
|
|
|
@ -736,6 +736,7 @@ grub_jpeg_decode_jpeg (struct grub_jpeg_data *data)
|
||||||
case JPEG_MARKER_SOS: /* Start Of Scan. */
|
case JPEG_MARKER_SOS: /* Start Of Scan. */
|
||||||
if (grub_jpeg_decode_sos (data))
|
if (grub_jpeg_decode_sos (data))
|
||||||
break;
|
break;
|
||||||
|
/* FALLTHROUGH */
|
||||||
case JPEG_MARKER_RST0: /* Restart. */
|
case JPEG_MARKER_RST0: /* Restart. */
|
||||||
case JPEG_MARKER_RST1:
|
case JPEG_MARKER_RST1:
|
||||||
case JPEG_MARKER_RST2:
|
case JPEG_MARKER_RST2:
|
||||||
|
|
|
@ -99,7 +99,7 @@ grub_util_pull_device (const char *os_dev)
|
||||||
{
|
{
|
||||||
case GRUB_DEV_ABSTRACTION_LVM:
|
case GRUB_DEV_ABSTRACTION_LVM:
|
||||||
grub_util_pull_lvm_by_command (os_dev);
|
grub_util_pull_lvm_by_command (os_dev);
|
||||||
/* Fallthrough in case that lvm-tools are unavailable. */
|
/* Fallthrough - in case that lvm-tools are unavailable. */
|
||||||
case GRUB_DEV_ABSTRACTION_LUKS:
|
case GRUB_DEV_ABSTRACTION_LUKS:
|
||||||
grub_util_pull_devmapper (os_dev);
|
grub_util_pull_devmapper (os_dev);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1851,6 +1851,7 @@ main (int argc, char *argv[])
|
||||||
free (mach_kernel);
|
free (mach_kernel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
/* FALLTHROUGH */
|
||||||
case GRUB_INSTALL_PLATFORM_ARM_EFI:
|
case GRUB_INSTALL_PLATFORM_ARM_EFI:
|
||||||
case GRUB_INSTALL_PLATFORM_ARM64_EFI:
|
case GRUB_INSTALL_PLATFORM_ARM64_EFI:
|
||||||
case GRUB_INSTALL_PLATFORM_IA64_EFI:
|
case GRUB_INSTALL_PLATFORM_IA64_EFI:
|
||||||
|
|
|
@ -907,6 +907,7 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections,
|
||||||
+ sym->st_value
|
+ sym->st_value
|
||||||
- image_target->vaddr_offset));
|
- image_target->vaddr_offset));
|
||||||
}
|
}
|
||||||
|
/* FALLTHROUGH */
|
||||||
case R_IA64_LTOFF_FPTR22:
|
case R_IA64_LTOFF_FPTR22:
|
||||||
*gpptr = grub_host_to_target64 (addend + sym_addr);
|
*gpptr = grub_host_to_target64 (addend + sym_addr);
|
||||||
grub_ia64_add_value_to_slot_21 ((grub_addr_t) target,
|
grub_ia64_add_value_to_slot_21 ((grub_addr_t) target,
|
||||||
|
|
|
@ -530,6 +530,7 @@ argp_parser (int key, char *arg, struct argp_state *state)
|
||||||
if (arg[0] != '-')
|
if (arg[0] != '-')
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
/* FALLTHROUGH */
|
||||||
default:
|
default:
|
||||||
if (!arg)
|
if (!arg)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue