Add noreturn attributes and remove unreachable code.

* grub-core/bus/cs5536.c (grub_cs5536_smbus_wait): Remove unreachable
	code.
	* grub-core/commands/halt.c (grub_cmd_halt): Remove unreachable
	code. Mark as noreturn.
	* grub-core/commands/minicmd.c (grub_mini_cmd_exit): Likewise.
	* grub-core/commands/reboot.c (grub_cmd_reboot): Likewise.
	* grub-core/disk/efi/efidisk.c (grub_efidisk_get_device_name): Remove
	unreachable code.
	* grub-core/kern/main.c (grub_main): Mark as noreturn.
	* grub-core/kern/rescue_reader.c (grub_rescue_run): Likewise.
	* grub-core/lib/posix_wrap/stdlib.h (abort): Likewise.
	* grub-core/normal/menu.c (run_menu): Remove unreachable code.
	* include/grub/kernel.h (grub_main): Mark as noreturn.
	* include/grub/reader.h (grub_rescue_run): Likewise.
This commit is contained in:
Vladimir 'phcoder' Serbinenko committed 2011-12-13 15:13:51 +01:00
1 parent 2019d09ef0
commit 02a2bf8384
12 files changed
+28 -16

No files matched your search

-2
View File
@@ -97,8 +97,6 @@ grub_cs5536_smbus_wait (grub_port_t smbbase)
if (grub_get_time_ms () > start + 40)
return grub_error (GRUB_ERR_IO, "SM stalled");
}
return GRUB_ERR_NONE;
}
grub_err_t
+1 -2
View File
@@ -24,13 +24,12 @@
GRUB_MOD_LICENSE ("GPLv3+");
static grub_err_t
static grub_err_t __attribute__ ((noreturn))
grub_cmd_halt (grub_command_t cmd __attribute__ ((unused)),
int argc __attribute__ ((unused)),
char **args __attribute__ ((unused)))
{
grub_halt ();
return 0;
}
static grub_command_t cmd;
+2 -2
View File
@@ -165,13 +165,13 @@ grub_mini_cmd_lsmod (struct grub_command *cmd __attribute__ ((unused)),
}
/* exit */
static grub_err_t
static grub_err_t __attribute__ ((noreturn))
grub_mini_cmd_exit (struct grub_command *cmd __attribute__ ((unused)),
int argc __attribute__ ((unused)),
char *argv[] __attribute__ ((unused)))
{
grub_exit ();
return 0;
/* Not reached. */
}
static grub_command_t cmd_cat, cmd_help;
+1 -2
View File
@@ -24,13 +24,12 @@
GRUB_MOD_LICENSE ("GPLv3+");
static grub_err_t
static grub_err_t __attribute__ ((noreturn))
grub_cmd_reboot (grub_command_t cmd __attribute__ ((unused)),
int argc __attribute__ ((unused)),
char **args __attribute__ ((unused)))
{
grub_reboot ();
return 0;
}
static grub_command_t cmd;
-2
View File
@@ -791,6 +791,4 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle)
grub_disk_close (parent);
return device_name;
}
return 0;
}
+1 -1
View File
@@ -190,7 +190,7 @@ grub_load_normal_mode (void)
}
/* The main routine. */
void
void __attribute__ ((noreturn))
grub_main (void)
{
/* First of all, initialize the machine. */
+1 -1
View File
@@ -74,7 +74,7 @@ grub_rescue_read_line (char **line, int cont)
return 0;
}
void
void __attribute__ ((noreturn))
grub_rescue_run (void)
{
grub_printf ("Entering rescue mode...\n");
+1 -1
View File
@@ -46,7 +46,7 @@ realloc (void *ptr, grub_size_t size)
return grub_realloc (ptr, size);
}
static inline void
static inline void __attribute__ ((noreturn))
abort (void)
{
grub_abort ();
-1
View File
@@ -666,7 +666,6 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
}
/* Never reach here. */
return -1;
}
/* Callback invoked immediately before a menu entry is executed. */