From 1cdb4f411c123a1f7402c9efbe46b3b05c3d94a1 Mon Sep 17 00:00:00 2001 From: Guillaume Cottenceau Date: Wed, 3 Jul 2002 18:38:05 +0000 Subject: compile with -W --- mdk-stage1/Makefile.common | 2 +- mdk-stage1/automatic.c | 2 +- mdk-stage1/bzlib/bzlib.c | 6 +++--- mdk-stage1/dhcp.c | 8 ++++---- mdk-stage1/disk.c | 14 +++++++------- mdk-stage1/init.c | 2 +- mdk-stage1/mar/mar-extract-only.c | 3 ++- mdk-stage1/mar/mar-frontend.c | 2 +- mdk-stage1/minilibc.c | 12 ++++++------ mdk-stage1/modules.c | 8 ++++++-- mdk-stage1/newt-frontend.c | 2 +- mdk-stage1/newt/checkboxtree.c | 4 ++-- mdk-stage1/newt/entry.c | 2 +- mdk-stage1/newt/grid.c | 2 +- mdk-stage1/newt/listbox.c | 6 +++--- mdk-stage1/newt/newt.c | 6 +++--- mdk-stage1/newt/textbox.c | 2 +- mdk-stage1/stage1.c | 12 +++++++++--- mdk-stage1/url.c | 2 +- 19 files changed, 54 insertions(+), 43 deletions(-) (limited to 'mdk-stage1') diff --git a/mdk-stage1/Makefile.common b/mdk-stage1/Makefile.common index 3cb8f3695..7506c1381 100644 --- a/mdk-stage1/Makefile.common +++ b/mdk-stage1/Makefile.common @@ -38,7 +38,7 @@ endif ifeq (ppc, $(ARCH)) CFLAGS = -Os -pipe -Wall -fomit-frame-pointer else -CFLAGS = -Os -pipe -Wall -Werror -fomit-frame-pointer +CFLAGS = -Os -pipe -Wall -Werror -W -fomit-frame-pointer endif DIETLIBC_INCLUDES = -I$(top_dir)/dietlibc/include -I. -I$(top_dir)/bzlib diff --git a/mdk-stage1/automatic.c b/mdk-stage1/automatic.c index 144166240..1c6e021a0 100644 --- a/mdk-stage1/automatic.c +++ b/mdk-stage1/automatic.c @@ -78,7 +78,7 @@ char * get_auto_value(char * auto_param) { { "method", "met" }, { "network", "netw" }, { "interface", "int" }, { "gateway", "gat" }, { "netmask", "netm" }, { "adsluser", "adslu" }, { "adslpass", "adslp" }, { "hostname", "hos" }, { "domain", "dom" }, { "server", "ser" }, { "directory", "dir" }, { "user", "use" }, - { "pass", "pas" }, { "disk", "dis" }, { "partition", "par" }, { NULL } }; + { "pass", "pas" }, { "disk", "dis" }, { "partition", "par" }, { NULL, NULL } }; struct param_elem * ptr_alias = short_aliases; while (ptr_alias->name) { if (streq(auto_param, ptr_alias->name)) diff --git a/mdk-stage1/bzlib/bzlib.c b/mdk-stage1/bzlib/bzlib.c index ebf6e269b..b1fc85236 100644 --- a/mdk-stage1/bzlib/bzlib.c +++ b/mdk-stage1/bzlib/bzlib.c @@ -121,14 +121,14 @@ int bz_config_ok ( void ) /*---------------------------------------------------*/ static -void* default_bzalloc ( void* opaque, Int32 items, Int32 size ) +void* default_bzalloc ( void* opaque __attribute__ ((unused)), Int32 items, Int32 size ) { void* v = malloc ( items * size ); return v; } static -void default_bzfree ( void* opaque, void* addr ) +void default_bzfree ( void* opaque __attribute__ ((unused)), void* addr ) { if (addr != NULL) free ( addr ); } @@ -1499,7 +1499,7 @@ int BZ_API(BZ2_bzwrite) (BZFILE* b, void* buf, int len ) /*---------------------------------------------------*/ -int BZ_API(BZ2_bzflush) (BZFILE *b) +int BZ_API(BZ2_bzflush) (BZFILE *b __attribute__ ((unused))) { /* do nothing now... */ return 0; diff --git a/mdk-stage1/dhcp.c b/mdk-stage1/dhcp.c index d375608f8..32c7a932b 100644 --- a/mdk-stage1/dhcp.c +++ b/mdk-stage1/dhcp.c @@ -329,11 +329,11 @@ static int get_vendor_code(struct bootp_request * bresp, unsigned char option, v } -static int currticks(void) +static unsigned long currticks(void) { struct timeval tv; - long csecs; - int ticks_per_csec, ticks_per_usec; + unsigned long csecs; + unsigned long ticks_per_csec, ticks_per_usec; /* Note: 18.2 ticks/sec. */ @@ -422,7 +422,7 @@ static int handle_transaction(int s, struct bootp_request * breq, struct bootp_r } /* We need to do some basic sanity checking of the header */ - if (j < (sizeof(*ip_hdr) + sizeof(*udp_hdr))) + if (j < (signed)(sizeof(*ip_hdr) + sizeof(*udp_hdr))) continue; ip_hdr = (void *) eth_packet; diff --git a/mdk-stage1/disk.c b/mdk-stage1/disk.c index e4593dfc4..8488a767e 100644 --- a/mdk-stage1/disk.c +++ b/mdk-stage1/disk.c @@ -45,7 +45,7 @@ struct partition_detection_anchor { static int seek_and_compare(int fd, struct partition_detection_anchor anch) { char buf[500]; - int count; + size_t count; if (lseek(fd, anch.offset, SEEK_SET) == (off_t)-1) { log_perror("seek failed"); return -1; @@ -70,13 +70,13 @@ static const char * detect_partition_type(char * dev) struct partition_detection_anchor anchor2; }; struct partition_detection_info partitions_signatures[] = { - { "Linux Swap", { 4086, "SWAP-SPACE" }, { 0, NULL } }, - { "Linux Swap", { 4086, "SWAPSPACE2" }, { 0, NULL } }, - { "Ext2", { 0x438, "\x53\xEF" }, { 0, NULL } }, - { "ReiserFS", { 0x10034, "ReIsErFs" }, { 0, NULL } }, - { "ReiserFS", { 0x10034, "ReIsEr2Fs" }, { 0, NULL } }, + { "Linux Swap", { 4086, "SWAP-SPACE" }, { 0, NULL }, { 0, NULL } }, + { "Linux Swap", { 4086, "SWAPSPACE2" }, { 0, NULL }, { 0, NULL } }, + { "Ext2", { 0x438, "\x53\xEF" }, { 0, NULL }, { 0, NULL } }, + { "ReiserFS", { 0x10034, "ReIsErFs" }, { 0, NULL }, { 0, NULL } }, + { "ReiserFS", { 0x10034, "ReIsEr2Fs" }, { 0, NULL }, { 0, NULL } }, { "XFS", { 0, "XFSB" }, { 0x200, "XAGF" }, { 0x400, "XAGI" } }, - { "JFS", { 0x8000, "JFS1" }, { 0, NULL } }, + { "JFS", { 0x8000, "JFS1" }, { 0, NULL }, { 0, NULL } }, { "NTFS", { 0x1FE, "\x55\xAA" }, { 0x3, "NTFS" }, { 0, NULL } }, { "FAT32", { 0x1FE, "\x55\xAA" }, { 0x52, "FAT32" }, { 0, NULL } }, { "FAT", { 0x1FE, "\x55\xAA" }, { 0x36, "FAT" }, { 0, NULL } }, diff --git a/mdk-stage1/init.c b/mdk-stage1/init.c index 1e8c115a7..dc4239ac3 100644 --- a/mdk-stage1/init.c +++ b/mdk-stage1/init.c @@ -331,7 +331,7 @@ void unmount_filesystems(void) int exit_value_rescue = 66; -int main(int argc, char **argv) +int main(int argc __attribute__ ((unused)), char **argv __attribute__ ((unused))) { pid_t installpid, childpid; int wait_status; diff --git a/mdk-stage1/mar/mar-extract-only.c b/mdk-stage1/mar/mar-extract-only.c index 723cc376d..a5b6ccd2f 100644 --- a/mdk-stage1/mar/mar-extract-only.c +++ b/mdk-stage1/mar/mar-extract-only.c @@ -159,7 +159,8 @@ mar_extract_file(char *mar_filename, char *filename_to_extract, char *dest_dir) char garb_buf[4096]; char *buf; char *dest_file; - int fd, i; + int fd; + size_t i; dest_file = (char *) alloca(strlen(dest_dir) + strlen(filename_to_extract) + 1); strcpy(dest_file, dest_dir); strcat(dest_file, filename_to_extract); diff --git a/mdk-stage1/mar/mar-frontend.c b/mdk-stage1/mar/mar-frontend.c index 2e87626db..f55ba6fe6 100644 --- a/mdk-stage1/mar/mar-frontend.c +++ b/mdk-stage1/mar/mar-frontend.c @@ -103,7 +103,7 @@ mar_create_file(char *dest_file, char **files) current_offset_filetable += sizeof(int); /* data_raw_data */ - if (fread(&temp_marfile_buffer[current_delta_rawdata + filetable_size], 1, fsize, f) != fsize) + if (fread(&temp_marfile_buffer[current_delta_rawdata + filetable_size], 1, fsize, f) != (size_t)fsize) { perror(files[filenum]); return -1; diff --git a/mdk-stage1/minilibc.c b/mdk-stage1/minilibc.c index 77b65accc..73d7deae5 100644 --- a/mdk-stage1/minilibc.c +++ b/mdk-stage1/minilibc.c @@ -24,7 +24,7 @@ #include "minilibc.h" -int atexit (void (*__func) (void)) +int atexit (void (*__func) (void) __attribute__ ((unused))) { return 0; } @@ -39,24 +39,24 @@ void exit() char ** _environ = NULL; int errno = 0; -void _init (int __status) +void _init (int __status __attribute__ ((unused))) { } -void __libc_init_first (int __status) +void __libc_init_first (int __status __attribute__ ((unused))) { } int __libc_start_main (int (*main) (int, char **, char **), int argc, - char **argv, void (*init) (void), void (*fini) (void), - void (*rtld_fini) (void), void *stack_end) + char **argv, void (*init) (void) __attribute__ ((unused)), void (*fini) (void) __attribute__ ((unused)), + void (*rtld_fini) (void) __attribute__ ((unused)), void *stack_end __attribute__ ((unused))) { exit ((*main) (argc, argv, NULL)); /* never get here */ return 0; } -void _fini (int __status) +void _fini (int __status __attribute__ ((unused))) { } diff --git a/mdk-stage1/modules.c b/mdk-stage1/modules.c index e2c06eebc..1fe1cd42a 100644 --- a/mdk-stage1/modules.c +++ b/mdk-stage1/modules.c @@ -95,7 +95,7 @@ static int load_modules_dependencies(void) fstat(fd, &s); buf = alloca(s.st_size + 1); - if (read(fd, buf, s.st_size) != s.st_size) { + if (read(fd, buf, s.st_size) != (ssize_t)s.st_size) { log_perror(deps_file); return -1; } @@ -190,7 +190,7 @@ static void add_modules_conf(char * str) return; } - if (write(fd, data, strlen(data) + 1) != strlen(data) + 1) + if (write(fd, data, strlen(data) + 1) != (ssize_t) (strlen(data) + 1)) log_perror(str); close(fd); @@ -239,7 +239,11 @@ static enum insmod_return insmod_with_deps(const char * mod_name, char * options } +#ifndef DISABLE_NETWORK enum insmod_return my_insmod(const char * mod_name, enum driver_type type, char * options) +#else +enum insmod_return my_insmod(const char * mod_name, enum driver_type type __attribute__ ((unused)), char * options) +#endif { int i; #ifndef DISABLE_NETWORK diff --git a/mdk-stage1/newt-frontend.c b/mdk-stage1/newt-frontend.c index 5e0af6ca2..f50defee1 100644 --- a/mdk-stage1/newt-frontend.c +++ b/mdk-stage1/newt-frontend.c @@ -233,7 +233,7 @@ enum return_type ask_yes_no(char *msg) static void (*callback_real_function)(char ** strings) = NULL; -static void default_callback(newtComponent co, void * data) +static void default_callback(newtComponent co __attribute__ ((unused)), void * data) { newtComponent * entries = data; char * strings[50], ** ptr; diff --git a/mdk-stage1/newt/checkboxtree.c b/mdk-stage1/newt/checkboxtree.c index b56bd1e9f..00113f23e 100644 --- a/mdk-stage1/newt/checkboxtree.c +++ b/mdk-stage1/newt/checkboxtree.c @@ -233,7 +233,7 @@ int newtCheckboxTreeAddArray(newtComponent co, i = 4 + (3 * item->depth); - if ((strlen(text) + i + ct->pad) > co->width) { + if ((strlen(text) + i + ct->pad) > (size_t)co->width) { co->width = strlen(text) + i + ct->pad; } @@ -669,7 +669,7 @@ void newtCheckboxTreeSetEntry(newtComponent co, const void * data, const char * i = 4 + (3 * item->depth); - if ((strlen(text) + i + ct->pad) > co->width) { + if ((strlen(text) + i + ct->pad) > (size_t)co->width) { co->width = strlen(text) + i + ct->pad; } diff --git a/mdk-stage1/newt/entry.c b/mdk-stage1/newt/entry.c index 154edba71..1b33f1c6f 100644 --- a/mdk-stage1/newt/entry.c +++ b/mdk-stage1/newt/entry.c @@ -228,7 +228,7 @@ static struct eventResult entryEvent(newtComponent co, case EV_MOUSE: if ((ev.u.mouse.type == MOUSE_BUTTON_DOWN) && (en->flags ^ NEWT_FLAG_HIDDEN)) { - if (strlen(en->buf) >= ev.u.mouse.x - co->left) { + if (strlen(en->buf) >= (size_t) (ev.u.mouse.x - co->left)) { en->cursorPosition = ev.u.mouse.x - co->left; newtGotorc(co->top, co->left +(en->cursorPosition - en->firstChar)); diff --git a/mdk-stage1/newt/grid.c b/mdk-stage1/newt/grid.c index 433011396..37d2b2e74 100644 --- a/mdk-stage1/newt/grid.c +++ b/mdk-stage1/newt/grid.c @@ -244,7 +244,7 @@ void newtGridWrappedWindow(newtGrid grid, char * title) { int width, height, offset = 0; newtGridGetSize(grid, &width, &height); - if (width < strlen(title) + 2) { + if ((size_t)width < strlen(title) + 2) { offset = ((strlen(title) + 2) - width) / 2; width = strlen(title) + 2; } diff --git a/mdk-stage1/newt/listbox.c b/mdk-stage1/newt/listbox.c index ef276aeb4..cdbf792ca 100644 --- a/mdk-stage1/newt/listbox.c +++ b/mdk-stage1/newt/listbox.c @@ -297,7 +297,7 @@ void newtListboxSetEntry(newtComponent co, int num, const char * text) { free(item->text); item->text = strdup(text); } - if (li->userHasSetWidth == 0 && strlen(text) > li->curWidth) { + if (li->userHasSetWidth == 0 && strlen(text) > (size_t)li->curWidth) { updateWidth(co, li, strlen(text)); } @@ -329,7 +329,7 @@ int newtListboxAppendEntry(newtComponent co, const char * text, item = li->boxItems = malloc(sizeof(struct items)); } - if (!li->userHasSetWidth && text && (strlen(text) > li->curWidth)) + if (!li->userHasSetWidth && text && (strlen(text) > (size_t)li->curWidth)) updateWidth(co, li, strlen(text)); item->text = strdup(text); item->data = data; item->next = NULL; @@ -369,7 +369,7 @@ int newtListboxInsertEntry(newtComponent co, const char * text, item->next = NULL; } - if (!li->userHasSetWidth && text && (strlen(text) > li->curWidth)) + if (!li->userHasSetWidth && text && (strlen(text) > (size_t)li->curWidth)) updateWidth(co, li, strlen(text)); item->text = strdup(text?text:"(null)"); item->data = data; diff --git a/mdk-stage1/newt/newt.c b/mdk-stage1/newt/newt.c index 1cfe3ac93..d6cb3cd96 100644 --- a/mdk-stage1/newt/newt.c +++ b/mdk-stage1/newt/newt.c @@ -129,7 +129,7 @@ void newtSetSuspendCallback(newtSuspendCallback cb, void * data) { suspendCallbackData = data; } -static void handleSigwinch(int signum) { +static void handleSigwinch(int signum __attribute__ ((unused))) { needResize = 1; } @@ -561,8 +561,8 @@ void newtDelay(int usecs) { select(0, &set, &set, &set, &tv); } -struct eventResult newtDefaultEventHandler(newtComponent c, - struct event ev) { +struct eventResult newtDefaultEventHandler(newtComponent c __attribute__ ((unused)), + struct event ev __attribute__ ((unused))) { struct eventResult er; er.result = ER_IGNORED; diff --git a/mdk-stage1/newt/textbox.c b/mdk-stage1/newt/textbox.c index 2f2880fe2..8eb4ae4db 100644 --- a/mdk-stage1/newt/textbox.c +++ b/mdk-stage1/newt/textbox.c @@ -64,7 +64,7 @@ int newtTextboxGetNumLines(newtComponent co) { } newtComponent newtTextboxReflowed(int left, int top, char * text, int width, - int flexDown, int flexUp, int flags) { + int flexDown, int flexUp, int flags __attribute__ ((unused))) { newtComponent co; char * reflowedText; int actWidth, actHeight; diff --git a/mdk-stage1/stage1.c b/mdk-stage1/stage1.c index 2c58a19a6..b70cf33a3 100644 --- a/mdk-stage1/stage1.c +++ b/mdk-stage1/stage1.c @@ -266,9 +266,9 @@ static void expert_third_party_modules(void) } +#ifdef ENABLE_PCMCIA static void handle_pcmcia(char ** pcmcia_adapter) { -#ifdef ENABLE_PCMCIA char buf[50]; int fd = open("/proc/version", O_RDONLY); int size; @@ -299,8 +299,8 @@ static void handle_pcmcia(char ** pcmcia_adapter) if (IS_EXPERT) expert_third_party_modules(); -#endif } +#endif /************************************************************ @@ -374,12 +374,14 @@ static enum return_type method_select_and_prepare(void) } -int main(int argc, char **argv, char **env) +int main(int argc __attribute__ ((unused)), char **argv __attribute__ ((unused)), char **env) { enum return_type ret; char ** argptr; char * stage2_args[30]; +#ifdef ENABLE_PCMCIA char * pcmcia_adapter = NULL; +#endif if (getpid() > 50) set_param(MODE_TESTING); @@ -400,7 +402,9 @@ int main(int argc, char **argv, char **env) if (IS_UPDATEMODULES) update_modules(); +#ifdef ENABLE_PCMCIA handle_pcmcia(&pcmcia_adapter); +#endif if (IS_CHANGEDISK) stg1_info_message("You are starting the installation with an alternate booting method. " @@ -440,10 +444,12 @@ int main(int argc, char **argv, char **env) *argptr++ = "/usr/bin/runinstall2"; *argptr++ = "--method"; *argptr++ = method_name; +#ifdef ENABLE_PCMCIA if (pcmcia_adapter) { *argptr++ = "--pcmcia"; *argptr++ = pcmcia_adapter; } +#endif if (disable_modules) *argptr++ = "--blank"; if (stage2_kickstart) { diff --git a/mdk-stage1/url.c b/mdk-stage1/url.c index 236782a50..ada5696cd 100644 --- a/mdk-stage1/url.c +++ b/mdk-stage1/url.c @@ -142,7 +142,7 @@ static int ftp_command(int sock, char * command, char * param) strcat(buf, "\r\n"); - if (write(sock, buf, strlen(buf)) != strlen(buf)) { + if (write(sock, buf, strlen(buf)) != (ssize_t)strlen(buf)) { return FTPERR_SERVER_IO_ERROR; } -- cgit v1.2.1