From b2c00eb47e4af30b1822af3f66744bfde755c87f Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Wed, 6 Jan 2010 21:26:44 -0800 Subject: Change () prototypes to (void) () means the same as (...) in C, not the same as (void) as it does in C++. It is generally misused to mean (void), though. Actually write what we mean... this is C, after all. Signed-off-by: H. Peter Anvin --- com32/cmenu/complex.c | 2 +- com32/cmenu/libmenu/menu.c | 10 +++++----- com32/cmenu/libmenu/menu.h | 8 ++++---- com32/gfxboot/gfxboot.c | 8 ++++---- com32/hdt/hdt-cli.c | 6 +++--- com32/hdt/hdt-cli.h | 2 +- com32/hdt/hdt-common.c | 2 +- com32/hdt/hdt-common.h | 2 +- com32/hdt/hdt-menu.c | 2 +- com32/hdt/hdt-menu.h | 2 +- com32/lib/sys/libansi.c | 34 ++++++++++++++++++++++------------ com32/rosh/rosh.c | 8 ++++---- 12 files changed, 48 insertions(+), 38 deletions(-) diff --git a/com32/cmenu/complex.c b/com32/cmenu/complex.c index 1ac51997..6013e722 100644 --- a/com32/cmenu/complex.c +++ b/com32/cmenu/complex.c @@ -244,7 +244,7 @@ t_handler_return checkbox_handler(t_menusystem * ms, t_menuitem * mi) return rv; } -int main() +int main(void) { t_menuitem *curr; char cmd[160]; diff --git a/com32/cmenu/libmenu/menu.c b/com32/cmenu/libmenu/menu.c index de4a1ee2..13754768 100644 --- a/com32/cmenu/libmenu/menu.c +++ b/com32/cmenu/libmenu/menu.c @@ -40,7 +40,7 @@ int isvisible(pt_menu menu, int first, int curr); // This is same as inputc except it honors the ontimeout handler // and calls it when needed. For the callee, there is no difference // as this will not return unless a key has been pressed. -static int getch() +static int getch(void) { t_timeout_handler th; int key; @@ -615,7 +615,7 @@ uchar find_menu_num(const char *name) // Run through all items and if they are submenus // with a non-trivial "action" and trivial submenunum // replace submenunum with the menu with name "action" -void fix_submenus() +void fix_submenus(void) { int i, j; pt_menu m; @@ -874,7 +874,7 @@ void reg_ontimeout(t_timeout_handler handler, unsigned int numsteps, ms->tm_stepsize = stepsize; } -void unreg_ontimeout() +void unreg_ontimeout(void) { ms->ontimeout = NULL; } @@ -889,7 +889,7 @@ void reg_ontotaltimeout(t_timeout_handler handler, } } -void unreg_ontotaltimeout() +void unreg_ontotaltimeout(void) { ms->ontotaltimeout = NULL; } @@ -1084,7 +1084,7 @@ void set_menu_pos(uchar row, uchar col) // Set the position of this menu. m->col = col; } -pt_menuitem add_sep() // Add a separator to current menu +pt_menuitem add_sep(void) // Add a separator to current menu { pt_menuitem mi; pt_menu m; diff --git a/com32/cmenu/libmenu/menu.h b/com32/cmenu/libmenu/menu.h index a1356020..141d2ef0 100644 --- a/com32/cmenu/libmenu/menu.h +++ b/com32/cmenu/libmenu/menu.h @@ -225,7 +225,7 @@ pt_menuitem showmenus(uchar startmenu); pt_menusystem init_menusystem(const char *title); -void close_menusystem(); // Deallocate memory used +void close_menusystem(void); // Deallocate memory used void set_normal_attr(uchar normal, uchar selected, uchar inactivenormal, uchar inactiveselected); @@ -253,10 +253,10 @@ void reg_ontimeout(t_timeout_handler, unsigned int numsteps, unsigned int stepsize); // Set timeout handler, set 0 for default values. // So stepsize=0 means numsteps is measured in centiseconds. -void unreg_ontimeout(); +void unreg_ontimeout(void); void reg_ontotaltimeout(t_timeout_handler, unsigned long numcentiseconds); -void unreg_ontotaltimeout(); +void unreg_ontotaltimeout(void); // Find the number of the menu given the name // Returns -1 if not found @@ -284,7 +284,7 @@ static inline void set_shortcut(uchar shortcut) } // Add a separator to the "current" menu -pt_menuitem add_sep(); +pt_menuitem add_sep(void); // Generate string based on state of checkboxes and radioitem in given menu // and append string to existing contents of "line" diff --git a/com32/gfxboot/gfxboot.c b/com32/gfxboot/gfxboot.c index 3937e305..bfdd8cce 100644 --- a/com32/gfxboot/gfxboot.c +++ b/com32/gfxboot/gfxboot.c @@ -573,7 +573,7 @@ int gfx_init(char *file) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -int gfx_menu_init() +int gfx_menu_init(void) { com32sys_t r; @@ -585,7 +585,7 @@ int gfx_menu_init() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void gfx_done() +void gfx_done(void) { com32sys_t r; @@ -599,7 +599,7 @@ void gfx_done() // return: // boot menu index (-1: go to text mode prompt) // -int gfx_input() +int gfx_input(void) { com32sys_t r; @@ -688,7 +688,7 @@ void *load_one(char *file, ssize_t *file_size) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Locate menu entry and boot. // -void boot() +void boot(void) { char *label, *arg, *s; menu_t *menu_ptr; diff --git a/com32/hdt/hdt-cli.c b/com32/hdt/hdt-cli.c index 69a2b61f..76aed784 100644 --- a/com32/hdt/hdt-cli.c +++ b/com32/hdt/hdt-cli.c @@ -96,7 +96,7 @@ static void autocomplete_add_token_to_list(const char *token) autocomplete_tail = new; } -static void autocomplete_destroy_list() +static void autocomplete_destroy_list(void) { struct autocomplete_list *tmp = NULL; @@ -727,7 +727,7 @@ out: free(argv); } -static void reset_prompt() +static void reset_prompt(void) { /* No need to display the prompt if we exit */ if (hdt_cli.mode != EXIT_MODE) { @@ -779,7 +779,7 @@ void start_auto_mode(struct s_hardware *hardware) more_printf("\n"); } -void print_history() +void print_history(void) { reset_more_printf(); for (int i = 1; i <= MAX_HISTORY_SIZE; i++) { diff --git a/com32/hdt/hdt-cli.h b/com32/hdt/hdt-cli.h index 898b53f8..b55d108a 100644 --- a/com32/hdt/hdt-cli.h +++ b/com32/hdt/hdt-cli.h @@ -160,7 +160,7 @@ void start_auto_mode(struct s_hardware *hardware); void main_show(char *item, struct s_hardware *hardware); #define CLI_HISTORY "history" -void print_history(); +void print_history(void); // DMI STUFF #define CLI_DMI_BASE_BOARD "base_board" diff --git a/com32/hdt/hdt-common.c b/com32/hdt/hdt-common.c index 59175cec..736d9b6e 100644 --- a/com32/hdt/hdt-common.c +++ b/com32/hdt/hdt-common.c @@ -649,7 +649,7 @@ char *del_multi_spaces(char *p) } /* Reset the more_printf counter */ -void reset_more_printf() +void reset_more_printf(void) { display_line_nb = 0; } diff --git a/com32/hdt/hdt-common.h b/com32/hdt/hdt-common.h index d7a58e2f..0a0c8c4e 100644 --- a/com32/hdt/hdt-common.h +++ b/com32/hdt/hdt-common.h @@ -201,7 +201,7 @@ struct s_hardware { char vesa_background[255]; }; -void reset_more_printf(); +void reset_more_printf(void); const char *find_argument(const char **argv, const char *argument); char *remove_spaces(char *p); char *remove_trailing_lf(char *p); diff --git a/com32/hdt/hdt-menu.c b/com32/hdt/hdt-menu.c index 1aa0906f..4629ee58 100644 --- a/com32/hdt/hdt-menu.c +++ b/com32/hdt/hdt-menu.c @@ -79,7 +79,7 @@ int start_menu_mode(struct s_hardware *hardware, char *version_string) } /* In the menu system, what to do on keyboard timeout */ -TIMEOUTCODE ontimeout() +TIMEOUTCODE ontimeout(void) { // beep(); return CODE_WAIT; diff --git a/com32/hdt/hdt-menu.h b/com32/hdt/hdt-menu.h index f10e5290..c8c91243 100644 --- a/com32/hdt/hdt-menu.h +++ b/com32/hdt/hdt-menu.h @@ -82,7 +82,7 @@ struct s_hdt_menu { int total_menu_count; // Sum of all menus we have }; -TIMEOUTCODE ontimeout(); +TIMEOUTCODE ontimeout(void); void keys_handler(t_menusystem * ms __attribute__ ((unused)), t_menuitem * mi, int scancode); diff --git a/com32/lib/sys/libansi.c b/com32/lib/sys/libansi.c index 5bc0026e..a011cb87 100644 --- a/com32/lib/sys/libansi.c +++ b/com32/lib/sys/libansi.c @@ -46,18 +46,21 @@ void display_cursor(bool status) } } -void clear_end_of_line() { +void clear_end_of_line(void) +{ fputs(CSI "0K", stdout); } -void move_cursor_left(int count) { +void move_cursor_left(int count) +{ char buffer[10]; memset(buffer,0,sizeof(buffer)); sprintf(buffer,CSI "%dD",count); fputs(buffer, stdout); } -void move_cursor_right(int count) { +void move_cursor_right(int count) +{ char buffer[10]; memset(buffer,0,sizeof(buffer)); sprintf(buffer, CSI "%dC", count); @@ -71,38 +74,45 @@ void set_cursor_blink(bool status) { fputs("\033[0m",stdout); } -void clear_line() { +void clear_line(void) +{ fputs(CSI "2K", stdout); } -void clear_beginning_of_line() { +void clear_beginning_of_line(void) +{ fputs(CSI "1K", stdout); } -void move_cursor_to_column(int count) { +void move_cursor_to_column(int count) +{ char buffer[10]; memset(buffer,0,sizeof(buffer)); sprintf(buffer, CSI "%dG", count); fputs(buffer, stdout); } -void move_cursor_to_next_line() { +void move_cursor_to_next_line(void) +{ fputs("\033e", stdout); } -void disable_utf8() { +void disable_utf8(void) +{ fputs("\033%@", stdout); } -void set_g1_special_char(){ +void set_g1_special_char(void){ fputs("\033)0", stdout); } -void set_us_g0_charset() { +void set_us_g0_charset(void) +{ fputs("\033(B\1#0", stdout); } -void clear_entire_screen() { +void clear_entire_screen(void) +{ fputs(CSI "2J", stdout); } @@ -186,7 +196,7 @@ void cls(void) cprint_vga2ansi('0', '0'); } -void reset_colors() +void reset_colors(void) { csprint(CSI "1D", 0x07); } diff --git a/com32/rosh/rosh.c b/com32/rosh/rosh.c index 9a4edae2..720d8644 100644 --- a/com32/rosh/rosh.c +++ b/com32/rosh/rosh.c @@ -37,7 +37,7 @@ #define APP_YEAR "2008" #define APP_VER "beta-b032" -void rosh_version() +void rosh_version(void) { printf("%s v %s; (c) %s %s.\n", APP_LONGNAME, APP_VER, APP_YEAR, APP_AUTHOR); @@ -224,7 +224,7 @@ void rosh_print_tc(struct termios *tio) * Switches console over to raw input mode. Allows get_key to get just * 1 key sequence (without delay or display) */ -void rosh_console_raw() +void rosh_console_raw(void) { // struct termios itio, ntio; // tcgetattr(0, &itio); @@ -241,7 +241,7 @@ void rosh_console_raw() /* * Switches back to standard getline mode. */ -void rosh_console_std() +void rosh_console_std(void) { // struct termios itio, ntio; console_ansi_std(); @@ -252,7 +252,7 @@ void rosh_console_std() * Attempts to get a single key from the console * returns key pressed */ -int rosh_getkey() +int rosh_getkey(void) { int inc; -- cgit v1.2.1 From 4b96057c4bc297c892bc84c920f1962a37d8e511 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Wed, 6 Jan 2010 21:37:27 -0800 Subject: Update README for 2010 --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index 0e92ea2e..aebc421c 100644 --- a/README +++ b/README @@ -25,7 +25,7 @@ for details. SYSLINUX is: - Copyright 1994-2008 H. Peter Anvin - All Rights Reserved + Copyright 1994-2010 H. Peter Anvin et al - All Rights Reserved This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -- cgit v1.2.1 From 91334030e93d5d0a60a178e214140054dfc5d69c Mon Sep 17 00:00:00 2001 From: Kim Mik Date: Sun, 10 Jan 2010 14:57:40 +0000 Subject: chain.c32: add grldr= command for Grub4dos grldr of Grub4dos wants the partition number in DH: 0xff: whole drive 0-3: primary partitions 4-*: logical partitions Hmmm... there really isn't a huge reason not to do this unconditionally, at least unless it's known to cause problems. It would be better, of course, if grldr used the standard DS:SI, but it doesn't, so oh well. Some info of a Grub4dos developer (Tinybit): GRLDR can be loaded at any address with alignment 16(i.e., a possible segment base address). Generally you want to load it at 0000:7C00, or at 2000:0000. Of course you never load it at 0000:0000 or similar. Before jumping to the entry point at the very beginning of GRLDR, you should setup DL=(BIOS drive) and DH=(partition number). For partition numbers, 0 - 3 are primary, 4 - 0xFE are logical. (DH=0xFF) stands for whole drive(unpartitioned). DH will later be passed to install_partition(the third byte, from bit 16 to bit 23). http://www.boot-land.net/forums/index.php?showtopic=8457&st=20&start=20 post #22 --- com32/modules/chain.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/com32/modules/chain.c b/com32/modules/chain.c index da64707f..3d192d73 100644 --- a/com32/modules/chain.c +++ b/com32/modules/chain.c @@ -782,9 +782,20 @@ int main(int argc, char *argv[]) whichpart = 0; /* Default */ - if (partition) + /* grldr of Grub4dos wants the partition number in DH: + 0xff: whole drive (default) + 0-3: primary partitions + 4-*: logical partitions + */ + regs.edx.b[1] = 0xff; + + if (partition) { whichpart = strtoul(partition, NULL, 0); + /* grldr of Grub4dos wants the partiton number in DH. */ + regs.edx.b[1] = whichpart -1; + } + if (!(drive & 0x80) && whichpart) { error("Warning: Partitions of floppy devices may not work\n"); } -- cgit v1.2.1 From 58e9e6510952e7c558b68e6d90e9fbd30156ba83 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 10 Jan 2010 12:36:30 -0800 Subject: chain.c32: simplify the grub4dos support Grub4dos (like Grub in general) uses the same partition numbers as Linux (and chain.c32), minus one. Signed-off-by: H. Peter Anvin --- com32/modules/chain.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/com32/modules/chain.c b/com32/modules/chain.c index 3d192d73..2dd80746 100644 --- a/com32/modules/chain.c +++ b/com32/modules/chain.c @@ -781,25 +781,21 @@ int main(int argc, char *argv[]) regs.ebx.b[0] = regs.edx.b[0] = drive; whichpart = 0; /* Default */ - - /* grldr of Grub4dos wants the partition number in DH: - 0xff: whole drive (default) - 0-3: primary partitions - 4-*: logical partitions - */ - regs.edx.b[1] = 0xff; - - if (partition) { + if (partition) whichpart = strtoul(partition, NULL, 0); - /* grldr of Grub4dos wants the partiton number in DH. */ - regs.edx.b[1] = whichpart -1; - } - if (!(drive & 0x80) && whichpart) { error("Warning: Partitions of floppy devices may not work\n"); } + /* + * grldr of Grub4dos wants the partition number in DH: + * -1: whole drive (default) + * 0-3: primary partitions + * 4-*: logical partitions + */ + regs.edx.b[1] = whichpart-1; + /* Get the disk geometry and disk access setup */ if (get_disk_params(drive)) { error("Cannot get disk parameters\n"); -- cgit v1.2.1 From f9a7f01fee0a6a1451e083441c3dd0531eb4a8a9 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 10 Jan 2010 12:38:12 -0800 Subject: NEWS: document Grub4DOS chainloading --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index be2987d1..5008c1fa 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,8 @@ Changes in 3.85: prompt with an error message (if NOESCAPE is set, we stop with a "boot failed" message; this is also the case for PXELINUX if the configuration file is not found.) + * chain.c32: support chainloading Grub4DOS; patch by Gert + Hulselmans. Changes in 3.84: * SYSLINUX: make the DOS installer work for MS-DOS 7.x/8.x -- cgit v1.2.1 From a7fb4143d599529def315c444c83a8e1aac734d2 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 10 Jan 2010 12:41:26 -0800 Subject: cmenu: clean up some () that should be (void) () is not a prototype, and means (...) not (void) in C. Replace with (void). Signed-off-by: H. Peter Anvin --- com32/cmenu/adv_menu.tpl | 4 ++-- com32/cmenu/complex.c | 2 +- com32/cmenu/libmenu/passwords.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/com32/cmenu/adv_menu.tpl b/com32/cmenu/adv_menu.tpl index be3c558e..a1a5d96a 100644 --- a/com32/cmenu/adv_menu.tpl +++ b/com32/cmenu/adv_menu.tpl @@ -183,12 +183,12 @@ TIMEOUTCODE timeout(const char *cmd) } } -TIMEOUTCODE ontimeout() +TIMEOUTCODE ontimeout(void) { return timeout(timeoutcmd); } -TIMEOUTCODE ontotaltimeout() +TIMEOUTCODE ontotaltimeout(void) { return timeout(totaltimeoutcmd); } diff --git a/com32/cmenu/complex.c b/com32/cmenu/complex.c index 6013e722..f5175fa9 100644 --- a/com32/cmenu/complex.c +++ b/com32/cmenu/complex.c @@ -54,7 +54,7 @@ char username[12]; // Name of user currently using the system /* End globals */ -TIMEOUTCODE ontimeout() +TIMEOUTCODE ontimeout(void) { beep(); return CODE_WAIT; diff --git a/com32/cmenu/libmenu/passwords.c b/com32/cmenu/libmenu/passwords.c index 06f4cfb3..44ce461f 100644 --- a/com32/cmenu/libmenu/passwords.c +++ b/com32/cmenu/libmenu/passwords.c @@ -148,7 +148,7 @@ void init_passwords(const char *filename) fclose(f); } -void close_passwords() +void close_passwords(void) { int i; -- cgit v1.2.1 From 71d20885019564586d5f4d316af220cdae2900f5 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 10 Jan 2010 12:48:06 -0800 Subject: Makefile: replace -W -Wall with centralized $(GCCWARN) Replace -W -Wall hardcoded into a bunch of Makefiles with $(GCCWARN), a centralized variable defined in the root MCONFIG. Add -Wstrict-prototypes to the list of global warnings: we should never have non-prototyped declarations. Signed-off-by: H. Peter Anvin --- MCONFIG | 3 +++ MCONFIG.embedded | 2 +- com32/MCONFIG | 6 +++--- com32/lib/MCONFIG | 2 +- com32/rosh/MCONFIG | 4 ++-- extlinux/Makefile | 2 +- linux/Makefile | 2 +- memdisk/Makefile | 2 +- mtools/Makefile | 2 +- utils/Makefile | 2 +- win32/Makefile | 4 ++-- 11 files changed, 17 insertions(+), 14 deletions(-) diff --git a/MCONFIG b/MCONFIG index a716c6c5..c73520bd 100644 --- a/MCONFIG +++ b/MCONFIG @@ -60,6 +60,9 @@ WGET = wget com32 = $(topdir)/com32 +# Common warnings we want for all gcc-generated code +GCCWARN := -W -Wall -Wstrict-prototypes + # Common stanza to make gcc generate .*.d dependency files MAKEDEPS = -Wp,-MT,$@,-MD,$(dir $@).$(notdir $@).d diff --git a/MCONFIG.embedded b/MCONFIG.embedded index 586afc3e..37abe917 100644 --- a/MCONFIG.embedded +++ b/MCONFIG.embedded @@ -28,7 +28,7 @@ GCCOPT := $(call gcc_ok,-m32,) \ LIBGCC := $(shell $(CC) $(GCCOPT) --print-libgcc) LD += -m elf_i386 -CFLAGS = $(GCCOPT) -g -W -Wall -Wno-sign-compare $(OPTFLAGS) $(INCLUDES) +CFLAGS = $(GCCOPT) -g $(GCCWARN) -Wno-sign-compare $(OPTFLAGS) $(INCLUDES) SFLAGS = $(CFLAGS) -D__ASSEMBLY__ .SUFFIXES: .c .o .S .s .i .elf .com .bin .asm .lst .c32 .lss diff --git a/com32/MCONFIG b/com32/MCONFIG index f8d9d978..578e2832 100644 --- a/com32/MCONFIG +++ b/com32/MCONFIG @@ -32,11 +32,11 @@ GPLLIB = GPLINCLUDE = endif -CFLAGS = $(GCCOPT) -W -Wall -march=i386 \ +CFLAGS = $(GCCOPT) $(GCCWARN) -march=i386 \ -fomit-frame-pointer -D__COM32__ \ -nostdinc -iwithprefix include \ -I$(com32)/libutil/include -I$(com32)/include $(GPLINCLUDE) -SFLAGS = $(GCCOPT) -W -Wall -march=i386 \ +SFLAGS = $(GCCOPT) $(GCCWARN) -march=i386 \ -fomit-frame-pointer -D__COM32__ \ -nostdinc -iwithprefix include \ -I$(com32)/libutil/include -I$(com32)/include $(GPLINCLUDE) @@ -45,7 +45,7 @@ COM32LD = $(com32)/lib/com32.ld LDFLAGS = -m elf_i386 -T $(COM32LD) LIBGCC := $(shell $(CC) $(GCCOPT) --print-libgcc) -LNXCFLAGS = -I$(com32)/libutil/include -W -Wall -O -g -D_GNU_SOURCE +LNXCFLAGS = -I$(com32)/libutil/include $(GCCWARN) -O -g -D_GNU_SOURCE LNXSFLAGS = -g LNXLDFLAGS = -g diff --git a/com32/lib/MCONFIG b/com32/lib/MCONFIG index 1eb18db1..1ae83bc7 100644 --- a/com32/lib/MCONFIG +++ b/com32/lib/MCONFIG @@ -24,7 +24,7 @@ REQFLAGS = $(GCCOPT) -g -mregparm=3 -DREGPARM=3 -D__COM32__ \ -nostdinc -iwithprefix include -I. -I./sys -I../include OPTFLAGS = -Os -march=i386 -falign-functions=0 -falign-jumps=0 \ -falign-labels=0 -ffast-math -fomit-frame-pointer -WARNFLAGS = -W -Wall -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Winline +WARNFLAGS = $(GCCWARN) -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Winline CFLAGS = $(OPTFLAGS) $(REQFLAGS) $(WARNFLAGS) $(LIBFLAGS) LDFLAGS = -m elf32_i386 diff --git a/com32/rosh/MCONFIG b/com32/rosh/MCONFIG index 30029d15..25c41396 100644 --- a/com32/rosh/MCONFIG +++ b/com32/rosh/MCONFIG @@ -17,11 +17,11 @@ ## Include the COM32 common configurables include ../MCONFIG -# CFLAGS = $(GCCOPT) -W -Wall -march=i386 \ +# CFLAGS = $(GCCOPT) $(GCCWARN) -march=i386 \ # -fomit-frame-pointer -D__COM32__ \ # -nostdinc -iwithprefix include \ # -I$(com32)/libutil/include -I$(com32)/include # -g3 -dD -# LNXCFLAGS = -I$(com32)/libutil/include -W -Wall -O -g3 -D_GNU_SOURCE -dD +# LNXCFLAGS = -I$(com32)/libutil/include $(GCCWARN) -O -g3 -D_GNU_SOURCE -dD # -U__GNUC__ diff --git a/extlinux/Makefile b/extlinux/Makefile index 48105338..23ffd400 100644 --- a/extlinux/Makefile +++ b/extlinux/Makefile @@ -19,7 +19,7 @@ include $(topdir)/MCONFIG OPTFLAGS = -g -Os INCLUDES = -I. -I.. -I../libinstaller -CFLAGS = -W -Wall -Wno-sign-compare -D_FILE_OFFSET_BITS=64 \ +CFLAGS = $(GCCWARN) -Wno-sign-compare -D_FILE_OFFSET_BITS=64 \ $(OPTFLAGS) $(INCLUDES) LDFLAGS = # -s diff --git a/linux/Makefile b/linux/Makefile index a469cefd..8872c0fc 100644 --- a/linux/Makefile +++ b/linux/Makefile @@ -19,7 +19,7 @@ include $(topdir)/MCONFIG OPTFLAGS = -g -Os INCLUDES = -I. -I.. -I../libinstaller -CFLAGS = -W -Wall -D_FILE_OFFSET_BITS=64 $(OPTFLAGS) $(INCLUDES) +CFLAGS = $(GCCWARN) -D_FILE_OFFSET_BITS=64 $(OPTFLAGS) $(INCLUDES) LDFLAGS = -s SRCS = syslinux.c \ diff --git a/memdisk/Makefile b/memdisk/Makefile index 09f17c8e..2e6330f9 100644 --- a/memdisk/Makefile +++ b/memdisk/Makefile @@ -91,7 +91,7 @@ memdisk: memdisk16.bin memdisk32.bin postprocess.pl $(PERL) postprocess.pl $@ memdisk16.bin memdisk32.bin e820test: e820test.c e820func.c msetup.c - $(CC) -m32 -g -W -Wall -DTEST -o $@ $^ + $(CC) -m32 -g $(GCCWARN) -DTEST -o $@ $^ # This file contains the version number, so add a dependency for it setup.s: ../version diff --git a/mtools/Makefile b/mtools/Makefile index b5517805..91b68527 100644 --- a/mtools/Makefile +++ b/mtools/Makefile @@ -3,7 +3,7 @@ include $(topdir)/MCONFIG OPTFLAGS = -g -Os INCLUDES = -I. -I.. -I../libfat -I../libinstaller -CFLAGS = -W -Wall -D_FILE_OFFSET_BITS=64 $(OPTFLAGS) $(INCLUDES) +CFLAGS = $(GCCWARN) -D_FILE_OFFSET_BITS=64 $(OPTFLAGS) $(INCLUDES) LDFLAGS = -s SRCS = syslinux.c \ diff --git a/utils/Makefile b/utils/Makefile index 39adf7d3..7fdf631d 100644 --- a/utils/Makefile +++ b/utils/Makefile @@ -17,7 +17,7 @@ topdir = .. include $(topdir)/MCONFIG -CFLAGS = -W -Wall -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64 +CFLAGS = $(GCCWARN) -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64 LDFLAGS = -O2 -s TARGETS = mkdiskimage isohybrid gethostip diff --git a/win32/Makefile b/win32/Makefile index 964b74c5..a0be1d46 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -21,7 +21,7 @@ OSTYPE = $(shell uname -msr) ifeq ($(findstring CYGWIN,$(OSTYPE)),CYGWIN) ## Compiling on Cygwin WINPREFIX := -WINCFLAGS := -mno-cygwin -W -Wall -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64 +WINCFLAGS := -mno-cygwin $(GCCWARN) -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64 WINLDFLAGS := -mno-cygwin -Os -s else ## Compiling on some variant of MinGW @@ -30,7 +30,7 @@ WINPREFIX := else WINPREFIX := $(shell ./find-mingw.sh gcc) endif -WINCFLAGS := -W -Wall -Wno-sign-compare -Os -fomit-frame-pointer \ +WINCFLAGS := $(GCCWARN) -Wno-sign-compare -Os -fomit-frame-pointer \ -D_FILE_OFFSET_BITS=64 WINLDFLAGS := -Os -s endif -- cgit v1.2.1 From 8682e180c7ecf747b6e9e4a65346dd0c779411c6 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 10 Jan 2010 12:53:04 -0800 Subject: com32/lib: fix warnings in opendir/readdir/closedir Missing #include , nested comment in readdir. Signed-off-by: H. Peter Anvin --- com32/lib/closedir.c | 1 + com32/lib/opendir.c | 1 + com32/lib/readdir.c | 5 ++++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/com32/lib/closedir.c b/com32/lib/closedir.c index f8bbbabd..a2d11105 100644 --- a/com32/lib/closedir.c +++ b/com32/lib/closedir.c @@ -10,6 +10,7 @@ #include #include #include +#include int closedir(DIR * dir) { diff --git a/com32/lib/opendir.c b/com32/lib/opendir.c index 6fc0f14f..21fe91d4 100644 --- a/com32/lib/opendir.c +++ b/com32/lib/opendir.c @@ -10,6 +10,7 @@ #include #include #include +#include DIR *opendir(const char *pathname) { diff --git a/com32/lib/readdir.c b/com32/lib/readdir.c index 2ec7c7b3..3737d1ad 100644 --- a/com32/lib/readdir.c +++ b/com32/lib/readdir.c @@ -10,6 +10,7 @@ #include #include #include +#include struct dirent *readdir(DIR * dir) { @@ -28,8 +29,10 @@ struct dirent *readdir(DIR * dir) __com32.cs_intcall(0x22, ®s, ®s); - /* Don't do this as we won't be able to rewind. +#if 0 + /* Don't do this as we won't be able to rewind. */ dir->dd_fd = regs.esi.w[0]; /* Shouldn't be needed? */ +#endif if ((!(regs.eflags.l & EFLAGS_CF)) && (regs.esi.w[0] != 0)) { newde = calloc(1, sizeof(newde)); if (newde != NULL) { -- cgit v1.2.1 From ca0b7b54ad00ff1d6d465cc1cf0c307293d721cc Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 10 Jan 2010 12:53:51 -0800 Subject: com32/lib: fix warning in str*cmp() Shut up a warning about initializing pointer across signedness. Signed-off-by: H. Peter Anvin --- com32/lib/strcasecmp.c | 3 ++- com32/lib/strcmp.c | 3 ++- com32/lib/strncasecmp.c | 3 ++- com32/lib/strncmp.c | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/com32/lib/strcasecmp.c b/com32/lib/strcasecmp.c index 849c21fd..30949a09 100644 --- a/com32/lib/strcasecmp.c +++ b/com32/lib/strcasecmp.c @@ -7,7 +7,8 @@ int strcasecmp(const char *s1, const char *s2) { - const unsigned char *c1 = s1, *c2 = s2; + const unsigned char *c1 = (const unsigned char *)s1; + const unsigned char *c2 = (const unsigned char *)s2; unsigned char ch; int d = 0; diff --git a/com32/lib/strcmp.c b/com32/lib/strcmp.c index 77bb2b41..47a4aad8 100644 --- a/com32/lib/strcmp.c +++ b/com32/lib/strcmp.c @@ -6,7 +6,8 @@ int strcmp(const char *s1, const char *s2) { - const unsigned char *c1 = s1, *c2 = s2; + const unsigned char *c1 = (const unsigned char *)s1; + const unsigned char *c2 = (const unsigned char *)s2; unsigned char ch; int d = 0; diff --git a/com32/lib/strncasecmp.c b/com32/lib/strncasecmp.c index 8b8b967a..2caac0a5 100644 --- a/com32/lib/strncasecmp.c +++ b/com32/lib/strncasecmp.c @@ -7,7 +7,8 @@ int strncasecmp(const char *s1, const char *s2, size_t n) { - const unsigned char *c1 = s1, *c2 = s2; + const unsigned char *c1 = (const unsigned char *)s1; + const unsigned char *c2 = (const unsigned char *)s2; unsigned char ch; int d = 0; diff --git a/com32/lib/strncmp.c b/com32/lib/strncmp.c index f2f2f022..e41b9e36 100644 --- a/com32/lib/strncmp.c +++ b/com32/lib/strncmp.c @@ -6,7 +6,8 @@ int strncmp(const char *s1, const char *s2, size_t n) { - const unsigned char *c1 = s1, *c2 = s2; + const unsigned char *c1 = (const unsigned char *)s1; + const unsigned char *c2 = (const unsigned char *)s2; unsigned char ch; int d = 0; -- cgit v1.2.1 From aeace38fa079d56b46898385a926df5356146b1d Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 10 Jan 2010 12:54:24 -0800 Subject: memdisk: fix non-prototype function declaration () is not a prototype, use (void) Signed-off-by: H. Peter Anvin --- memdisk/inflate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/memdisk/inflate.c b/memdisk/inflate.c index 30df244d..e7825f0c 100644 --- a/memdisk/inflate.c +++ b/memdisk/inflate.c @@ -998,7 +998,7 @@ static void makecrc(void) /* * Do the uncompression! */ -int gunzip() +int gunzip(void) { int res; -- cgit v1.2.1 From d286efcc42589f61772d551deae486e76f51e960 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 10 Jan 2010 12:55:11 -0800 Subject: com32/lib: fix unused parameter warning in chdir() chdir() is a stub at the moment... to be fixed in Syslinux 4. Signed-off-by: H. Peter Anvin --- com32/lib/chdir.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/com32/lib/chdir.c b/com32/lib/chdir.c index 6f92d668..6a365f3b 100644 --- a/com32/lib/chdir.c +++ b/com32/lib/chdir.c @@ -8,6 +8,10 @@ int chdir(const char *path) { + /* Actually implement something here... */ + + (void)path; + errno = ENOSYS; return -1; } -- cgit v1.2.1 From bd938bd98412ec9d0c24856be45110078f1ad1ae Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 10 Jan 2010 12:56:07 -0800 Subject: com32/lib: fix unused argument warning in fdopendir() fdopendir() is a stub, and probably will remain such. Signed-off-by: H. Peter Anvin --- com32/lib/fdopendir.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/com32/lib/fdopendir.c b/com32/lib/fdopendir.c index 5fe11617..4fc31388 100644 --- a/com32/lib/fdopendir.c +++ b/com32/lib/fdopendir.c @@ -8,6 +8,8 @@ DIR *fdopendir(int __fd) { + (void)__fd; + errno = ENOSYS; return NULL; } -- cgit v1.2.1 From 3958fc32f4e02ff0b0054faf1afbb7c619c3d42b Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 10 Jan 2010 12:57:48 -0800 Subject: libgcc: fix signedness warning in __moddi3() Intentional cross-signedness pointer passing, add a cast. Signed-off-by: H. Peter Anvin --- com32/lib/libgcc/__moddi3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com32/lib/libgcc/__moddi3.c b/com32/lib/libgcc/__moddi3.c index ac8d3af7..4fc55884 100644 --- a/com32/lib/libgcc/__moddi3.c +++ b/com32/lib/libgcc/__moddi3.c @@ -21,7 +21,7 @@ int64_t __moddi3(int64_t num, int64_t den) minus ^= 1; } - (void)__udivmoddi4(num, den, &v); + (void)__udivmoddi4(num, den, (uint64_t *)&v); if (minus) v = -v; -- cgit v1.2.1 From c1a51d8ec6bbc7ff9105814d9bce6dae6ea2e005 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 10 Jan 2010 12:59:48 -0800 Subject: com32/lib: add cast in __parse_argv() ALIGN_UP_FOR() returns the type of the original pointer, but we want it to be the type that we're actually going to use. Perhaps ALIGN_UP_FOR() should be changed, but for now, just add the proper cast. Signed-off-by: H. Peter Anvin --- com32/lib/sys/argv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com32/lib/sys/argv.c b/com32/lib/sys/argv.c index b325f26d..8e9aabdb 100644 --- a/com32/lib/sys/argv.c +++ b/com32/lib/sys/argv.c @@ -75,7 +75,7 @@ int __parse_argv(char ***argv, const char *str) } /* Now create argv */ - arg = ALIGN_UP_FOR(q, char *); + arg = (char **)ALIGN_UP_FOR(q, char *); *argv = arg; *arg++ = argv0; /* argv[0] */ -- cgit v1.2.1 From 393a9402b36c9b1ef866a7230e0e4e46781a1a09 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 10 Jan 2010 13:03:47 -0800 Subject: com32/lib: fix inappropriate & in sys/colortable.c The & is incorrect... not actively harmful, but generates a warning. Signed-off-by: H. Peter Anvin --- com32/lib/sys/colortable.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com32/lib/sys/colortable.c b/com32/lib/sys/colortable.c index df6d9782..ab1c4246 100644 --- a/com32/lib/sys/colortable.c +++ b/com32/lib/sys/colortable.c @@ -4,6 +4,6 @@ static struct color_table default_color_table[] = { {"default", "0", 0xffffffff, 0x00000000, SHADOW_NORMAL} }; -struct color_table *console_color_table = &default_color_table; +struct color_table *console_color_table = default_color_table; int console_color_table_size = (sizeof default_color_table / sizeof(struct color_table)); -- cgit v1.2.1 From e15e3124743844b8e905b122b8c8c9e864bb2f66 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 10 Jan 2010 13:05:26 -0800 Subject: com32/lib: fix external prototype for __vesacon_open() The external prototype for __vesacon_open() was incorrect; this is a good example of why external prototypes are bad, incidentally. Signed-off-by: H. Peter Anvin --- com32/lib/sys/vesaserial_write.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com32/lib/sys/vesaserial_write.c b/com32/lib/sys/vesaserial_write.c index 47527c3a..775ca19e 100644 --- a/com32/lib/sys/vesaserial_write.c +++ b/com32/lib/sys/vesaserial_write.c @@ -38,7 +38,7 @@ #include #include "file.h" -extern int __vesacon_open(void); +extern int __vesacon_open(struct file_info *); extern int __vesacon_close(struct file_info *); extern ssize_t __vesacon_write(struct file_info *, const void *, size_t); extern ssize_t __xserial_write(struct file_info *, const void *, size_t); -- cgit v1.2.1 From 0ca76a5d902632787427cc9c403a780c0c1d4473 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 10 Jan 2010 13:07:39 -0800 Subject: zlib: fix warning in crc32.c Fix a signed/unsigned warning in crc32.c. Signed-off-by: H. Peter Anvin --- com32/lib/zlib/crc32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com32/lib/zlib/crc32.c b/com32/lib/zlib/crc32.c index 447f138e..67e6f31e 100644 --- a/com32/lib/zlib/crc32.c +++ b/com32/lib/zlib/crc32.c @@ -100,7 +100,7 @@ local void make_crc_table() /* make exclusive-or pattern from polynomial (0xedb88320UL) */ poly = 0UL; - for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++) + for (n = 0; n < (int)(sizeof(p)/sizeof(unsigned char)); n++) poly |= 1UL << (31 - p[n]); /* generate a crc for every 8-bit value */ -- cgit v1.2.1 From 3341029e272cfa3a5f73aeed20f7b49b8bbca49e Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 10 Jan 2010 13:09:57 -0800 Subject: com32/lib: remove unused variable in syslinux_getadv() Remove unused variable, thus removing a warning. Signed-off-by: H. Peter Anvin --- com32/lib/syslinux/getadv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com32/lib/syslinux/getadv.c b/com32/lib/syslinux/getadv.c index 456084b0..5578313e 100644 --- a/com32/lib/syslinux/getadv.c +++ b/com32/lib/syslinux/getadv.c @@ -39,7 +39,7 @@ const void *syslinux_getadv(int tag, size_t * size) { const uint8_t *p; - size_t left, len; + size_t left; p = syslinux_adv_ptr(); left = syslinux_adv_size(); -- cgit v1.2.1 From c1f0e3a72993dad2767445d10ef0a581070e8a1d Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 10 Jan 2010 13:13:56 -0800 Subject: disk/ata.c: fix signedness weirdness in ata_id_c_string() Fix signedness weirdness in ata_id_c_string(), thus killing a warning. Signed-off-by: H. Peter Anvin --- com32/gpllib/disk/ata.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com32/gpllib/disk/ata.c b/com32/gpllib/disk/ata.c index b0c2b63c..78f669ec 100644 --- a/com32/gpllib/disk/ata.c +++ b/com32/gpllib/disk/ata.c @@ -55,7 +55,7 @@ void ata_id_c_string(const uint16_t * id, unsigned char *s, ata_id_string(id, s, ofs, len - 1); - p = s + strnlen(s, len - 1); + p = s + strnlen((const char *)s, len - 1); while (p > s && p[-1] == ' ') p--; *p = '\0'; -- cgit v1.2.1 From f15e98672b78b204356585ea3645bcea414c41b1 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 10 Jan 2010 13:14:59 -0800 Subject: disk/bootloaders.c: fix bogus const in get_bootloader_string() get_bootloader_string() takes a mutable first argument; the call chain does have call paths on which this argument will be modified. Signed-off-by: H. Peter Anvin --- com32/gplinclude/disk/bootloaders.h | 2 +- com32/gpllib/disk/bootloaders.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/com32/gplinclude/disk/bootloaders.h b/com32/gplinclude/disk/bootloaders.h index 5a6ff9d9..56a0f4e3 100644 --- a/com32/gplinclude/disk/bootloaders.h +++ b/com32/gplinclude/disk/bootloaders.h @@ -14,6 +14,6 @@ #include #include -int get_bootloader_string(const struct driveinfo *, const struct part_entry *, +int get_bootloader_string(struct driveinfo *, const struct part_entry *, char *, const int); #endif /* __BOOTLOADERS_H_ */ diff --git a/com32/gpllib/disk/bootloaders.c b/com32/gpllib/disk/bootloaders.c index 29aecbd4..188dd64b 100644 --- a/com32/gpllib/disk/bootloaders.c +++ b/com32/gpllib/disk/bootloaders.c @@ -22,7 +22,7 @@ * @buffer: pre-allocated buffer * @buffer_size: @buffer size **/ -int get_bootloader_string(const struct driveinfo *d, const struct part_entry *p, +int get_bootloader_string(struct driveinfo *d, const struct part_entry *p, char *buffer, const int buffer_size) { char boot_sector[SECTOR * sizeof(char)]; -- cgit v1.2.1 From 3e1e94276c2917b98d62286529b605931a721dbc Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 10 Jan 2010 13:18:48 -0800 Subject: dmi_processor.c: remove unreachable table values A uint8_t can't have values all the way up to 0x12e... Signed-off-by: H. Peter Anvin --- com32/gpllib/dmi/dmi_processor.c | 52 ++-------------------------------------- 1 file changed, 2 insertions(+), 50 deletions(-) diff --git a/com32/gpllib/dmi/dmi_processor.c b/com32/gpllib/dmi/dmi_processor.c index fd007da3..1cd9d1ba 100644 --- a/com32/gpllib/dmi/dmi_processor.c +++ b/com32/gpllib/dmi/dmi_processor.c @@ -49,7 +49,7 @@ const char *dmi_processor_type(uint8_t code) const char *dmi_processor_family(uint8_t code, char *manufacturer) { /* 3.3.5.2 */ - static const char *family[] = { + static const char *family[256] = { NULL, /* 0x00 */ "Other", "Unknown", @@ -306,54 +306,6 @@ const char *dmi_processor_family(uint8_t code, char *manufacturer) NULL, NULL, NULL, /* 0xFF */ - NULL, - NULL, - NULL, - NULL, - "SH-3", - "SH-4", - NULL, /*0x106*/ - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, /*0x110*/ - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - "ARM", - "StrongARM", - NULL, /*0x19A*/ - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, /*0x120*/ - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, /*0x12A*/ - NULL, - "6x86", - "MediaGX", - "MII" /*0x12E*/ - /* master.mif has values beyond that, but they can't be used for DMI */ }; /* Special case for ambiguous value 0xBE */ if (code == 0xBE) { @@ -367,7 +319,7 @@ const char *dmi_processor_family(uint8_t code, char *manufacturer) return "Core 2 or K7"; } - if ((code<=0x12E) && (family[code] != NULL)) { + if (family[code] != NULL) { return family[code]; } return out_of_spec; -- cgit v1.2.1 From 1da816e5101d61edc8a01e3c76a1b89933a8b863 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 10 Jan 2010 13:22:30 -0800 Subject: MCONFIG: add debugging version of GCCWARN Add the options that help smoke out bugs. Signed-off-by: H. Peter Anvin --- MCONFIG | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MCONFIG b/MCONFIG index c73520bd..e9c16d38 100644 --- a/MCONFIG +++ b/MCONFIG @@ -62,6 +62,8 @@ com32 = $(topdir)/com32 # Common warnings we want for all gcc-generated code GCCWARN := -W -Wall -Wstrict-prototypes +# Extremely useful variant for debugging... +#GCCWARN += -Wno-clobbered -Werror # Common stanza to make gcc generate .*.d dependency files MAKEDEPS = -Wp,-MT,$@,-MD,$(dir $@).$(notdir $@).d -- cgit v1.2.1