summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog15
-rw-r--r--ar.c6
-rw-r--r--arscan.c15
-rw-r--r--dir.c3
-rw-r--r--hash.c4
-rw-r--r--implicit.c2
-rw-r--r--job.c67
-rw-r--r--signame.c8
-rw-r--r--tests/scripts/features/parallelism22
9 files changed, 95 insertions, 47 deletions
diff --git a/ChangeLog b/ChangeLog
index 9f3c622..7b9711b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2010-07-05 Paul Smith <psmith@gnu.org>
+
+ * implicit.c (pattern_search): lastslash can be const.
+ * dir.c (downcase): Remove unused variable.
+ * hash.c (hash_init): Cast sizeof for error message.
+ * arscan.c (ar_scan): Cast to char* for WINDOWS32.
+ (ar_member_touch): Ditto.
+ * ar.c (glob_pattern_p): Avoid symbol collision: open -> opened
+ * signame.c (strsignal): Ditto: signal -> sig
+ * job.c (create_batch_file): Ditto: error -> error_string
+ (pid2str): Portably convert a pid_t into a string
+ (reap_children): Use it.
+ (start_waiting_job): Use it.
+ Savannah bug #27809. Patch by Ozkan Sezer <sezeroz@gmail.com>
+
2010-07-03 Paul Smith <psmith@gnu.org>
* read.c (parse_file_seq): All archive groups must end with ')' as
diff --git a/ar.c b/ar.c
index 4f29b68..66afd90 100644
--- a/ar.c
+++ b/ar.c
@@ -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 quote)
break;
case '[':
- open = 1;
+ opened = 1;
break;
case ']':
- if (open)
+ if (opened)
return 1;
break;
}
diff --git a/arscan.c b/arscan.c
index 771e394..7bdc15d 100644
--- a/arscan.c
+++ b/arscan.c
@@ -272,6 +272,7 @@ struct ar_hdr
char ar_fmag[2]; /* Always contains ARFMAG. */
};
# endif
+# define TOCHAR(_m) (_m)
#else
/* These should allow us to read Windows (VC++) libraries (according to Frank
* Libbrecht <frankl@abzx.belgium.hp.com>)
@@ -288,6 +289,8 @@ struct ar_hdr
# define ar_date Date
# define ar_uid UserID
# define ar_gid GroupID
+/* In Windows the member names have type BYTE so we must cast them. */
+# define TOCHAR(_m) ((char *)(_m))
#endif
/* Cray's <ar.h> apparently defines this. */
@@ -630,8 +633,8 @@ ar_scan (const char *archive, ar_member_func_t function, const void *arg)
}
#ifndef M_XENIX
- sscanf (member_header.ar_mode, "%o", &eltmode);
- eltsize = atol (member_header.ar_size);
+ sscanf (TOCHAR (member_header.ar_mode), "%o", &eltmode);
+ eltsize = atol (TOCHAR (member_header.ar_size));
#else /* Xenix. */
eltmode = (unsigned short int) member_header.ar_mode;
eltsize = member_header.ar_size;
@@ -641,9 +644,9 @@ ar_scan (const char *archive, ar_member_func_t function, const void *arg)
(*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 (TOCHAR (member_header.ar_date)),
+ atoi (TOCHAR (member_header.ar_uid)),
+ atoi (TOCHAR (member_header.ar_gid)),
#else /* Xenix. */
member_header.ar_date,
member_header.ar_uid,
@@ -812,7 +815,7 @@ ar_member_touch (const char *arname, const char *memname)
/* 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 (TOCHAR (ar_hdr.ar_date), "%ld", (long int) statbuf.st_mtime);
#ifdef AIAMAG
ar_hdr.ar_date[strlen(ar_hdr.ar_date)] = ' ';
#endif
diff --git a/dir.c b/dir.c
index 4224abb..7277fe6 100644
--- a/dir.c
+++ b/dir.c
@@ -123,14 +123,11 @@ downcase (const char *filename)
{
static PATH_VAR (new_filename);
char *df;
- int i;
if (filename == 0)
return 0;
df = new_filename;
-
- /* First, transform the name part. */
while (*filename != '\0')
{
*df++ = tolower ((unsigned char)*filename);
diff --git a/hash.c b/hash.c
index 7f9530d..a4df1f6 100644
--- a/hash.c
+++ b/hash.c
@@ -46,8 +46,8 @@ hash_init (struct hash_table *ht, unsigned long size,
ht->ht_vec = (void**) CALLOC (struct token *, ht->ht_size);
if (ht->ht_vec == 0)
{
- fprintf (stderr, _("can't allocate %ld bytes for hash table: memory exhausted"),
- ht->ht_size * sizeof(struct token *));
+ fprintf (stderr, _("can't allocate %lu bytes for hash table: memory exhausted"),
+ ht->ht_size * (unsigned long) sizeof (struct token *));
exit (1);
}
diff --git a/implicit.c b/implicit.c
index 6e67b71..081ccb6 100644
--- a/implicit.c
+++ b/implicit.c
@@ -211,7 +211,7 @@ pattern_search (struct file *file, int archive,
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 --git a/job.c b/job.c
index edbf569..03d8a83 100644
--- a/job.c
+++ b/job.c
@@ -186,6 +186,20 @@ int getgid ();
# endif
#endif
+/* Different systems have different requirements for pid_t.
+ Plus we have to support gettext string translation... Argh. */
+static const char *
+pid2str (pid_t pid)
+{
+ static char pidstring[100];
+#ifdef WINDOWS32
+ sprintf (pidstring, "%Id", pid);
+#else
+ sprintf (pidstring, "%lu", (unsigned long) pid);
+#endif
+ return pidstring;
+}
+
int getloadavg (double loadavg[], int nelem);
int start_remote_job (char **argv, char **envp, int stdin_fd, int *is_remote,
int *id_ptr, int *used_stdin);
@@ -246,7 +260,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 +306,7 @@ create_batch_file (char const *base, int unixy, int *fd)
else
{
- error = map_windows32_error_to_string (er);
+ error_string = map_windows32_error_to_string (er);
break;
}
}
@@ -315,9 +329,9 @@ create_batch_file (char const *base, int unixy, int *fd)
}
*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 +527,9 @@ reap_children (int block, int err)
{
any_remote |= c->remote;
any_local |= ! c->remote;
- 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)") : ""));
+ DB (DB_JOBS, (_("Live child %p (%s) PID %s %s\n"),
+ c, c->file->name, pid2str (c->pid),
+ c->remote ? _(" (remote)") : ""));
#ifdef VMS
break;
#endif
@@ -636,8 +650,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 */
@@ -693,10 +706,9 @@ reap_children (int block, int err)
continue;
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)") : ""));
+ ? _("Reaping losing child %p PID %s %s\n")
+ : _("Reaping winning child %p PID %s %s\n"),
+ c, pid2str (c->pid), c->remote ? _(" (remote)") : ""));
if (c->sh_batch_file) {
DB (DB_JOBS, (_("Cleaning up temp batch file %s\n"),
@@ -797,9 +809,8 @@ reap_children (int block, int err)
update_status to its also_make files. */
notice_finished_file (c->file);
- DB (DB_JOBS, (_("Removing child 0x%08lx PID %ld%s from chain.\n"),
- (unsigned long int) c, (long) c->pid,
- c->remote ? _(" (remote)") : ""));
+ DB (DB_JOBS, (_("Removing child %p PID %s%s from chain.\n"),
+ c, pid2str (c->pid), c->remote ? _(" (remote)") : ""));
/* Block fatal signals while frobnicating the list, so that
children and job_slots_used are always consistent. Otherwise
@@ -842,8 +853,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 +870,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 +1470,9 @@ start_waiting_job (struct child *c)
{
case cs_running:
c->next = children;
- 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)") : ""));
+ DB (DB_JOBS, (_("Putting child %p (%s) PID %s%s on the chain.\n"),
+ c, c->file->name, pid2str (c->pid),
+ c->remote ? _(" (remote)") : ""));
children = c;
/* One more job slot is in use. */
++job_slots_used;
@@ -1712,8 +1723,8 @@ new_job (struct file *file)
/* If we got one, we're done here. */
if (got_token == 1)
{
- DB (DB_JOBS, (_("Obtained token for child 0x%08lx (%s).\n"),
- (unsigned long int) c, c->file->name));
+ DB (DB_JOBS, (_("Obtained token for child %p (%s).\n"),
+ c, c->file->name));
break;
}
@@ -2058,8 +2069,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 --git a/signame.c b/signame.c
index 1360b43..bdae74b 100644
--- a/signame.c
+++ b/signame.c
@@ -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;
}
diff --git a/tests/scripts/features/parallelism b/tests/scripts/features/parallelism
index 8bf24a4..cc0f84f 100644
--- a/tests/scripts/features/parallelism
+++ b/tests/scripts/features/parallelism
@@ -194,6 +194,28 @@ rm main.x");
rmfiles(qw(foo.y foo.y.in main.bar));
}
+if ($all_tests) {
+ # Jobserver FD handling is messed up in some way.
+ # Savannah bug #28189
+ # It doesn't look like that bug anymore but this is the code it runs
+
+ run_make_test(q!
+ifdef EXTRA
+vpath %.dst /
+xxx.dst: ; true
+yyy.dst: ; true
+endif
+
+M := $(MAKE)
+xx: ; $M --no-print-directory -j2 -f $(MAKEFILE_LIST) xxx.dst yyy.dst EXTRA=1
+!,
+ '-j2',
+ '#MAKE#[1]: warning: -jN forced in submake: disabling jobserver mode.
+true
+true
+');
+}
+
# Make sure that all jobserver FDs are closed if we need to re-exec the
# master copy.
#