2005-02-01 Yoshinori K. Okuji <okuji@enbug.org>

* grub/asmstub.c (grub_stage2): Use auto instead of static for
  nested functions.

  * stage2/char_io.c (memcheck) [GRUB_UTIL]: Likewise.

  * stage2/builtins.c (blocklist_func): Likewise.
  (color_func): Likewise.
  (install_func): Likewise.
  (setkey_func): Likewise.

  * lib/device.c (read_device_map): Likewise.
This commit is contained in:
okuji 2005-02-01 21:00:42 +00:00
parent eb5d4d6776
commit ac1ef04cde
7 changed files with 67 additions and 35 deletions

View file

@ -1,3 +1,17 @@
2005-02-01 Yoshinori K. Okuji <okuji@enbug.org>
* grub/asmstub.c (grub_stage2): Use auto instead of static for
nested functions.
* stage2/char_io.c (memcheck) [GRUB_UTIL]: Likewise.
* stage2/builtins.c (blocklist_func): Likewise.
(color_func): Likewise.
(install_func): Likewise.
(setkey_func): Likewise.
* lib/device.c (read_device_map): Likewise.
2005-01-30 Yoshinori K. Okuji <okuji@enbug.org>
* configure.ac (AC_INIT): Upgraded to 0.96.

View file

@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.23.
.TH GRUB "8" "January 2005" "grub (GNU GRUB 0.96)" FSF
.TH GRUB "8" "February 2005" "grub (GNU GRUB 0.96)" FSF
.SH NAME
grub \- the grub shell
.SH SYNOPSIS

View file

@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.23.
.TH MBCHK "1" "January 2005" "mbchk (GNU GRUB 0.96)" FSF
.TH MBCHK "1" "February 2005" "mbchk (GNU GRUB 0.96)" FSF
.SH NAME
mbchk \- check the format of a Multiboot kernel
.SH SYNOPSIS

View file

@ -113,31 +113,33 @@ grub_stage2 (void)
char *scratch, *simstack;
int i;
auto volatile void doit (void);
/* We need a nested function so that we get a clean stack frame,
regardless of how the code is optimized. */
static volatile void doit ()
{
/* Make sure our stack lives in the simulated memory area. */
asm volatile ("movl %%esp, %0\n\tmovl %1, %%esp\n"
: "=&r" (realstack) : "r" (simstack));
/* Do a setjmp here for the stop command. */
if (! setjmp (env_for_exit))
{
/* Actually enter the generic stage2 code. */
status = 0;
init_bios_info ();
}
else
{
/* If ERRNUM is non-zero, then set STATUS to non-zero. */
if (errnum)
status = 1;
}
/* Replace our stack before we use any local variables. */
asm volatile ("movl %0, %%esp\n" : : "r" (realstack));
}
auto volatile void doit (void)
{
/* Make sure our stack lives in the simulated memory area. */
asm volatile ("movl %%esp, %0\n\tmovl %1, %%esp\n"
: "=&r" (realstack) : "r" (simstack));
/* Do a setjmp here for the stop command. */
if (! setjmp (env_for_exit))
{
/* Actually enter the generic stage2 code. */
status = 0;
init_bios_info ();
}
else
{
/* If ERRNUM is non-zero, then set STATUS to non-zero. */
if (errnum)
status = 1;
}
/* Replace our stack before we use any local variables. */
asm volatile ("movl %0, %%esp\n" : : "r" (realstack));
}
assert (grub_scratch_mem == 0);
scratch = malloc (0x100000 + EXTENDED_MEMSIZE + 15);

View file

@ -493,12 +493,15 @@ check_device (const char *device)
static int
read_device_map (FILE *fp, char **map, const char *map_file)
{
static void show_error (int no, const char *msg)
auto void show_error (int no, const char *msg);
auto void show_warning (int no, const char *msg, ...);
auto void show_error (int no, const char *msg)
{
fprintf (stderr, "%s:%d: error: %s\n", map_file, no, msg);
}
static void show_warning (int no, const char *msg, ...)
auto void show_warning (int no, const char *msg, ...)
{
va_list ap;

View file

@ -141,9 +141,11 @@ blocklist_func (char *arg, int flags)
int num_entries = 0;
int last_length = 0;
auto void disk_read_blocklist_func (int sector, int offset, int length);
/* Collect contiguous blocks into one entry as many as possible,
and print the blocklist notation on the screen. */
static void disk_read_blocklist_func (int sector, int offset, int length)
auto void disk_read_blocklist_func (int sector, int offset, int length)
{
if (num_sectors > 0)
{
@ -589,8 +591,10 @@ color_func (char *arg, int flags)
"white"
};
auto int color_number (char *str);
/* Convert the color name STR into the magical number. */
static int color_number (char *str)
auto int color_number (char *str)
{
char *ptr;
int i;
@ -1774,8 +1778,11 @@ install_func (char *arg, int flags)
char *stage2_os_file = 0;
#endif /* GRUB_UTIL */
auto void disk_read_savesect_func (int sector, int offset, int length);
auto void disk_read_blocklist_func (int sector, int offset, int length);
/* Save the first sector of Stage2 in STAGE2_SECT. */
static void disk_read_savesect_func (int sector, int offset, int length)
auto void disk_read_savesect_func (int sector, int offset, int length)
{
if (debug)
printf ("[%d]", sector);
@ -1791,7 +1798,7 @@ install_func (char *arg, int flags)
/* Write SECTOR to INSTALLLIST, and update INSTALLADDR and
INSTALLSECT. */
static void disk_read_blocklist_func (int sector, int offset, int length)
auto void disk_read_blocklist_func (int sector, int offset, int length)
{
if (debug)
printf("[%d]", sector);
@ -3610,7 +3617,10 @@ setkey_func (char *arg, int flags)
int to_code, from_code;
int map_in_interrupt = 0;
static int find_key_code (char *key)
auto int find_key_code (char *key);
auto int find_ascii_code (char *key);
auto int find_key_code (char *key)
{
int i;
@ -3627,7 +3637,7 @@ setkey_func (char *arg, int flags)
return 0;
}
static int find_ascii_code (char *key)
auto int find_ascii_code (char *key)
{
int i;

View file

@ -1178,7 +1178,10 @@ int
memcheck (int addr, int len)
{
#ifdef GRUB_UTIL
static int start_addr (void)
auto int start_addr (void);
auto int end_addr (void);
auto int start_addr (void)
{
int ret;
# if defined(HAVE_START_SYMBOL)
@ -1189,7 +1192,7 @@ memcheck (int addr, int len)
return ret;
}
static int end_addr (void)
auto int end_addr (void)
{
int ret;
# if defined(HAVE_END_SYMBOL)