diff options
author | Paul Smith <psmith@gnu.org> | 2004-02-24 13:50:19 +0000 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2004-02-24 13:50:19 +0000 |
commit | f29b86c314e6e2b44a1eb83f1b44a3849d82655e (patch) | |
tree | 0e83f1ad4a44542b088878e8b9d6de48f16e949d | |
parent | be8c3dbc974c35fac33c8392b89482c10e4f8650 (diff) | |
download | gunmake-f29b86c314e6e2b44a1eb83f1b44a3849d82655e.tar.gz |
Many compiler warning cleanups.
Small fixes for W32 (from Jonathan Grant <jg-make@jguk.org>)
Maintainer enhancements to clean up the tree.
-rw-r--r-- | ChangeLog | 23 | ||||
-rw-r--r-- | README.W32.template | 3 | ||||
-rw-r--r-- | acinclude.m4 | 11 | ||||
-rw-r--r-- | ar.c | 15 | ||||
-rw-r--r-- | arscan.c | 18 | ||||
-rw-r--r-- | build_w32.bat | 2 | ||||
-rw-r--r-- | commands.c | 2 | ||||
-rw-r--r-- | configure.in | 3 | ||||
-rw-r--r-- | file.c | 2 | ||||
-rw-r--r-- | filedef.h | 4 | ||||
-rw-r--r-- | function.c | 38 | ||||
-rw-r--r-- | job.c | 2 | ||||
-rw-r--r-- | main.c | 23 | ||||
-rw-r--r-- | maintMakefile | 3 | ||||
-rw-r--r-- | make.h | 3 | ||||
-rw-r--r-- | remake.c | 2 | ||||
-rw-r--r-- | remote-stub.c | 13 | ||||
-rw-r--r-- | rule.c | 2 | ||||
-rw-r--r-- | vpath.c | 4 |
19 files changed, 105 insertions, 68 deletions
@@ -1,5 +1,28 @@ +2004-02-23 Jonathan Grant <jg-make@jguk.org> + + * README.W32.template: Add a notation about -j with BATCH_MODE_ONLY. + * build_w32.bat: Remove extra "+". + +2004-02-23 Paul D. Smith <psmith@gnu.org> + + * make.h: Create an UNUSED macro to mark unused parameters. + * (many): Clean up warnings by applying UNUSED, fixing + signed/unsigned incompatibilities, etc. + + * acinclude.m4 (AC_STRUCT_ST_MTIM_NSEC): Add quoting to silence + autoconf warnings. + * filedef.h: Name the command_state enumeration. + * file.c (set_command_state): Use the enumeration in the function + argument. + + * configure.in: Explicitly set SET_MAKE to empty, to disable + MAKE=make even when no make already exists. Fix bug #3823. + 2004-02-22 Paul D. Smith <psmith@gnu.org> + * maintMakefile: Perl script to clean up all non-CVS files. Use + it on all the subdirectories for the cvs-clean target. + * main.c (decode_switches): Require non-empty strings for all our string command-line options. Fixes Debian bug # 164165. diff --git a/README.W32.template b/README.W32.template index ed2b7d2..2b7b63c 100644 --- a/README.W32.template +++ b/README.W32.template @@ -79,7 +79,8 @@ GNU make and brain-dead shells (BATCH_MODE_ONLY_SHELL): To work around this difficulty, this version of make supports a batch mode. When BATCH_MODE_ONLY_SHELL is defined at compile time, make forces all command lines to be executed via script - files instead of by command line. + files instead of by command line. In this mode you must have a + working sh.exe in order to use parallel builds (-j). A native Windows32 system with no Bourne shell will also run in batch mode. All command lines will be put into batch files diff --git a/acinclude.m4 b/acinclude.m4 index 59a9359..0f62198 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -88,7 +88,7 @@ changequote([,])dnl dnl --------------------------------------------------------------------------- dnl From Paul Eggert <eggert@twinsun.com> -AC_DEFUN(AC_STRUCT_ST_MTIM_NSEC, +AC_DEFUN([AC_STRUCT_ST_MTIM_NSEC], [AC_CACHE_CHECK([for nanoseconds field of struct stat.st_mtim], ac_cv_struct_st_mtim_nsec, [ac_save_CPPFLAGS="$CPPFLAGS" @@ -101,13 +101,16 @@ AC_DEFUN(AC_STRUCT_ST_MTIM_NSEC, for ac_val in tv_nsec _tv_nsec st__tim.tv_nsec; do CPPFLAGS="$ac_save_CPPFLAGS -DST_MTIM_NSEC=$ac_val" AC_TRY_COMPILE([#include <sys/types.h> -#include <sys/stat.h>], [struct stat s; s.st_mtim.ST_MTIM_NSEC;], +#include <sys/stat.h> + ], [struct stat s; s.st_mtim.ST_MTIM_NSEC;], [ac_cv_struct_st_mtim_nsec=$ac_val; break]) done - CPPFLAGS="$ac_save_CPPFLAGS"]) + CPPFLAGS="$ac_save_CPPFLAGS" + ]) if test $ac_cv_struct_st_mtim_nsec != no; then - AC_DEFINE_UNQUOTED(ST_MTIM_NSEC, $ac_cv_struct_st_mtim_nsec, [Define if 'struct stat' contains a nanoseconds field]) + AC_DEFINE_UNQUOTED([ST_MTIM_NSEC], [$ac_cv_struct_st_mtim_nsec], + [Define if struct stat contains a nanoseconds field]) fi ] ) @@ -122,9 +122,10 @@ ar_member_date (char *name) /* ARGSUSED */ static long int -ar_member_date_1 (int desc, char *mem, int truncated, - long int hdrpos, long int datapos, long int size, - long int date, int uid, int gid, int mode, char *name) +ar_member_date_1 (int desc UNUSED, char *mem, int truncated, + long int hdrpos UNUSED, long int datapos UNUSED, + long int size UNUSED, long int date, + int uid UNUSED, int gid UNUSED, int mode UNUSED, char *name) { return ar_name_equal (name, mem, truncated) ? date : 0; } @@ -209,10 +210,10 @@ struct ar_glob_state element against the pattern in STATE. */ static long int -ar_glob_match (int desc, char *mem, int truncated, - long int hdrpos, long int datapos, long int size, - long int date, int uid, int gid, int mode, - struct ar_glob_state *state) +ar_glob_match (int desc UNUSED, char *mem, int truncated UNUSED, + long int hdrpos UNUSED, long int datapos UNUSED, + long int size UNUSED, long int date UNUSED, int uid UNUSED, + int gid UNUSED, int mode UNUSED, struct ar_glob_state *state) { if (fnmatch (state->pattern, mem, FNM_PATHNAME|FNM_PERIOD) == 0) { @@ -737,9 +737,10 @@ ar_name_equal (char *name, char *mem, int truncated) #ifndef VMS /* ARGSUSED */ static long int -ar_member_pos (int desc, char *mem, int truncated, - long int hdrpos, long int datapos, long int size, - long int date, int uid, int gid, int mode, char *name) +ar_member_pos (int desc UNUSED, char *mem, int truncated, + long int hdrpos, long int datapos UNUSED, long int size UNUSED, + long int date UNUSED, int uid UNUSED, int gid UNUSED, + int mode UNUSED, char *name) { if (!ar_name_equal (name, mem, truncated)) return 0; @@ -756,10 +757,11 @@ ar_member_pos (int desc, char *mem, int truncated, int ar_member_touch (char *arname, char *memname) { - register long int pos = ar_scan (arname, ar_member_pos, (long int) memname); - register int fd; + long int pos = ar_scan (arname, ar_member_pos, (long int) memname); + int fd; struct ar_hdr ar_hdr; - register int i; + int i; + unsigned int ui; struct stat statbuf; if (pos < 0) @@ -786,8 +788,8 @@ ar_member_touch (char *arname, char *memname) goto lose; #if defined(ARFMAG) || defined(ARFZMAG) || defined(AIAMAG) || defined(WINDOWS32) /* Advance member's time to that time */ - for (i = 0; i < sizeof ar_hdr.ar_date; i++) - ar_hdr.ar_date[i] = ' '; + for (ui = 0; ui < sizeof ar_hdr.ar_date; ui++) + ar_hdr.ar_date[ui] = ' '; sprintf (ar_hdr.ar_date, "%ld", (long int) statbuf.st_mtime); #ifdef AIAMAG ar_hdr.ar_date[strlen(ar_hdr.ar_date)] = ' '; diff --git a/build_w32.bat b/build_w32.bat index 431bcef..c366b65 100644 --- a/build_w32.bat +++ b/build_w32.bat @@ -1,5 +1,5 @@ set make=gnumake
-+if not exist config.h copy config.h.W32 config.h
+if not exist config.h copy config.h.W32 config.h
cd w32\subproc
echo "Creating the subproc library"
%ComSpec% /c build.bat
@@ -127,7 +127,7 @@ set_file_variables (struct file *file) { static char *plus_value=0, *bar_value=0, *qmark_value=0; - static int qmark_max=0, plus_max=0, bar_max=0; + static unsigned int qmark_max=0, plus_max=0, bar_max=0; unsigned int qmark_len, plus_len, bar_len; char *cp; diff --git a/configure.in b/configure.in index d815137..ebf65dc 100644 --- a/configure.in +++ b/configure.in @@ -335,6 +335,9 @@ AC_SUBST_FILE(MAINT_MAKEFILE) # Allow building with dmalloc AM_WITH_DMALLOC +# Forcibly disable SET_MAKE. If it's set it breaks things like the test +# scripts, etc. +SET_MAKE= # Sanity check and inform the user of what we found @@ -526,7 +526,7 @@ snap_deps (void) /* Set the `command_state' member of FILE and all its `also_make's. */ void -set_command_state (struct file *file, int state) +set_command_state (struct file *file, enum cmd_state state) { struct dep *d; @@ -65,7 +65,7 @@ struct file short int update_status; /* Status of the last attempt to update, or -1 if none has been made. */ - enum /* State of the commands. */ + enum cmd_state /* State of the commands. */ { /* Note: It is important that cs_not_started be zero. */ cs_not_started, /* Not yet started. */ cs_deps_running, /* Dep commands running. */ @@ -108,7 +108,7 @@ extern void remove_intermediates PARAMS ((int sig)); extern void snap_deps PARAMS ((void)); extern void rename_file PARAMS ((struct file *file, char *name)); extern void rehash_file PARAMS ((struct file *file, char *name)); -extern void set_command_state PARAMS ((struct file *file, int state)); +extern void set_command_state PARAMS ((struct file *file, enum cmd_state state)); extern void notice_finished_file PARAMS ((struct file *file)); extern void init_hash_files PARAMS ((void)); extern char *build_target_list PARAMS ((char *old_list)); @@ -395,7 +395,7 @@ string_glob (char *line) */ static char * -func_patsubst (char *o, char **argv, const char *funcname) +func_patsubst (char *o, char **argv, const char *funcname UNUSED) { o = patsubst_expand (o, argv[2], argv[0], argv[1], (char *) 0, (char *) 0); return o; @@ -403,7 +403,7 @@ func_patsubst (char *o, char **argv, const char *funcname) static char * -func_join (char *o, char **argv, const char *funcname) +func_join (char *o, char **argv, const char *funcname UNUSED) { int doneany = 0; @@ -443,7 +443,7 @@ func_join (char *o, char **argv, const char *funcname) static char * -func_origin (char *o, char **argv, const char *funcname) +func_origin (char *o, char **argv, const char *funcname UNUSED) { /* Expand the argument. */ register struct variable *v = lookup_variable (argv[0], strlen (argv[0])); @@ -638,7 +638,7 @@ func_addsuffix_addprefix (char *o, char **argv, const char *funcname) } static char * -func_subst (char *o, char **argv, const char *funcname) +func_subst (char *o, char **argv, const char *funcname UNUSED) { o = subst_expand (o, argv[2], argv[0], argv[1], strlen (argv[0]), strlen (argv[1]), 0, 0); @@ -648,7 +648,7 @@ func_subst (char *o, char **argv, const char *funcname) static char * -func_firstword (char *o, char **argv, const char *funcname) +func_firstword (char *o, char **argv, const char *funcname UNUSED) { unsigned int i; char *words = argv[0]; /* Use a temp variable for find_next_token */ @@ -662,7 +662,7 @@ func_firstword (char *o, char **argv, const char *funcname) static char * -func_words (char *o, char **argv, const char *funcname) +func_words (char *o, char **argv, const char *funcname UNUSED) { int i = 0; char *word_iterator = argv[0]; @@ -711,7 +711,7 @@ check_numeric (const char *s, const char *message) static char * -func_word (char *o, char **argv, const char *funcname) +func_word (char *o, char **argv, const char *funcname UNUSED) { char *end_p=0; int i=0; @@ -737,7 +737,7 @@ func_word (char *o, char **argv, const char *funcname) } static char * -func_wordlist (char *o, char **argv, const char *funcname) +func_wordlist (char *o, char **argv, const char *funcname UNUSED) { int start, count; @@ -774,7 +774,7 @@ func_wordlist (char *o, char **argv, const char *funcname) } static char* -func_findstring (char *o, char **argv, const char *funcname) +func_findstring (char *o, char **argv, const char *funcname UNUSED) { /* Find the first occurrence of the first string in the second. */ int i = strlen (argv[0]); @@ -785,7 +785,7 @@ func_findstring (char *o, char **argv, const char *funcname) } static char * -func_foreach (char *o, char **argv, const char *funcname) +func_foreach (char *o, char **argv, const char *funcname UNUSED) { /* expand only the first two. */ char *varname = expand_argument (argv[0], NULL); @@ -1005,7 +1005,7 @@ func_filter_filterout (char *o, char **argv, const char *funcname) static char * -func_strip (char *o, char **argv, const char *funcname) +func_strip (char *o, char **argv, const char *funcname UNUSED) { char *p = argv[0]; int doneany =0; @@ -1074,7 +1074,7 @@ func_error (char *o, char **argv, const char *funcname) chop argv[0] into words, and sort them. */ static char * -func_sort (char *o, char **argv, const char *funcname) +func_sort (char *o, char **argv, const char *funcname UNUSED) { char **words = 0; int nwords = 0; @@ -1136,7 +1136,7 @@ func_sort (char *o, char **argv, const char *funcname) */ static char * -func_if (char *o, char **argv, const char *funcname) +func_if (char *o, char **argv, const char *funcname UNUSED) { const char *begp = argv[0]; const char *endp = begp + strlen (argv[0]) - 1; @@ -1177,7 +1177,7 @@ func_if (char *o, char **argv, const char *funcname) } static char * -func_wildcard (char *o, char **argv, const char *funcname) +func_wildcard (char *o, char **argv, const char *funcname UNUSED) { #ifdef _AMIGA @@ -1198,7 +1198,7 @@ func_wildcard (char *o, char **argv, const char *funcname) */ static char * -func_eval (char *o, char **argv, const char *funcname) +func_eval (char *o, char **argv, const char *funcname UNUSED) { char *buf; unsigned int len; @@ -1217,7 +1217,7 @@ func_eval (char *o, char **argv, const char *funcname) static char * -func_value (char *o, char **argv, const char *funcname) +func_value (char *o, char **argv, const char *funcname UNUSED) { /* Look up the variable. */ struct variable *v = lookup_variable (argv[0], strlen (argv[0])); @@ -1417,10 +1417,10 @@ msdos_openpipe (int* pipedes, int *pidp, char *text) #else #ifndef _AMIGA static char * -func_shell (char *o, char **argv, const char *funcname) +func_shell (char *o, char **argv, const char *funcname UNUSED) { char* batch_filename = NULL; - int i; + unsigned int i; #ifdef __MSDOS__ FILE *fpipe; @@ -1911,7 +1911,7 @@ handle_function (char **op, char **stringp) assigned to $1, $2, ... $N. $0 is the name of the function. */ static char * -func_call (char *o, char **argv, const char *funcname) +func_call (char *o, char **argv, const char *funcname UNUSED) { static int max_args = 0; char *fname; @@ -415,7 +415,7 @@ vms_handle_apos (char *p) static unsigned int dead_children = 0; RETSIGTYPE -child_handler (int sig) +child_handler (int sig UNUSED) { ++dead_children; @@ -389,7 +389,7 @@ static const struct command_switch switches[] = { 'W', string, (char *) &new_files, 0, 0, 0, 0, 0, "what-if" }, { CHAR_MAX+4, flag, (char *) &warn_undefined_variables_flag, 1, 1, 0, 0, 0, "warn-undefined-variables" }, - { '\0', } + { 0 } }; /* Secondary long names for options. */ @@ -545,7 +545,7 @@ enter_command_line_file (char *name) /* Toggle -d on receipt of SIGUSR1. */ static RETSIGTYPE -debug_signal_handler (int sig) +debug_signal_handler (int sig UNUSED) { db_level = db_level ? DB_NONE : DB_BASIC; } @@ -834,8 +834,8 @@ main (int argc, char **argv, char **envp) #endif { static char *stdin_nm = 0; - register struct file *f; - register unsigned int i; + struct file *f; + int i; char **p; struct dep *read_makefiles; PATH_VAR (current_directory); @@ -1510,9 +1510,10 @@ main (int argc, char **argv, char **envp) if (jobserver_fds) { char *cp; + unsigned int ui; - for (i=1; i < jobserver_fds->idx; ++i) - if (!streq (jobserver_fds->list[0], jobserver_fds->list[i])) + for (ui=1; ui < jobserver_fds->idx; ++ui) + if (!streq (jobserver_fds->list[0], jobserver_fds->list[ui])) fatal (NILF, _("internal error: multiple --jobserver-fds options")); /* Now parse the fds string and make sure it has the proper format. */ @@ -1743,7 +1744,7 @@ main (int argc, char **argv, char **envp) /* Nonzero if any makefile we care about failed in updating or could not be found at all. */ int any_failed = 0; - register unsigned int i; + unsigned int i; struct dep *d; for (i = 0, d = read_makefiles; d != 0; ++i, d = d->next) @@ -1817,7 +1818,7 @@ main (int argc, char **argv, char **envp) if (makefiles != 0) { /* These names might have changed. */ - register unsigned int i, j = 0; + int i, j = 0; for (i = 1; i < argc; ++i) if (strneq (argv[i], "-f", 2)) /* XXX */ { @@ -2021,9 +2022,9 @@ static struct option long_options[(sizeof (switches) / sizeof (switches[0])) + static void init_switches (void) { - register char *p; - register int c; - register unsigned int i; + char *p; + unsigned int c; + unsigned int i; if (options[0] != '\0') /* Already done. */ diff --git a/maintMakefile b/maintMakefile index 67f3098..31e24ae 100644 --- a/maintMakefile +++ b/maintMakefile @@ -80,7 +80,8 @@ build.sh.in: build.template Makefile maintFILES = configure aclocal.m4 config.h.in Makefile.in stamp-h.in CVS-CLEAN-FILES += $(maintFILES) $(TEMPLATES) $(MTEMPLATES) NMakefile \ - build.sh.in .deps .dep_segment ABOUT-NLS + build.sh.in .deps .dep_segment ABOUT-NLS \ + ansi2knr.* # This rule tries to clean the tree right down to how it looks when you do a # virgin CVS checkout. @@ -210,6 +210,7 @@ extern unsigned int get_path_max PARAMS ((void)); # define __printf__ printf # endif #endif +#define UNUSED __attribute__ ((unused)) #if defined (STDC_HEADERS) || defined (__GNU_LIBRARY__) # include <stdlib.h> @@ -468,7 +469,7 @@ extern void install_default_implicit_rules PARAMS ((void)); extern void build_vpath_lists PARAMS ((void)); extern void construct_vpath_list PARAMS ((char *pattern, char *dirpath)); extern int vpath_search PARAMS ((char **file, FILE_TIMESTAMP *mtime_ptr)); -extern int gpath_search PARAMS ((char *file, int len)); +extern int gpath_search PARAMS ((char *file, unsigned int len)); extern void construct_include_path PARAMS ((char **arg_dirs)); @@ -1333,7 +1333,7 @@ library_search (char **lib, FILE_TIMESTAMP *mtime_ptr) while ((p = find_next_token (&p2, &len)) != 0) { static char *buf = NULL; - static int buflen = 0; + static unsigned int buflen = 0; static int libdir_maxlen = -1; char *libbuf = variable_expand (""); diff --git a/remote-stub.c b/remote-stub.c index 73e6018..1496488 100644 --- a/remote-stub.c +++ b/remote-stub.c @@ -42,7 +42,7 @@ remote_cleanup (void) /* Return nonzero if the next job should be done remotely. */ int -start_remote_job_p (int first_p) +start_remote_job_p (int first_p UNUSED) { return 0; } @@ -55,8 +55,9 @@ start_remote_job_p (int first_p) nonzero if it is remote (meaning *ID_PTR is a process ID). */ int -start_remote_job (char **argv, char **envp, int stdin_fd, - int *is_remote, int *id_ptr, int *used_stdin) +start_remote_job (char **argv UNUSED, char **envp UNUSED, int stdin_fd UNUSED, + int *is_remote UNUSED, int *id_ptr UNUSED, + int *used_stdin UNUSED) { return -1; } @@ -68,8 +69,8 @@ start_remote_job (char **argv, char **envp, int stdin_fd, 0 if we would have to block and !BLOCK, or < 0 if there were none. */ int -remote_status (int *exit_code_ptr, int *signal_ptr, int *coredump_ptr, - int block) +remote_status (int *exit_code_ptr UNUSED, int *signal_ptr UNUSED, + int *coredump_ptr UNUSED, int block UNUSED) { errno = ECHILD; return -1; @@ -95,7 +96,7 @@ unblock_remote_children (void) /* Send signal SIG to child ID. Return 0 if successful, -1 if not. */ int -remote_kill (int id, int sig) +remote_kill (int id UNUSED, int sig UNUSED) { return -1; } @@ -69,7 +69,7 @@ void count_implicit_rule_limits (void) { char *name; - unsigned int namelen; + int namelen; register struct rule *rule, *lastrule; num_pattern_rules = max_pattern_targets = max_pattern_deps = 0; @@ -316,9 +316,9 @@ construct_vpath_list (char *pattern, char *dirpath) in. If it is found, return 1. Otherwise we return 0. */ int -gpath_search (char *file, int len) +gpath_search (char *file, unsigned int len) { - register char **gp; + char **gp; if (gpaths && (len <= gpaths->maxlen)) for (gp = gpaths->searchpath; *gp != NULL; ++gp) |