Applies to the GNU make CVS snapshot as of July 01, 2010.
Fixes a horde of compiler warnings.  First apply make-cvs-20091026-w64.patch,
then apply this one (make-cvs-20100701-w64-2.patch).

==============================================================================

diff -urNp make-cvs~/ar.c make-cvs/ar.c
--- make-cvs~/ar.c	2009-10-25 20:56:44.000000000 +0200
+++ make-cvs/ar.c	2010-02-02 14:20:00.000000000 +0200
@@ -212,7 +212,7 @@ static int
 glob_pattern_p (const char *pattern, int quote)
 {
   const char *p;
-  int open = 0;
+  int opened = 0;
 
   for (p = pattern; *p != '\0'; ++p)
     switch (*p)
@@ -227,11 +227,11 @@ glob_pattern_p (const char *pattern, int
 	break;
 
       case '[':
-	open = 1;
+	opened = 1;
 	break;
 
       case ']':
-	if (open)
+	if (opened)
 	  return 1;
 	break;
       }
diff -urNp make-cvs~/arscan.c make-cvs/arscan.c
--- make-cvs~/arscan.c	2009-11-16 04:31:23.000000000 +0200
+++ make-cvs/arscan.c	2010-02-02 14:20:00.000000000 +0200
@@ -630,8 +630,8 @@ ar_scan (const char *archive, ar_member_
 	}
 
 #ifndef	M_XENIX
-	sscanf (member_header.ar_mode, "%o", &eltmode);
-	eltsize = atol (member_header.ar_size);
+	sscanf ((const char *) member_header.ar_mode, "%o", &eltmode);
+	eltsize = atol ((const char *) member_header.ar_size);
 #else	/* Xenix.  */
 	eltmode = (unsigned short int) member_header.ar_mode;
 	eltsize = member_header.ar_size;
@@ -641,9 +641,9 @@ ar_scan (const char *archive, ar_member_
 	  (*function) (desc, name, ! long_name, member_offset,
 		       member_offset + AR_HDR_SIZE, eltsize,
 #ifndef	M_XENIX
-		       atol (member_header.ar_date),
-		       atoi (member_header.ar_uid),
-		       atoi (member_header.ar_gid),
+		       atol ((const char *) member_header.ar_date),
+		       atoi ((const char *) member_header.ar_uid),
+		       atoi ((const char *) member_header.ar_gid),
 #else	/* Xenix.  */
 		       member_header.ar_date,
 		       member_header.ar_uid,
@@ -812,7 +812,7 @@ ar_member_touch (const char *arname, con
   /* Advance member's time to that time */
   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);
+  sprintf ((char *) ar_hdr.ar_date, "%ld", (long int) statbuf.st_mtime);
 #ifdef AIAMAG
   ar_hdr.ar_date[strlen(ar_hdr.ar_date)] = ' ';
 #endif
diff -urNp make-cvs~/dir.c make-cvs/dir.c
--- make-cvs~/dir.c	2009-11-16 04:31:23.000000000 +0200
+++ make-cvs/dir.c	2010-02-02 14:28:19.000000000 +0200
@@ -123,7 +123,6 @@ downcase (const char *filename)
 {
   static PATH_VAR (new_filename);
   char *df;
-  int i;
 
   if (filename == 0)
     return 0;
diff -urNp make-cvs~/getopt.c make-cvs/getopt.c
--- make-cvs~/getopt.c	2009-10-25 20:56:45.000000000 +0200
+++ make-cvs/getopt.c	2010-02-02 14:20:00.000000000 +0200
@@ -436,6 +436,9 @@ _getopt_initialize (int argc, char *cons
     }
   else
     nonoption_flags_len = 0;
+#else
+  (void)argc;
+  (void)argv;
 #endif
 
   return optstring;
@@ -678,7 +681,7 @@ _getopt_internal (int argc, char *const 
 		optarg = nameend + 1;
 	      else
 		{
-		  if (opterr)
+		  if (opterr) {
 		   if (argv[optind - 1][1] == '-')
 		    /* --option */
 		    fprintf (stderr,
@@ -689,7 +692,7 @@ _getopt_internal (int argc, char *const 
 		    fprintf (stderr,
 		     _("%s: option `%c%s' doesn't allow an argument\n"),
 		     argv[0], argv[optind - 1][0], pfound->name);
-
+		  }
 		  nextchar += strlen (nextchar);
 
 		  optopt = pfound->val;
diff -urNp make-cvs~/hash.c make-cvs/hash.c
--- make-cvs~/hash.c	2009-06-07 20:40:08.000000000 +0300
+++ make-cvs/hash.c	2010-02-02 14:20:00.000000000 +0200
@@ -47,7 +47,7 @@ hash_init (struct hash_table *ht, unsign
   if (ht->ht_vec == 0)
     {
       fprintf (stderr, _("can't allocate %ld bytes for hash table: memory exhausted"),
-	       ht->ht_size * sizeof(struct token *));
+	       ht->ht_size * (unsigned long)sizeof(struct token *));
       exit (1);
     }
 
diff -urNp make-cvs~/implicit.c make-cvs/implicit.c
--- make-cvs~/implicit.c	2009-11-12 18:42:36.000000000 +0200
+++ make-cvs/implicit.c	2010-02-02 14:20:00.000000000 +0200
@@ -211,7 +211,7 @@ pattern_search (struct file *file, int a
   unsigned int namelen = strlen (filename);
 
   /* The last slash in FILENAME (or nil if there is none).  */
-  char *lastslash;
+  const char *lastslash;
 
   /* This is a file-object used as an argument in
      recursive calls.  It never contains any data
diff -urNp make-cvs~/job.c make-cvs/job.c
--- make-cvs~/job.c	2010-02-02 12:01:55.000000000 +0200
+++ make-cvs/job.c	2010-02-02 14:20:00.000000000 +0200
@@ -246,7 +246,7 @@ static char *
 create_batch_file (char const *base, int unixy, int *fd)
 {
   const char *const ext = unixy ? "sh" : "bat";
-  const char *error = NULL;
+  const char *error_string = NULL;
   char temp_path[MAXPATHLEN]; /* need to know its length */
   unsigned path_size = GetTempPath(sizeof temp_path, temp_path);
   int path_is_dot = 0;
@@ -292,7 +292,7 @@ create_batch_file (char const *base, int
 
           else
             {
-              error = map_windows32_error_to_string (er);
+              error_string = map_windows32_error_to_string (er);
               break;
             }
         }
@@ -315,9 +315,9 @@ create_batch_file (char const *base, int
     }
 
   *fd = -1;
-  if (error == NULL)
-    error = _("Cannot create a temporary file\n");
-  fatal (NILF, error);
+  if (error_string == NULL)
+    error_string = _("Cannot create a temporary file\n");
+  fatal (NILF, error_string);
 
   /* not reached */
   return NULL;
@@ -513,9 +513,15 @@ reap_children (int block, int err)
 	{
 	  any_remote |= c->remote;
 	  any_local |= ! c->remote;
+#ifdef WINDOWS32
+	  DB (DB_JOBS, (_("Live child %p (%s) PID %Id %s\n"),
+                        c, c->file->name,
+                        c->pid, c->remote ? _(" (remote)") : ""));
+#else
 	  DB (DB_JOBS, (_("Live child 0x%08lx (%s) PID %ld %s\n"),
                         (unsigned long int) c, c->file->name,
                         (long) c->pid, c->remote ? _(" (remote)") : ""));
+#endif
 #ifdef VMS
 	  break;
 #endif
@@ -533,7 +539,9 @@ reap_children (int block, int err)
       else if (pid < 0)
 	{
           /* A remote status command failed miserably.  Punt.  */
+#if !defined(__MSDOS__) && !defined(_AMIGA) && !defined(WINDOWS32)
 	remote_status_lose:
+#endif
 	  pfatal_with_name ("remote_status");
 	}
       else
@@ -636,8 +644,7 @@ reap_children (int block, int err)
                              e, map_windows32_error_to_string(e));
                   }
                 else
-                  DB (DB_VERBOSE, ("Main thread handle = 0x%08lx\n",
-                                   (unsigned long)main_thread));
+                  DB (DB_VERBOSE, ("Main thread handle = %p\n", main_thread));
               }
 
             /* wait for anything to finish */
@@ -692,11 +699,18 @@ reap_children (int block, int err)
            Ignore it; it was inherited from our invoker.  */
         continue;
 
+#ifdef WINDOWS32
+      DB (DB_JOBS, (child_failed
+                    ? _("Reaping losing child %p PID %Id %s\n")
+                    : _("Reaping winning child %p PID %Id %s\n"),
+                    c, c->pid, c->remote ? _(" (remote)") : ""));
+#else
       DB (DB_JOBS, (child_failed
                     ? _("Reaping losing child 0x%08lx PID %ld %s\n")
                     : _("Reaping winning child 0x%08lx PID %ld %s\n"),
                     (unsigned long int) c, (long) c->pid,
                     c->remote ? _(" (remote)") : ""));
+#endif
 
       if (c->sh_batch_file) {
         DB (DB_JOBS, (_("Cleaning up temp batch file %s\n"),
@@ -797,9 +811,14 @@ reap_children (int block, int err)
            update_status to its also_make files.  */
         notice_finished_file (c->file);
 
+#ifdef WINDOWS32
+      DB (DB_JOBS, (_("Removing child %p PID %Id%s from chain.\n"),
+                    c, c->pid, c->remote ? _(" (remote)") : ""));
+#else
       DB (DB_JOBS, (_("Removing child 0x%08lx PID %ld%s from chain.\n"),
                     (unsigned long int) c, (long) c->pid,
                     c->remote ? _(" (remote)") : ""));
+#endif
 
       /* Block fatal signals while frobnicating the list, so that
          children and job_slots_used are always consistent.  Otherwise
@@ -842,8 +861,8 @@ static void
 free_child (struct child *child)
 {
   if (!jobserver_tokens)
-    fatal (NILF, "INTERNAL: Freeing child 0x%08lx (%s) but no tokens left!\n",
-           (unsigned long int) child, child->file->name);
+    fatal (NILF, "INTERNAL: Freeing child %p (%s) but no tokens left!\n",
+           child, child->file->name);
 
   /* If we're using the jobserver and this child is not the only outstanding
      job, put a token back into the pipe for it.  */
@@ -859,8 +878,8 @@ free_child (struct child *child)
       if (r != 1)
 	pfatal_with_name (_("write jobserver"));
 
-      DB (DB_JOBS, (_("Released token for child 0x%08lx (%s).\n"),
-                    (unsigned long int) child, child->file->name));
+      DB (DB_JOBS, (_("Released token for child %p (%s).\n"),
+                    child, child->file->name));
     }
 
   --jobserver_tokens;
@@ -1459,9 +1478,14 @@ start_waiting_job (struct child *c)
     {
     case cs_running:
       c->next = children;
+#ifdef WINDOWS32
+      DB (DB_JOBS, (_("Putting child %p (%s) PID %Id%s on the chain.\n"),
+                    c, c->file->name, c->pid, c->remote ? _(" (remote)") : ""));
+#else
       DB (DB_JOBS, (_("Putting child 0x%08lx (%s) PID %ld%s on the chain.\n"),
                     (unsigned long int) c, c->file->name,
                     (long) c->pid, c->remote ? _(" (remote)") : ""));
+#endif
       children = c;
       /* One more job slot is in use.  */
       ++job_slots_used;
@@ -2058,8 +2082,8 @@ exec_command (char **argv, char **envp)
           break;
       else
           fprintf(stderr,
-                  _("make reaped child pid %ld, still waiting for pid %ld\n"),
-                  (DWORD)hWaitPID, (DWORD)hPID);
+                  _("make reaped child pid %Iu, still waiting for pid %Iu\n"),
+                  (DWORD_PTR)hWaitPID, (DWORD_PTR)hPID);
     }
 
   /* return child's exit code as our exit code */
diff -urNp make-cvs~/main.c make-cvs/main.c
--- make-cvs~/main.c	2009-11-16 04:31:23.000000000 +0200
+++ make-cvs/main.c	2010-02-02 14:28:33.000000000 +0200
@@ -681,23 +681,23 @@ handle_runtime_exceptions( struct _EXCEP
   if (! ISDB (DB_VERBOSE))
     {
       sprintf(errmsg,
-              _("%s: Interrupt/Exception caught (code = 0x%lx, addr = 0x%lx)\n"),
-              prg, exrec->ExceptionCode, (DWORD)exrec->ExceptionAddress);
+              _("%s: Interrupt/Exception caught (code = 0x%lx, addr = 0x%Iu)\n"),
+              prg, exrec->ExceptionCode, (DWORD_PTR)exrec->ExceptionAddress);
       fprintf(stderr, errmsg);
       exit(255);
     }
 
   sprintf(errmsg,
-          _("\nUnhandled exception filter called from program %s\nExceptionCode = %lx\nExceptionFlags = %lx\nExceptionAddress = %lx\n"),
+          _("\nUnhandled exception filter called from program %s\nExceptionCode = %lx\nExceptionFlags = %lx\nExceptionAddress = %Iu\n"),
           prg, exrec->ExceptionCode, exrec->ExceptionFlags,
-          (DWORD)exrec->ExceptionAddress);
+          (DWORD_PTR)exrec->ExceptionAddress);
 
   if (exrec->ExceptionCode == EXCEPTION_ACCESS_VIOLATION
       && exrec->NumberParameters >= 2)
     sprintf(&errmsg[strlen(errmsg)],
             (exrec->ExceptionInformation[0]
-             ? _("Access violation: write operation at address %lx\n")
-             : _("Access violation: read operation at address %lx\n")),
+             ? _("Access violation: write operation at address %Iu\n")
+             : _("Access violation: read operation at address %Iu\n")),
             exrec->ExceptionInformation[1]);
 
   /* turn this on if we want to put stuff in the event log too */
@@ -978,7 +978,7 @@ main (int argc, char **argv, char **envp
   fatal_signal_mask = 0;
 #define	ADD_SIG(sig)	fatal_signal_mask |= sigmask (sig)
 #else
-#define	ADD_SIG(sig)
+#define	ADD_SIG(sig)	(void)sig
 #endif
 #endif
 
@@ -1399,7 +1399,7 @@ main (int argc, char **argv, char **envp
           /* WINDOWS32 chdir() doesn't work if the directory has a trailing '/'
              But allow -C/ just in case someone wants that.  */
           {
-            char *p = dir + strlen (dir) - 1;
+            char *p = (char *)dir + strlen (dir) - 1;
             while (p > dir && (p[0] == '/' || p[0] == '\\'))
               --p;
             p[1] = '\0';
diff -urNp make-cvs~/signame.c make-cvs/signame.c
--- make-cvs~/signame.c	2009-10-25 20:56:45.000000000 +0200
+++ make-cvs/signame.c	2010-02-02 14:20:00.000000000 +0200
@@ -229,7 +229,7 @@ signame_init (void)
 
 
 char *
-strsignal (int signal)
+strsignal (int sig)
 {
   static char buf[] = "Signal 12345678901234567890";
 
@@ -246,10 +246,10 @@ strsignal (int signal)
 # endif
 #endif
 
-  if (signal > 0 || signal < NSIG)
-    return (char *) sys_siglist[signal];
+  if (sig > 0 || sig < NSIG)
+    return (char *) sys_siglist[sig];
 
-  sprintf (buf, "Signal %d", signal);
+  sprintf (buf, "Signal %d", sig);
   return buf;
 }
 
