[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Fix compiler warnings in the WINDOWS32 build
From: |
Eli Zaretskii |
Subject: |
Fix compiler warnings in the WINDOWS32 build |
Date: |
Sat, 30 Jul 2005 18:58:50 +0300 |
Below please find some minor patches to prevent "gcc -Wall" from
complaining during the MinGW build of GNU Make 3.81 beta3:
2005-07-30 Eli Zaretskii <address@hidden>
* w32/pathstuff.c (getcwd_fs): Add parentheses around assignment,
to avoid compiler warnings.
* w32/subproc/sub_proc.c (process_easy): Fix format strings for printing
DWORD args.
* function.c (windows32_openpipe): Fix format strings for printing
DWORD args.
* job.c (reap_children) [WINDOWS32]: Don't declare `status' and
`reap_mode'.
(start_job_command): Fix format string for printing the result of
process_easy.
(start_job_command) [WINDOWS32]: Do not define.
(exec_command): Fix format string for printing HANDLE args.
* main.c (handle_runtime_exceptions): Fix sprintf format strings
to avoid compiler warnings.
(open_tmpfile): Declare fd only if HAVE_FDOPEN is defined.
--- function.c~0 2005-06-27 07:01:07.000000000 +0300
+++ function.c 2005-07-30 16:57:16.598750000 +0300
@@ -1329,7 +1329,7 @@ windows32_openpipe (int *pipedes, int *p
0,
TRUE,
DUPLICATE_SAME_ACCESS) == FALSE) {
- fatal (NILF, _("create_child_process: DuplicateHandle(In) failed
(e=%d)\n"),
+ fatal (NILF, _("create_child_process: DuplicateHandle(In) failed
(e=%ld)\n"),
GetLastError());
}
@@ -1340,12 +1340,12 @@ windows32_openpipe (int *pipedes, int *p
0,
TRUE,
DUPLICATE_SAME_ACCESS) == FALSE) {
- fatal (NILF, _("create_child_process: DuplicateHandle(Err) failed
(e=%d)\n"),
+ fatal (NILF, _("create_child_process: DuplicateHandle(Err) failed
(e=%ld)\n"),
GetLastError());
}
if (!CreatePipe(&hChildOutRd, &hChildOutWr, &saAttr, 0))
- fatal (NILF, _("CreatePipe() failed (e=%d)\n"), GetLastError());
+ fatal (NILF, _("CreatePipe() failed (e=%ld)\n"), GetLastError());
hProcess = process_init_fd(hIn, hChildOutWr, hErr);
--- main.c~0 2005-06-27 07:01:07.000000000 +0300
+++ main.c 2005-07-30 18:02:58.395625000 +0300
@@ -662,23 +662,23 @@ handle_runtime_exceptions( struct _EXCEP
if (! ISDB (DB_VERBOSE))
{
sprintf(errmsg,
- _("%s: Interrupt/Exception caught (code = 0x%x, addr = 0x%x)\n"),
- prg, exrec->ExceptionCode, exrec->ExceptionAddress);
+ _("%s: Interrupt/Exception caught (code = 0x%lx, addr =
0x%lx)\n"),
+ prg, exrec->ExceptionCode, (DWORD)exrec->ExceptionAddress);
fprintf(stderr, errmsg);
exit(255);
}
sprintf(errmsg,
- _("\nUnhandled exception filter called from program
%s\nExceptionCode = %x\nExceptionFlags = %x\nExceptionAddress = %x\n"),
+ _("\nUnhandled exception filter called from program
%s\nExceptionCode = %lx\nExceptionFlags = %lx\nExceptionAddress = %lx\n"),
prg, exrec->ExceptionCode, exrec->ExceptionFlags,
- exrec->ExceptionAddress);
+ (DWORD)exrec->ExceptionAddress);
if (exrec->ExceptionCode == EXCEPTION_ACCESS_VIOLATION
&& exrec->NumberParameters >= 2)
sprintf(&errmsg[strlen(errmsg)],
(exrec->ExceptionInformation[0]
- ? _("Access violation: write operation at address %x\n")
- : _("Access violation: read operation at address %x\n")),
+ ? _("Access violation: write operation at address %lx\n")
+ : _("Access violation: read operation at address %lx\n")),
exrec->ExceptionInformation[1]);
/* turn this on if we want to put stuff in the event log too */
@@ -838,7 +842,9 @@ extern int mkstemp PARAMS ((char *templa
FILE *
open_tmpfile(char **name, const char *template)
{
+#ifdef HAVE_FDOPEN
int fd;
+#endif
#if defined HAVE_MKSTEMP || defined HAVE_MKTEMP
# define TEMPLATE_LEN strlen (template)
@@ -1221,7 +1223,7 @@ main (int argc, char **argv, char **envp
decode_switches (argc, argv, 0);
#ifdef WINDOWS32
if (suspend_flag) {
- fprintf(stderr, "%s (pid = %d)\n", argv[0], GetCurrentProcessId());
+ fprintf(stderr, "%s (pid = %ld)\n", argv[0], GetCurrentProcessId());
fprintf(stderr, _("%s is suspending for 30 seconds..."), argv[0]);
Sleep(30 * 1000);
fprintf(stderr, _("done sleep(30). Continuing.\n"));
--- job.c~0 2005-06-26 09:31:30.000000000 +0300
+++ job.c 2005-07-30 18:27:04.161250000 +0300
@@ -444,9 +444,11 @@ extern int shell_function_pid, shell_fun
void
reap_children (int block, int err)
{
+#ifndef WINDOWS32
WAIT_T status;
/* Initially, assume we have some. */
int reap_more = 1;
+#endif
#ifdef WAIT_NOHANG
# define REAP_MORE reap_more
@@ -937,7 +939,7 @@ set_child_handler_action_flags (int set_
static void
start_job_command (struct child *child)
{
-#ifndef _AMIGA
+#if !defined(_AMIGA) && !defined(WINDOWS32)
static int bad_stdin = -1;
#endif
register char *p;
@@ -1351,7 +1353,7 @@ start_job_command (struct child *child)
int i;
unblock_sigs();
fprintf(stderr,
- _("process_easy() failed failed to launch process (e=%d)\n"),
+ _("process_easy() failed failed to launch process (e=%ld)\n"),
process_last_err(hPID));
for (i = 0; argv[i]; i++)
fprintf(stderr, "%s ", argv[i]);
@@ -1968,7 +1970,7 @@ exec_command (char **argv, char **envp)
{
int i;
fprintf(stderr,
- _("process_easy() failed failed to launch process (e=%d)\n"),
+ _("process_easy() failed failed to launch process (e=%ld)\n"),
process_last_err(hPID));
for (i = 0; argv[i]; i++)
fprintf(stderr, "%s ", argv[i]);
@@ -1998,8 +2000,8 @@ exec_command (char **argv, char **envp)
break;
else
fprintf(stderr,
- _("make reaped child pid %d, still waiting for pid %d\n"),
- hWaitPID, hPID);
+ _("make reaped child pid %ld, still waiting for pid %ld\n"),
+ (DWORD)hWaitPID, (DWORD)hPID);
}
/* return child's exit code as our exit code */
--- w32/pathstuff.c~0 2000-06-07 11:43:37.000000000 +0300
+++ w32/pathstuff.c 2005-07-30 16:57:16.442500000 +0300
@@ -88,7 +88,7 @@ getcwd_fs(char* buf, int len)
{
char *p;
- if (p = getcwd(buf, len)) {
+ if ((p = getcwd(buf, len))) {
char *q = w32ify(buf, 0);
strncpy(buf, q, len);
}
--- w32/subproc/sub_proc.c~0 2005-06-27 21:40:56.000000000 +0300
+++ w32/subproc/sub_proc.c 2005-07-30 17:04:24.520625000 +0300
@@ -1163,7 +1163,7 @@ process_easy(
TRUE,
DUPLICATE_SAME_ACCESS) == FALSE) {
fprintf(stderr,
- "process_easy: DuplicateHandle(In) failed (e=%d)\n",
+ "process_easy: DuplicateHandle(In) failed (e=%ld)\n",
GetLastError());
return INVALID_HANDLE_VALUE;
}
@@ -1175,7 +1175,7 @@ process_easy(
TRUE,
DUPLICATE_SAME_ACCESS) == FALSE) {
fprintf(stderr,
- "process_easy: DuplicateHandle(Out) failed (e=%d)\n",
+ "process_easy: DuplicateHandle(Out) failed (e=%ld)\n",
GetLastError());
return INVALID_HANDLE_VALUE;
}
@@ -1187,7 +1187,7 @@ process_easy(
TRUE,
DUPLICATE_SAME_ACCESS) == FALSE) {
fprintf(stderr,
- "process_easy: DuplicateHandle(Err) failed (e=%d)\n",
+ "process_easy: DuplicateHandle(Err) failed (e=%ld)\n",
GetLastError());
return INVALID_HANDLE_VALUE;
}