Update source file format: remove TABs, use GNU coding styles.

This commit is contained in:
Paul Smith
2013-05-17 02:29:46 -04:00
parent 5370238316
commit 96cf67bd29
36 changed files with 3236 additions and 3192 deletions

View File

@@ -1,5 +1,7 @@
2013-05-17 Paul Smith <psmith@gnu.org>
* Source (*.[ch]): Remove TABs, use GNU coding styles.
* ALL: Update copyright.
* hash.c (CALLOC): Use xcalloc() to handle out of memory errors.

View File

@@ -56,6 +56,17 @@ constructing multiple commits from various files and even from different
diff chunks in the same file. There is a video available which helps a lot.
Coding Standards
----------------
GNU make code adheres to the GNU Coding Standards. Additionally, GNU make is
a foundational bootstrap package for the GNU project; as such it is very
conservative about language features it expects. It should build with any C
compiler conforming to the ANSI C89 / ISO C90 standard.
Please use only spaces and no TAB characters in source code.
Building From Git
-----------------

View File

@@ -77,7 +77,7 @@ MyExecute (char **argv)
FreeMem (buffer, len);
if (SetSignal(0L,0L) & SIGBREAKF_CTRL_C)
if (SetSignal (0L,0L) & SIGBREAKF_CTRL_C)
status = 20;
/* Warnings don't count */

2
ar.c
View File

@@ -61,7 +61,7 @@ ar_parse_name (const char *name, char **arname_p, char **memname_p)
*arname_p = xstrdup (name);
p = strchr (*arname_p, '(');
*(p++) = '\0';
p[strlen(p) - 1] = '\0';
p[strlen (p) - 1] = '\0';
*memname_p = p;
}

View File

@@ -397,7 +397,7 @@ ar_scan (const char *archive, ar_member_func_t function, const void *arg)
#else
unsigned short int buf;
#endif
register int nread = read(desc, &buf, sizeof (buf));
register int nread = read (desc, &buf, sizeof (buf));
if (nread != sizeof (buf) || buf != ARMAG)
{
(void) close (desc);
@@ -746,9 +746,9 @@ ar_name_equal (const char *name, const char *mem, int truncated)
#else
struct ar_hdr hdr;
#if !defined (__hpux) && !defined (cray)
return strneq (name, mem, sizeof(hdr.ar_name) - 1);
return strneq (name, mem, sizeof (hdr.ar_name) - 1);
#else
return strneq (name, mem, sizeof(hdr.ar_name) - 2);
return strneq (name, mem, sizeof (hdr.ar_name) - 2);
#endif /* !__hpux && !cray */
#endif /* !AIAMAG */
}
@@ -815,7 +815,7 @@ ar_member_touch (const char *arname, const char *memname)
ar_hdr.ar_date[ui] = ' ';
sprintf (TOCHAR (ar_hdr.ar_date), "%ld", (long int) statbuf.st_mtime);
#ifdef AIAMAG
ar_hdr.ar_date[strlen(ar_hdr.ar_date)] = ' ';
ar_hdr.ar_date[strlen (ar_hdr.ar_date)] = ' ';
#endif
#else
ar_hdr.ar_date = statbuf.st_mtime;

View File

@@ -547,7 +547,7 @@ set_default_suffixes (void)
{
struct dep *d;
char *p = default_suffixes;
suffix_file->deps = enter_prereqs(PARSE_FILE_SEQ (&p, struct dep, '\0',
suffix_file->deps = enter_prereqs (PARSE_FILE_SEQ (&p, struct dep, '\0',
NULL, 0),
NULL);
for (d = suffix_file->deps; d; d = d->next)

27
dir.c
View File

@@ -446,7 +446,7 @@ find_directory (const char *name)
p = name + strlen (name);
dir = xmalloc (sizeof (struct directory));
#if defined(HAVE_CASE_INSENSITIVE_FS) && defined(VMS)
dir->name = strcache_add_len (downcase(name), p - name);
dir->name = strcache_add_len (downcase (name), p - name);
#else
dir->name = strcache_add_len (name, p - name);
#endif
@@ -527,14 +527,13 @@ find_directory (const char *name)
* a directory.
*/
w32_path[3] = '\0';
if (GetVolumeInformation(w32_path,
fs_label, sizeof (fs_label),
&fs_serno, &fs_len,
&fs_flags, fs_type, sizeof (fs_type)) == FALSE)
if (GetVolumeInformation (w32_path, fs_label, sizeof (fs_label),
&fs_serno, &fs_len, &fs_flags, fs_type,
sizeof (fs_type)) == FALSE)
dc->fs_flags = FS_UNKNOWN;
else if (!strcmp(fs_type, "FAT"))
else if (!strcmp (fs_type, "FAT"))
dc->fs_flags = FS_FAT;
else if (!strcmp(fs_type, "NTFS"))
else if (!strcmp (fs_type, "NTFS"))
dc->fs_flags = FS_NTFS;
else
dc->fs_flags = FS_UNKNOWN;
@@ -705,7 +704,7 @@ dir_contents_file_exists_p (struct directory_contents *dir,
{
df = xmalloc (sizeof (struct dirfile));
#if defined(HAVE_CASE_INSENSITIVE_FS) && defined(VMS)
df->name = strcache_add_len (downcase(d->d_name), len);
df->name = strcache_add_len (downcase (d->d_name), len);
#else
df->name = strcache_add_len (d->d_name, len);
#endif
@@ -765,7 +764,7 @@ file_exists_p (const char *name)
#ifdef HAVE_DOS_PATHS
/* Forward and backslashes might be mixed. We need the rightmost one. */
{
const char *bslash = strrchr(name, '\\');
const char *bslash = strrchr (name, '\\');
if (!dirend || bslash > dirend)
dirend = bslash;
/* The case of "d:file". */
@@ -825,7 +824,7 @@ file_impossible (const char *filename)
# ifdef HAVE_DOS_PATHS
/* Forward and backslashes might be mixed. We need the rightmost one. */
{
const char *bslash = strrchr(p, '\\');
const char *bslash = strrchr (p, '\\');
if (!dirend || bslash > dirend)
dirend = bslash;
/* The case of "d:file". */
@@ -880,7 +879,7 @@ file_impossible (const char *filename)
new = xmalloc (sizeof (struct dirfile));
new->length = strlen (filename);
#if defined(HAVE_CASE_INSENSITIVE_FS) && defined(VMS)
new->name = strcache_add_len (downcase(filename), new->length);
new->name = strcache_add_len (downcase (filename), new->length);
#else
new->name = strcache_add_len (filename, new->length);
#endif
@@ -908,7 +907,7 @@ file_impossible_p (const char *filename)
#ifdef HAVE_DOS_PATHS
/* Forward and backslashes might be mixed. We need the rightmost one. */
{
const char *bslash = strrchr(filename, '\\');
const char *bslash = strrchr (filename, '\\');
if (!dirend || bslash > dirend)
dirend = bslash;
/* The case of "d:file". */
@@ -1157,7 +1156,7 @@ read_dirstream (__ptr_t stream)
#ifdef __MINGW32__
# if __MINGW32_MAJOR_VERSION < 3 || (__MINGW32_MAJOR_VERSION == 3 && \
__MINGW32_MINOR_VERSION == 0)
d->d_name = xmalloc(len);
d->d_name = xmalloc (len);
# endif
#endif
FAKE_DIR_ENTRY (d);
@@ -1179,7 +1178,7 @@ static void
ansi_free (void *p)
{
if (p)
free(p);
free (p);
}
/* On 64 bit ReliantUNIX (5.44 and above) in LFS mode, stat() is actually a

View File

@@ -200,7 +200,7 @@ variable_expand_string (char *line, const char *string, long length)
unsigned int line_offset;
if (!line)
line = initialize_variable_output();
line = initialize_variable_output ();
o = line;
line_offset = line - variable_buffer;
@@ -418,7 +418,7 @@ variable_expand_string (char *line, const char *string, long length)
char *
variable_expand (const char *line)
{
return variable_expand_string(NULL, line, (long)-1);
return variable_expand_string (NULL, line, (long)-1);
}
/* Expand an argument for an expansion function.
@@ -434,7 +434,7 @@ expand_argument (const char *str, const char *end)
char *r;
if (str == end)
return xstrdup("");
return xstrdup ("");
if (!end || *end == '\0')
return allocated_variable_expand (str);

View File

@@ -1097,7 +1097,8 @@ func_error (char *o, char **argv, const char *funcname)
}
strcpy (p, *argvp);
switch (*funcname) {
switch (*funcname)
{
case 'e':
fatal (reading_file, "%s", msg);
@@ -1107,7 +1108,7 @@ func_error (char *o, char **argv, const char *funcname)
case 'i':
printf ("%s\n", msg);
fflush(stdout);
fflush (stdout);
break;
default:
@@ -1381,7 +1382,7 @@ func_value (char *o, char **argv, const char *funcname UNUSED)
/* Copy its value into the output buffer without expanding it. */
if (v)
o = variable_buffer_output (o, v->value, strlen(v->value));
o = variable_buffer_output (o, v->value, strlen (v->value));
return o;
}
@@ -1454,105 +1455,102 @@ windows32_openpipe (int *pipedes, pid_t *pid_p, char **command_argv, char **envp
INVALID_HANDLE_VALUE if the parent process closed them. If that
happens, we open the null device and pass its handle to
process_begin below as the corresponding handle to inherit. */
tmpIn = GetStdHandle(STD_INPUT_HANDLE);
if (DuplicateHandle (GetCurrentProcess(),
tmpIn,
GetCurrentProcess(),
&hIn,
0,
TRUE,
DUPLICATE_SAME_ACCESS) == FALSE) {
if ((e = GetLastError()) == ERROR_INVALID_HANDLE) {
tmpIn = CreateFile("NUL", GENERIC_READ,
tmpIn = GetStdHandle (STD_INPUT_HANDLE);
if (DuplicateHandle (GetCurrentProcess (), tmpIn,
GetCurrentProcess (), &hIn,
0, TRUE, DUPLICATE_SAME_ACCESS) == FALSE)
{
e = GetLastError ();
if (e == ERROR_INVALID_HANDLE)
{
tmpIn = CreateFile ("NUL", GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (tmpIn != INVALID_HANDLE_VALUE
&& DuplicateHandle(GetCurrentProcess(),
tmpIn,
GetCurrentProcess(),
&hIn,
0,
TRUE,
DUPLICATE_SAME_ACCESS) == FALSE)
CloseHandle(tmpIn);
&& DuplicateHandle (GetCurrentProcess (), tmpIn,
GetCurrentProcess (), &hIn,
0, TRUE, DUPLICATE_SAME_ACCESS) == FALSE)
CloseHandle (tmpIn);
}
if (hIn == INVALID_HANDLE_VALUE) {
if (hIn == INVALID_HANDLE_VALUE)
{
error (NILF, _("windows32_openpipe: DuplicateHandle(In) failed (e=%ld)\n"), e);
return -1;
}
}
tmpErr = GetStdHandle(STD_ERROR_HANDLE);
if (DuplicateHandle(GetCurrentProcess(),
tmpErr,
GetCurrentProcess(),
&hErr,
0,
TRUE,
DUPLICATE_SAME_ACCESS) == FALSE) {
if ((e = GetLastError()) == ERROR_INVALID_HANDLE) {
tmpErr = CreateFile("NUL", GENERIC_WRITE,
tmpErr = GetStdHandle (STD_ERROR_HANDLE);
if (DuplicateHandle (GetCurrentProcess (), tmpErr,
GetCurrentProcess (), &hErr,
0, TRUE, DUPLICATE_SAME_ACCESS) == FALSE)
{
e = GetLastError ();
if (e == ERROR_INVALID_HANDLE)
{
tmpErr = CreateFile ("NUL", GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (tmpErr != INVALID_HANDLE_VALUE
&& DuplicateHandle(GetCurrentProcess(),
tmpErr,
GetCurrentProcess(),
&hErr,
0,
TRUE,
DUPLICATE_SAME_ACCESS) == FALSE)
CloseHandle(tmpErr);
&& DuplicateHandle (GetCurrentProcess (), tmpErr,
GetCurrentProcess (), &hErr,
0, TRUE, DUPLICATE_SAME_ACCESS) == FALSE)
CloseHandle (tmpErr);
}
if (hErr == INVALID_HANDLE_VALUE) {
if (hErr == INVALID_HANDLE_VALUE)
{
error (NILF, _("windows32_openpipe: DuplicateHandle(Err) failed (e=%ld)\n"), e);
return -1;
}
}
if (!CreatePipe(&hChildOutRd, &hChildOutWr, &saAttr, 0)) {
if (! CreatePipe (&hChildOutRd, &hChildOutWr, &saAttr, 0))
{
error (NILF, _("CreatePipe() failed (e=%ld)\n"), GetLastError());
return -1;
}
hProcess = process_init_fd(hIn, hChildOutWr, hErr);
hProcess = process_init_fd (hIn, hChildOutWr, hErr);
if (!hProcess) {
if (!hProcess)
{
error (NILF, _("windows32_openpipe(): process_init_fd() failed\n"));
return -1;
}
/* make sure that CreateProcess() has Path it needs */
sync_Path_environment();
sync_Path_environment ();
/* 'sync_Path_environment' may realloc 'environ', so take note of
the new value. */
envp = environ;
if (!process_begin(hProcess, command_argv, envp, command_argv[0], NULL)) {
if (! process_begin (hProcess, command_argv, envp, command_argv[0], NULL))
{
/* register process for wait */
process_register(hProcess);
process_register (hProcess);
/* set the pid for returning to caller */
*pid_p = (pid_t) hProcess;
/* set up to read data from child */
pipedes[0] = _open_osfhandle((intptr_t) hChildOutRd, O_RDONLY);
pipedes[0] = _open_osfhandle ((intptr_t) hChildOutRd, O_RDONLY);
/* this will be closed almost right away */
pipedes[1] = _open_osfhandle((intptr_t) hChildOutWr, O_APPEND);
pipedes[1] = _open_osfhandle ((intptr_t) hChildOutWr, O_APPEND);
return 0;
} else {
}
else
{
/* reap/cleanup the failed process */
process_cleanup(hProcess);
process_cleanup (hProcess);
/* close handles which were duplicated, they weren't used */
if (hIn != INVALID_HANDLE_VALUE)
CloseHandle(hIn);
CloseHandle (hIn);
if (hErr != INVALID_HANDLE_VALUE)
CloseHandle(hErr);
CloseHandle (hErr);
/* close pipe handles, they won't be used */
CloseHandle(hChildOutRd);
CloseHandle(hChildOutWr);
CloseHandle (hChildOutRd);
CloseHandle (hChildOutWr);
return -1;
}
@@ -1792,7 +1790,8 @@ func_shell_base (char *o, char **argv, int trim_newlines)
while (shell_function_completed == 0)
reap_children (1, 0);
if (batch_filename) {
if (batch_filename)
{
DB (DB_VERBOSE, (_("Cleaning up temporary batch file %s\n"),
batch_filename));
remove (batch_filename);
@@ -2149,7 +2148,7 @@ func_file (char *o, char **argv, const char *funcname UNUSED)
int l = strlen (argv[1]);
int nl = (l == 0 || argv[1][l-1] != '\n');
if (fputs (argv[1], fp) == EOF || (nl && fputc('\n', fp) == EOF))
if (fputs (argv[1], fp) == EOF || (nl && fputc ('\n', fp) == EOF))
fatal (reading_file, _("write: %s: %s"), fn, strerror (errno));
fclose (fp);
@@ -2525,7 +2524,7 @@ func_call (char *o, char **argv, const char *funcname UNUSED)
}
void
define_new_function(const gmk_floc *flocp,
define_new_function (const gmk_floc *flocp,
const char *name, int min, int max, int expand,
char *(*func)(const char *, int, char **))
{

169
job.c
View File

@@ -261,9 +261,9 @@ static int combined_output = 0;
* The macro which references this function is defined in makeint.h.
*/
int
w32_kill(pid_t pid, int sig)
w32_kill (pid_t pid, int sig)
{
return ((process_kill((HANDLE)pid, sig) == TRUE) ? 0 : -1);
return ((process_kill ((HANDLE)pid, sig) == TRUE) ? 0 : -1);
}
/* This function creates a temporary file name with an extension specified
@@ -276,7 +276,7 @@ create_batch_file (char const *base, int unixy, int *fd)
const char *const ext = unixy ? "sh" : "bat";
const char *error_string = NULL;
char temp_path[MAXPATHLEN]; /* need to know its length */
unsigned path_size = GetTempPath(sizeof temp_path, temp_path);
unsigned path_size = GetTempPath (sizeof temp_path, temp_path);
int path_is_dot = 0;
/* The following variable is static so we won't try to reuse a name
that was generated a little while ago, because that file might
@@ -325,7 +325,7 @@ create_batch_file (char const *base, int unixy, int *fd)
if (h == INVALID_HANDLE_VALUE)
{
const DWORD er = GetLastError();
const DWORD er = GetLastError ();
if (er == ERROR_FILE_EXISTS || er == ERROR_ALREADY_EXISTS)
{
@@ -411,7 +411,8 @@ _is_unixy_shell (const char *path)
if (*name == '/' || *name == '\\') name++;
i = 0;
while (known_os2shells[i] != NULL) {
while (known_os2shells[i] != NULL)
{
if (strcasecmp (name, known_os2shells[i]) == 0)
return 0; /* not a unix shell */
i++;
@@ -453,14 +454,15 @@ is_bourne_compatible_shell (const char *path)
if (*name == '/' || *name == '\\') name++;
/* this should be able to deal with extensions on Windows-like systems */
for (i = 0; unix_shells[i] != NULL; i++) {
len = strlen(unix_shells[i]);
for (i = 0; unix_shells[i] != NULL; i++)
{
len = strlen (unix_shells[i]);
#if defined(WINDOWS32) || defined(__MSDOS__)
if ((strncasecmp (name, unix_shells[i], len) == 0) &&
(strlen(name) >= len && (name[len] == '\0' || name[len] == '.')))
(strlen (name) >= len && (name[len] == '\0' || name[len] == '.')))
#else
if ((strncmp (name, unix_shells[i], len) == 0) &&
(strlen(name) >= len && name[len] == '\0'))
(strlen (name) >= len && name[len] == '\0'))
#endif
return 1; /* a known unix-style shell */
}
@@ -700,7 +702,7 @@ pump_from_tmp (int from, FILE *to)
/* from_fd is opened by open_tmpfd, which does it in binary mode, so
we need the mode of to_fd to match that. */
prev_mode = _setmode (fileno(to), _O_BINARY);
prev_mode = _setmode (fileno (to), _O_BINARY);
#endif
if (lseek (from, 0, SEEK_SET) == -1)
@@ -791,14 +793,14 @@ sync_output (struct child *c)
if (c->outfd >= 0)
{
int e;
lseek(c->outfd, 0, SEEK_SET);
EINTRLOOP (e, ftruncate(c->outfd, 0));
lseek (c->outfd, 0, SEEK_SET);
EINTRLOOP (e, ftruncate (c->outfd, 0));
}
if (c->errfd >= 0 && c->errfd != c->outfd)
{
int e;
lseek(c->errfd, 0, SEEK_SET);
EINTRLOOP (e, ftruncate(c->errfd, 0));
lseek (c->errfd, 0, SEEK_SET);
EINTRLOOP (e, ftruncate (c->errfd, 0));
}
}
}
@@ -1006,32 +1008,32 @@ reap_children (int block, int err)
DWORD e = GetLastError ();
fprintf (stderr,
"Determine main thread ID (Error %ld: %s)\n",
e, map_windows32_error_to_string(e));
e, map_windows32_error_to_string (e));
}
else
DB (DB_VERBOSE, ("Main thread handle = %p\n", main_thread));
}
/* wait for anything to finish */
hPID = process_wait_for_any(block, &dwWaitStatus);
hPID = process_wait_for_any (block, &dwWaitStatus);
if (hPID)
{
/* was an error found on this process? */
werr = process_last_err(hPID);
werr = process_last_err (hPID);
/* get exit data */
exit_code = process_exit_code(hPID);
exit_code = process_exit_code (hPID);
if (werr)
fprintf(stderr, "make (e=%d): %s",
exit_code, map_windows32_error_to_string(exit_code));
fprintf (stderr, "make (e=%d): %s", exit_code,
map_windows32_error_to_string (exit_code));
/* signal */
exit_sig = process_signal(hPID);
exit_sig = process_signal (hPID);
/* cleanup process */
process_cleanup(hPID);
process_cleanup (hPID);
coredump = 0;
}
@@ -1081,7 +1083,8 @@ reap_children (int block, int err)
: _("Reaping winning child %p PID %s %s\n"),
c, pid2str (c->pid), c->remote ? _(" (remote)") : ""));
if (c->sh_batch_file) {
if (c->sh_batch_file)
{
int rm_status;
DB (DB_JOBS, (_("Cleaning up temp batch file %s\n"),
@@ -1252,13 +1255,13 @@ free_child (struct child *child)
job, put a token back into the pipe for it. */
#ifdef WINDOWS32
if (has_jobserver_semaphore() && jobserver_tokens > 1)
if (has_jobserver_semaphore () && jobserver_tokens > 1)
{
if (! release_jobserver_semaphore())
if (! release_jobserver_semaphore ())
{
DWORD err = GetLastError();
DWORD err = GetLastError ();
fatal (NILF, _("release jobserver semaphore: (Error %ld: %s)"),
err, map_windows32_error_to_string(err));
err, map_windows32_error_to_string (err));
}
DB (DB_JOBS, (_("Released token for child %p (%s).\n"), child, child->file->name));
@@ -1517,7 +1520,7 @@ start_job_command (struct child *child)
#ifdef OUTPUT_SYNC
if (output_sync && sync_handle == -1)
sync_init();
sync_init ();
#endif
/* Are we going to synchronize this command's output? Do so if either we're
@@ -1567,7 +1570,7 @@ start_job_command (struct child *child)
#if defined __MSDOS__ || defined (__EMX__)
unixy_shell /* the test is complicated and we already did it */
#else
(argv[0] && is_bourne_compatible_shell(argv[0]))
(argv[0] && is_bourne_compatible_shell (argv[0]))
#endif
&& (argv[1] && argv[1][0] == '-'
&&
@@ -1680,7 +1683,8 @@ start_job_command (struct child *child)
child->remote = 0;
#ifdef VMS
if (!child_execute_job (argv, child)) {
if (!child_execute_job (argv, child))
{
/* Fork failed! */
perror_with_name ("fork", "");
goto error;
@@ -1857,29 +1861,30 @@ start_job_command (struct child *child)
*arg0 = '\\';
/* make sure CreateProcess() has Path it needs */
sync_Path_environment();
sync_Path_environment ();
#ifdef OUTPUT_SYNC
/* Divert child output if output_sync in use. Don't capture
recursive make output unless we are synchronizing "make" mode. */
if (output_sync && sync_cmd)
hPID = process_easy(argv, child->environment,
hPID = process_easy (argv, child->environment,
child->outfd, child->errfd);
else
#endif
hPID = process_easy(argv, child->environment, -1, -1);
hPID = process_easy (argv, child->environment, -1, -1);
if (hPID != INVALID_HANDLE_VALUE)
child->pid = (pid_t) hPID;
else {
else
{
int i;
unblock_sigs();
fprintf(stderr,
unblock_sigs ();
fprintf (stderr,
_("process_easy() failed to launch process (e=%ld)\n"),
process_last_err(hPID));
process_last_err (hPID));
for (i = 0; argv[i]; i++)
fprintf(stderr, "%s ", argv[i]);
fprintf(stderr, _("\nCounted %d args in failed launch\n"), i);
fprintf (stderr, "%s ", argv[i]);
fprintf (stderr, _("\nCounted %d args in failed launch\n"), i);
goto error;
}
}
@@ -2133,7 +2138,7 @@ new_job (struct file *file)
this is where the old parallel job code waits, so... */
#ifdef WINDOWS32
else if (has_jobserver_semaphore())
else if (has_jobserver_semaphore ())
#else
else if (job_fds[0] >= 0)
#endif
@@ -2204,12 +2209,12 @@ new_job (struct file *file)
/* On Windows we simply wait for the jobserver semaphore to become
* signalled or one of our child processes to terminate.
*/
got_token = wait_for_semaphore_or_child_process();
got_token = wait_for_semaphore_or_child_process ();
if (got_token < 0)
{
DWORD err = GetLastError();
DWORD err = GetLastError ();
fatal (NILF, _("semaphore or child process wait: (Error %ld: %s)"),
err, map_windows32_error_to_string(err));
err, map_windows32_error_to_string (err));
}
#else
/* Set interruptible system calls, and read() for a job token. */
@@ -2547,40 +2552,39 @@ exec_command (char **argv, char **envp)
int exit_code = EXIT_FAILURE;
/* make sure CreateProcess() has Path it needs */
sync_Path_environment();
sync_Path_environment ();
/* launch command */
hPID = process_easy(argv, envp, -1, -1);
hPID = process_easy (argv, envp, -1, -1);
/* make sure launch ok */
if (hPID == INVALID_HANDLE_VALUE)
{
int i;
fprintf(stderr,
_("process_easy() failed to launch process (e=%ld)\n"),
process_last_err(hPID));
fprintf (stderr, _("process_easy() failed to launch process (e=%ld)\n"),
process_last_err (hPID));
for (i = 0; argv[i]; i++)
fprintf(stderr, "%s ", argv[i]);
fprintf(stderr, _("\nCounted %d args in failed launch\n"), i);
exit(EXIT_FAILURE);
fprintf (stderr, "%s ", argv[i]);
fprintf (stderr, _("\nCounted %d args in failed launch\n"), i);
exit (EXIT_FAILURE);
}
/* wait and reap last child */
hWaitPID = process_wait_for_any(1, 0);
hWaitPID = process_wait_for_any (1, 0);
while (hWaitPID)
{
/* was an error found on this process? */
err = process_last_err(hWaitPID);
err = process_last_err (hWaitPID);
/* get exit data */
exit_code = process_exit_code(hWaitPID);
exit_code = process_exit_code (hWaitPID);
if (err)
fprintf(stderr, "make (e=%d, rc=%d): %s",
err, exit_code, map_windows32_error_to_string(err));
fprintf (stderr, "make (e=%d, rc=%d): %s",
err, exit_code, map_windows32_error_to_string (err));
/* cleanup process */
process_cleanup(hWaitPID);
process_cleanup (hWaitPID);
/* expect to find only last pid, warn about other pids reaped */
if (hWaitPID == hPID)
@@ -2589,7 +2593,7 @@ exec_command (char **argv, char **envp)
{
char *pidstr = xstrdup (pid2str ((pid_t)hWaitPID));
fprintf(stderr,
fprintf (stderr,
_("make reaped child pid %s, still waiting for pid %s\n"),
pidstr, pid2str ((pid_t)hPID));
free (pidstr);
@@ -2597,7 +2601,7 @@ exec_command (char **argv, char **envp)
}
/* return child's exit code as our exit code */
exit(exit_code);
exit (exit_code);
#else /* !WINDOWS32 */
@@ -2889,10 +2893,13 @@ construct_command_argv_internal (char *line, char **restp, char *shell,
#ifdef WINDOWS32
int slow_flag = 0;
if (!unixy_shell) {
if (!unixy_shell)
{
sh_cmds = sh_cmds_dos;
sh_chars = sh_chars_dos;
} else {
}
else
{
sh_cmds = sh_cmds_sh;
sh_chars = sh_chars_sh;
}
@@ -3308,7 +3315,7 @@ construct_command_argv_internal (char *line, char **restp, char *shell,
#if defined __MSDOS__ || defined (__EMX__)
if (unixy_shell) /* the test is complicated and we already did it */
#else
if (is_bourne_compatible_shell(shell)
if (is_bourne_compatible_shell (shell)
#ifdef WINDOWS32
/* If we didn't find any sh.exe, don't behave is if we did! */
&& !no_default_sh_exe
@@ -3357,11 +3364,11 @@ construct_command_argv_internal (char *line, char **restp, char *shell,
char *tstart = t;
int temp_fd;
FILE* batch = NULL;
int id = GetCurrentProcessId();
int id = GetCurrentProcessId ();
PATH_VAR(fbuf);
/* Generate a file name for the temporary batch file. */
sprintf(fbuf, "make%d", id);
sprintf (fbuf, "make%d", id);
*batch_filename = create_batch_file (fbuf, 0, &temp_fd);
DB (DB_JOBS, (_("Creating temporary batch file %s\n"),
*batch_filename));
@@ -3527,20 +3534,23 @@ construct_command_argv_internal (char *line, char **restp, char *shell,
/* Some shells do not work well when invoked as 'sh -c xxx' to run a
command line (e.g. Cygnus GNUWIN32 sh.exe on WIN32 systems). In these
cases, run commands via a script file. */
if (just_print_flag && !(flags & COMMANDS_RECURSE)) {
if (just_print_flag && !(flags & COMMANDS_RECURSE))
{
/* Need to allocate new_argv, although it's unused, because
start_job_command will want to free it and its 0'th element. */
new_argv = xmalloc(2 * sizeof (char *));
new_argv = xmalloc (2 * sizeof (char *));
new_argv[0] = xstrdup ("");
new_argv[1] = NULL;
} else if ((no_default_sh_exe || batch_mode_shell) && batch_filename) {
}
else if ((no_default_sh_exe || batch_mode_shell) && batch_filename)
{
int temp_fd;
FILE* batch = NULL;
int id = GetCurrentProcessId();
PATH_VAR(fbuf);
int id = GetCurrentProcessId ();
PATH_VAR (fbuf);
/* create a file name */
sprintf(fbuf, "make%d", id);
sprintf (fbuf, "make%d", id);
*batch_filename = create_batch_file (fbuf, unixy_shell, &temp_fd);
DB (DB_JOBS, (_("Creating temporary batch file %s\n"),
@@ -3559,16 +3569,20 @@ construct_command_argv_internal (char *line, char **restp, char *shell,
!unixy_shell ? "\n\t@echo off" : "", command_ptr));
/* create argv */
new_argv = xmalloc(3 * sizeof (char *));
if (unixy_shell) {
new_argv = xmalloc (3 * sizeof (char *));
if (unixy_shell)
{
new_argv[0] = xstrdup (shell);
new_argv[1] = *batch_filename; /* only argv[0] gets freed later */
} else {
}
else
{
new_argv[0] = xstrdup (*batch_filename);
new_argv[1] = NULL;
}
new_argv[2] = NULL;
} else
}
else
#endif /* WINDOWS32 */
if (unixy_shell)
@@ -3704,7 +3718,7 @@ construct_command_argv (char *line, char **restp, struct file *file,
if (*cptr == 0)
break;
while ((*cptr != 0)
&& (!isspace((unsigned char)*cptr)))
&& (!isspace ((unsigned char)*cptr)))
cptr++;
argc++;
}
@@ -3725,7 +3739,7 @@ construct_command_argv (char *line, char **restp, struct file *file,
DB (DB_JOBS, ("argv[%d] = [%s]\n", argc, cptr));
argv[argc++] = cptr;
while ((*cptr != 0)
&& (!isspace((unsigned char)*cptr)))
&& (!isspace ((unsigned char)*cptr)))
cptr++;
if (*cptr != 0)
*cptr++ = 0;
@@ -3742,7 +3756,8 @@ construct_command_argv (char *line, char **restp, struct file *file,
* Convert to forward slashes so that construct_command_argv_internal()
* is not confused.
*/
if (shell) {
if (shell)
{
char *p = w32ify (shell, 0);
strcpy (shell, p);
}

5
job.h
View File

@@ -49,13 +49,14 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
# define F_WRLCK 1
# define F_UNLCK 2
struct flock {
struct flock
{
short l_type;
short l_whence;
off_t l_start;
off_t l_len;
pid_t l_pid;
};
};
/* This type is actually a HANDLE, but we want to avoid including
windows.h as much as possible. */

19
load.c
View File

@@ -50,11 +50,12 @@ load_object (const gmk_floc *flocp, int noerror,
{
global_dl = dlopen (NULL, RTLD_NOW|RTLD_GLOBAL);
if (! global_dl)
fatal (flocp, _("Failed to open global symbol table: %s"), dlerror());
fatal (flocp, _("Failed to open global symbol table: %s"), dlerror ());
}
symp = (load_func_t) dlsym (global_dl, symname);
if (! symp) {
if (! symp)
{
struct load_list *new;
void *dlp = NULL;
@@ -74,9 +75,9 @@ load_object (const gmk_floc *flocp, int noerror,
if (! dlp)
{
if (noerror)
DB (DB_BASIC, ("%s", dlerror()));
DB (DB_BASIC, ("%s", dlerror ()));
else
error (flocp, "%s", dlerror());
error (flocp, "%s", dlerror ());
return NULL;
}
@@ -89,11 +90,11 @@ load_object (const gmk_floc *flocp, int noerror,
symp = dlsym (dlp, symname);
if (! symp)
fatal (flocp, _("Failed to load symbol %s from %s: %s"),
symname, ldname, dlerror());
symname, ldname, dlerror ());
/* Add this symbol to a trivial lookup table. This is not efficient but
it's highly unlikely we'll be loading lots of objects, and we only need
it to look them up on unload, if we rebuild them. */
it's highly unlikely we'll be loading lots of objects, and we only
need it to look them up on unload, if we rebuild them. */
new = xmalloc (sizeof (struct load_list));
new->name = xstrdup (ldname);
new->dlp = dlp;
@@ -150,7 +151,7 @@ load_file (const gmk_floc *flocp, const char **ldname, int noerror)
*ldname = strcache_add (*ldname);
/* If this object has been loaded, we're done. */
loaded = allocated_variable_expand("$(.LOADED)");
loaded = allocated_variable_expand ("$(.LOADED)");
fp = strstr (loaded, *ldname);
r = fp && (fp==loaded || fp[-1]==' ') && (fp[nmlen]=='\0' || fp[nmlen]==' ');
free (loaded);
@@ -190,7 +191,7 @@ load_file (const gmk_floc *flocp, const char **ldname, int noerror)
DB (DB_VERBOSE, (_("Loading symbol %s from %s\n"), symname, *ldname));
/* Load it! */
symp = load_object(flocp, noerror, *ldname, symname);
symp = load_object (flocp, noerror, *ldname, symname);
if (! symp)
return 0;

124
main.c
View File

@@ -785,11 +785,11 @@ prepare_mutex_handle_string (sync_handle_t handle)
* debuggers can attach.
*/
LONG WINAPI
handle_runtime_exceptions( struct _EXCEPTION_POINTERS *exinfo )
handle_runtime_exceptions (struct _EXCEPTION_POINTERS *exinfo)
{
PEXCEPTION_RECORD exrec = exinfo->ExceptionRecord;
LPSTR cmdline = GetCommandLine();
LPSTR prg = strtok(cmdline, " ");
LPSTR cmdline = GetCommandLine ();
LPSTR prg = strtok (cmdline, " ");
CHAR errmsg[1024];
#ifdef USE_EVENT_LOG
HANDLE hEventSource;
@@ -798,21 +798,21 @@ handle_runtime_exceptions( struct _EXCEPTION_POINTERS *exinfo )
if (! ISDB (DB_VERBOSE))
{
sprintf(errmsg,
sprintf (errmsg,
_("%s: Interrupt/Exception caught (code = 0x%lx, addr = 0x%p)\n"),
prg, exrec->ExceptionCode, exrec->ExceptionAddress);
fprintf(stderr, errmsg);
exit(255);
fprintf (stderr, errmsg);
exit (255);
}
sprintf(errmsg,
sprintf (errmsg,
_("\nUnhandled exception filter called from program %s\nExceptionCode = %lx\nExceptionFlags = %lx\nExceptionAddress = 0x%p\n"),
prg, exrec->ExceptionCode, exrec->ExceptionFlags,
exrec->ExceptionAddress);
if (exrec->ExceptionCode == EXCEPTION_ACCESS_VIOLATION
&& exrec->NumberParameters >= 2)
sprintf(&errmsg[strlen(errmsg)],
sprintf (&errmsg[strlen(errmsg)],
(exrec->ExceptionInformation[0]
? _("Access violation: write operation at address 0x%p\n")
: _("Access violation: read operation at address 0x%p\n")),
@@ -820,12 +820,12 @@ handle_runtime_exceptions( struct _EXCEPTION_POINTERS *exinfo )
/* turn this on if we want to put stuff in the event log too */
#ifdef USE_EVENT_LOG
hEventSource = RegisterEventSource(NULL, "GNU Make");
hEventSource = RegisterEventSource (NULL, "GNU Make");
lpszStrings[0] = errmsg;
if (hEventSource != NULL)
{
ReportEvent(hEventSource, /* handle of event source */
ReportEvent (hEventSource, /* handle of event source */
EVENTLOG_ERROR_TYPE, /* event type */
0, /* event category */
0, /* event ID */
@@ -835,17 +835,17 @@ handle_runtime_exceptions( struct _EXCEPTION_POINTERS *exinfo )
lpszStrings, /* array of error strings */
NULL); /* no raw data */
(VOID) DeregisterEventSource(hEventSource);
(VOID) DeregisterEventSource (hEventSource);
}
#endif
/* Write the error to stderr too */
fprintf(stderr, errmsg);
fprintf (stderr, errmsg);
#ifdef DEBUG
return EXCEPTION_CONTINUE_SEARCH;
#else
exit(255);
exit (255);
return (255); /* not reached */
#endif
}
@@ -885,7 +885,8 @@ find_and_set_default_shell (const char *token)
|| ((tokend - 4 == search_token
|| (tokend - 4 > search_token
&& (tokend[-5] == '/' || tokend[-5] == '\\')))
&& !strcasecmp (tokend - 4, "cmd.exe"))) {
&& !strcasecmp (tokend - 4, "cmd.exe")))
{
batch_mode_shell = 1;
unixy_shell = 0;
sprintf (sh_path, "%s", search_token);
@@ -893,32 +894,41 @@ find_and_set_default_shell (const char *token)
DB (DB_VERBOSE, (_("find_and_set_shell() setting default_shell = %s\n"),
default_shell));
sh_found = 1;
} else if (!no_default_sh_exe &&
(token == NULL || !strcmp (search_token, default_shell))) {
}
else if (!no_default_sh_exe
&& (token == NULL || !strcmp (search_token, default_shell)))
{
/* no new information, path already set or known */
sh_found = 1;
} else if (file_exists_p (search_token)) {
}
else if (file_exists_p (search_token))
{
/* search token path was found */
sprintf (sh_path, "%s", search_token);
default_shell = xstrdup (w32ify (sh_path, 0));
DB (DB_VERBOSE, (_("find_and_set_shell() setting default_shell = %s\n"),
default_shell));
sh_found = 1;
} else {
}
else
{
char *p;
struct variable *v = lookup_variable (STRING_SIZE_TUPLE ("PATH"));
/* Search Path for shell */
if (v && v->value) {
if (v && v->value)
{
char *ep;
p = v->value;
ep = strchr (p, PATH_SEPARATOR_CHAR);
while (ep && *ep) {
while (ep && *ep)
{
*ep = '\0';
if (dir_file_exists_p (p, search_token)) {
if (dir_file_exists_p (p, search_token))
{
sprintf (sh_path, "%s/%s", p, search_token);
default_shell = xstrdup (w32ify (sh_path, 0));
sh_found = 1;
@@ -926,7 +936,9 @@ find_and_set_default_shell (const char *token)
/* terminate loop */
p += strlen (p);
} else {
}
else
{
*ep = PATH_SEPARATOR_CHAR;
p = ++ep;
}
@@ -935,7 +947,8 @@ find_and_set_default_shell (const char *token)
}
/* be sure to check last element of Path */
if (p && *p && dir_file_exists_p (p, search_token)) {
if (p && *p && dir_file_exists_p (p, search_token))
{
sprintf (sh_path, "%s/%s", p, search_token);
default_shell = xstrdup (w32ify (sh_path, 0));
sh_found = 1;
@@ -949,8 +962,9 @@ find_and_set_default_shell (const char *token)
}
/* naive test */
if (!unixy_shell && sh_found &&
(strstr (default_shell, "sh") || strstr (default_shell, "SH"))) {
if (!unixy_shell && sh_found
&& (strstr (default_shell, "sh") || strstr (default_shell, "SH")))
{
unixy_shell = 1;
batch_mode_shell = 0;
}
@@ -992,7 +1006,7 @@ main (int argc, char **argv, char **envp)
char *unix_path = NULL;
char *windows32_path = NULL;
SetUnhandledExceptionFilter(handle_runtime_exceptions);
SetUnhandledExceptionFilter (handle_runtime_exceptions);
/* start off assuming we have no shell */
unixy_shell = 0;
@@ -1253,7 +1267,8 @@ main (int argc, char **argv, char **envp)
#ifdef WINDOWS32
if (!unix_path && strneq (envp[i], "PATH=", 5))
unix_path = ep+1;
else if (!strnicmp (envp[i], "Path=", 5)) {
else if (!strnicmp (envp[i], "Path=", 5))
{
do_not_define = 1; /* it gets defined after loop exits */
if (!windows32_path)
windows32_path = ep+1;
@@ -1316,7 +1331,7 @@ main (int argc, char **argv, char **envp)
env = Lock ("ENV:", ACCESS_READ);
if (env)
{
old = CurrentDir (DupLock(env));
old = CurrentDir (DupLock (env));
Examine (env, &fib);
while (ExNext (env, &fib))
@@ -1332,7 +1347,7 @@ main (int argc, char **argv, char **envp)
}
}
UnLock (env);
UnLock(CurrentDir(old));
UnLock (CurrentDir (old));
}
}
#endif
@@ -1352,11 +1367,12 @@ main (int argc, char **argv, char **envp)
decode_switches (argc, argv, 0);
#ifdef WINDOWS32
if (suspend_flag) {
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"));
if (suspend_flag)
{
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"));
}
#endif
@@ -1386,10 +1402,9 @@ main (int argc, char **argv, char **envp)
* matter if the path is one way or the other for
* CreateProcess().
*/
if (strpbrk(argv[0], "/:\\") ||
strstr(argv[0], "..") ||
strneq(argv[0], "//", 2))
argv[0] = xstrdup(w32ify(argv[0],1));
if (strpbrk (argv[0], "/:\\") || strstr (argv[0], "..")
|| strneq (argv[0], "//", 2))
argv[0] = xstrdup (w32ify (argv[0], 1));
#else /* WINDOWS32 */
#if defined (__MSDOS__) || defined (__EMX__)
if (strchr (argv[0], '\\'))
@@ -1511,7 +1526,7 @@ main (int argc, char **argv, char **envp)
* lookups to fail because the current directory (.) was pointing
* at the wrong place when it was first evaluated.
*/
no_default_sh_exe = !find_and_set_default_shell(NULL);
no_default_sh_exe = !find_and_set_default_shell (NULL);
#endif /* WINDOWS32 */
/* Figure out the level of recursion. */
@@ -1742,7 +1757,7 @@ main (int argc, char **argv, char **envp)
#ifdef WINDOWS32
/* look one last time after reading all Makefiles */
if (no_default_sh_exe)
no_default_sh_exe = !find_and_set_default_shell(NULL);
no_default_sh_exe = !find_and_set_default_shell (NULL);
#endif /* WINDOWS32 */
#if defined (__MSDOS__) || defined (__EMX__)
@@ -1755,7 +1770,7 @@ main (int argc, char **argv, char **envp)
if (shv && *shv->value)
{
char *shell_path = recursively_expand(shv);
char *shell_path = recursively_expand (shv);
if (shell_path && _is_unixy_shell (shell_path))
unixy_shell = 1;
@@ -1825,11 +1840,11 @@ main (int argc, char **argv, char **envp)
cp = jobserver_fds->list[0];
#ifdef WINDOWS32
if (! open_jobserver_semaphore(cp))
if (! open_jobserver_semaphore (cp))
{
DWORD err = GetLastError();
DWORD err = GetLastError ();
fatal (NILF, _("internal error: unable to open jobserver semaphore '%s': (Error %ld: %s)"),
cp, err, map_windows32_error_to_string(err));
cp, err, map_windows32_error_to_string (err));
}
DB (DB_JOBS, (_("Jobserver client (semaphore %s)\n"), cp));
#else
@@ -1900,11 +1915,11 @@ main (int argc, char **argv, char **envp)
DB (DB_JOBS, (_("Jobserver slots limited to %d\n"), job_slots));
}
if (! create_jobserver_semaphore(job_slots - 1))
if (! create_jobserver_semaphore (job_slots - 1))
{
DWORD err = GetLastError();
DWORD err = GetLastError ();
fatal (NILF, _("creating jobserver semaphore: (Error %ld: %s)"),
err, map_windows32_error_to_string(err));
err, map_windows32_error_to_string (err));
}
#else
char c = '+';
@@ -1938,7 +1953,7 @@ main (int argc, char **argv, char **envp)
#ifdef WINDOWS32
cp = xmalloc (MAX_PATH + 1);
strcpy (cp, get_jobserver_semaphore_name());
strcpy (cp, get_jobserver_semaphore_name ());
#else
cp = xmalloc ((CSTRLEN ("1024") * 2) + 2);
sprintf (cp, "%d,%d", job_fds[0], job_fds[1]);
@@ -2461,7 +2476,7 @@ main (int argc, char **argv, char **envp)
}
/* NOTREACHED */
exit(0);
exit (0);
}
/* Parsing of arguments, decoding of switches. */
@@ -2553,7 +2568,8 @@ handle_non_switch_argument (char *arg, int env)
if (cv->variable == v)
break;
if (! cv) {
if (! cv)
{
cv = xmalloc (sizeof (*cv));
cv->variable = v;
cv->next = command_variables;
@@ -3262,7 +3278,7 @@ clean_jobserver (int status)
after any other error code, that's bad. */
#ifdef WINDOWS32
if (has_jobserver_semaphore() && jobserver_tokens)
if (has_jobserver_semaphore () && jobserver_tokens)
#else
char token = '+';
@@ -3278,7 +3294,7 @@ clean_jobserver (int status)
while (--jobserver_tokens)
{
#ifdef WINDOWS32
if (! release_jobserver_semaphore())
if (! release_jobserver_semaphore ())
perror_with_name ("release_jobserver_semaphore", "");
#else
int r;
@@ -3299,7 +3315,7 @@ clean_jobserver (int status)
unsigned int tcnt = 1;
#ifdef WINDOWS32
while (acquire_jobserver_semaphore())
while (acquire_jobserver_semaphore ())
++tcnt;
#else
/* Close the write side, so the read() won't hang. */
@@ -3315,7 +3331,7 @@ clean_jobserver (int status)
tcnt, master_job_slots);
#ifdef WINDOWS32
free_jobserver_semaphore();
free_jobserver_semaphore ();
#else
close (job_fds[0]);
#endif

6
misc.c
View File

@@ -943,10 +943,10 @@ char *mktemp (char *template);
/* Returns a file descriptor to a temporary file. The file is automatically
closed/deleted on exit. Don't use a FILE* stream. */
int
open_tmpfd()
open_tmpfd ()
{
int fd = -1;
FILE *tfile = tmpfile();
FILE *tfile = tmpfile ();
if (! tfile)
pfatal_with_name ("tmpfile");
@@ -964,7 +964,7 @@ open_tmpfd()
#endif
FILE *
open_tmpfile(char **name, const char *template)
open_tmpfile (char **name, const char *template)
{
#ifdef HAVE_FDOPEN
int fd;

28
read.c
View File

@@ -705,7 +705,7 @@ eval (struct ebuffer *ebuf, int set_default)
/* See if this is a variable assignment. We need to do this early, to
allow variables with names like 'ifdef', 'export', 'private', etc. */
p = parse_var_assignment(p, &vmod);
p = parse_var_assignment (p, &vmod);
if (vmod.assign_v)
{
struct variable *v;
@@ -960,7 +960,7 @@ eval (struct ebuffer *ebuf, int set_default)
was no preceding target, and the line might have been usable as a
variable definition. But now we know it is definitely lossage. */
if (line[0] == cmd_prefix)
fatal(fstart, _("recipe commences before first target"));
fatal (fstart, _("recipe commences before first target"));
/* This line describes some target files. This is complicated by
the existence of target-specific variables, because we can't
@@ -1004,12 +1004,12 @@ eval (struct ebuffer *ebuf, int set_default)
variable we don't want to expand it. So, walk from the
beginning, expanding as we go, and looking for "interesting"
chars. The first word is always expandable. */
wtype = get_next_mword(line, NULL, &lb_next, &wlen);
wtype = get_next_mword (line, NULL, &lb_next, &wlen);
switch (wtype)
{
case w_eol:
if (cmdleft != 0)
fatal(fstart, _("missing rule before recipe"));
fatal (fstart, _("missing rule before recipe"));
/* This line contained something but turned out to be nothing
but whitespace (a comment?). */
continue;
@@ -1025,7 +1025,7 @@ eval (struct ebuffer *ebuf, int set_default)
break;
}
p2 = variable_expand_string(NULL, lb_next, wlen);
p2 = variable_expand_string (NULL, lb_next, wlen);
while (1)
{
@@ -1039,7 +1039,7 @@ eval (struct ebuffer *ebuf, int set_default)
{
unsigned long p2_off = p2 - variable_buffer;
unsigned long cmd_off = cmdleft - variable_buffer;
char *pend = p2 + strlen(p2);
char *pend = p2 + strlen (p2);
/* Append any remnants of lb, then cut the line short
at the semicolon. */
@@ -1053,14 +1053,14 @@ eval (struct ebuffer *ebuf, int set_default)
entirely consistent, since we do an unconditional
expand below once we know we don't have a
target-specific variable. */
(void)variable_expand_string(pend, lb_next, (long)-1);
lb_next += strlen(lb_next);
(void)variable_expand_string (pend, lb_next, (long)-1);
lb_next += strlen (lb_next);
p2 = variable_buffer + p2_off;
cmdleft = variable_buffer + cmd_off + 1;
}
}
colonp = find_char_unquote(p2, ':', 0, 0, 0);
colonp = find_char_unquote (p2, ':', 0, 0, 0);
#ifdef HAVE_DOS_PATHS
/* The drive spec brain-damage strikes again... */
/* Note that the only separators of targets in this context
@@ -1069,18 +1069,18 @@ eval (struct ebuffer *ebuf, int set_default)
while (colonp && (colonp[1] == '/' || colonp[1] == '\\') &&
colonp > p2 && isalpha ((unsigned char)colonp[-1]) &&
(colonp == p2 + 1 || strchr (" \t(", colonp[-2]) != 0))
colonp = find_char_unquote(colonp + 1, ':', 0, 0, 0);
colonp = find_char_unquote (colonp + 1, ':', 0, 0, 0);
#endif
if (colonp != 0)
break;
wtype = get_next_mword(lb_next, NULL, &lb_next, &wlen);
wtype = get_next_mword (lb_next, NULL, &lb_next, &wlen);
if (wtype == w_eol)
break;
p2 += strlen(p2);
p2 += strlen (p2);
*(p2++) = ' ';
p2 = variable_expand_string(p2, lb_next, wlen);
p2 = variable_expand_string (p2, lb_next, wlen);
/* We don't need to worry about cmdleft here, because if it was
found in the variable_buffer the entire buffer has already
been expanded... we'll never get here. */
@@ -1880,7 +1880,7 @@ record_target_var (struct nameseq *filenames, char *defn,
if (v->origin != o_override)
{
struct variable *gv;
int len = strlen(v->name);
int len = strlen (v->name);
gv = lookup_variable (v->name, len);
if (gv && v != gv

View File

@@ -803,7 +803,7 @@ update_file_1 (struct file *file, unsigned int depth)
/* It needs to be remade. If it's VPATH and not reset via GPATH, toss the
VPATH. */
if (!streq(file->name, file->hname))
if (!streq (file->name, file->hname))
{
DB (DB_BASIC, (_(" Ignoring VPATH name '%s'.\n"), file->hname));
file->ignore_vpath = 1;
@@ -1307,7 +1307,7 @@ f_mtime (struct file *file, int search)
/* If we found it in VPATH, see if it's in GPATH too; if so,
change the name right now; if not, defer until after the
dependencies are updated. */
if (gpath_search (name, strlen(name) - strlen(file->name) - 1))
if (gpath_search (name, strlen (name) - strlen (file->name) - 1))
{
rename_file (file, name);
check_renamed (file);
@@ -1635,7 +1635,7 @@ library_search (const char *lib, FILE_TIMESTAMP *mtime_ptr)
std_dirs++;
}
buflen = strlen (libbuf);
buf = xmalloc(libdir_maxlen + buflen + 2);
buf = xmalloc (libdir_maxlen + buflen + 2);
}
else if (buflen < strlen (libbuf))
{

View File

@@ -80,7 +80,7 @@ start_remote_job_p (int first_p)
make_access ();
if (ISDB (DB_JOBS))
Rpc_Debug(1);
Rpc_Debug (1);
/* Ping the daemon once to see if it is there. */
inited = Customs_Ping () == RPC_SUCCESS ? 1 : -1;
@@ -188,10 +188,10 @@ start_remote_job (char **argv, char **envp, int stdin_fd,
sin.sin_addr = permit.addr;
status = Rpc_Call (sock, &sin, (Rpc_Proc) CUSTOMS_IMPORT,
len, (Rpc_Opaque) waybill,
sizeof(msg), (Rpc_Opaque) msg,
sizeof (msg), (Rpc_Opaque) msg,
1, &timeout);
host = gethostbyaddr((char *)&permit.addr, sizeof(permit.addr), AF_INET);
host = gethostbyaddr ((char *)&permit.addr, sizeof(permit.addr), AF_INET);
if (status != RPC_SUCCESS)
{

View File

@@ -57,7 +57,7 @@ static unsigned long total_size = 0;
that this doesn't seem to be much of an issue in practice.
*/
static struct strcache *
new_cache()
new_cache ()
{
struct strcache *new;
new = xmalloc (bufsize + CACHE_BUFFER_OFFSET);
@@ -208,7 +208,7 @@ strcache_add_len (const char *str, unsigned int len)
}
int
strcache_setbufsize(unsigned int size)
strcache_setbufsize (unsigned int size)
{
if (size > bufsize)
bufsize = size;
@@ -233,7 +233,7 @@ strcache_print_stats (const char *prefix)
if (! strcache)
{
printf(_("\n%s No strcache buffers\n"), prefix);
printf (_("\n%s No strcache buffers\n"), prefix);
return;
}

0
tests/run_make_tests.pl Executable file → Normal file
View File

View File

@@ -98,7 +98,7 @@ static struct pattern_var *
lookup_pattern_var (struct pattern_var *start, const char *target)
{
struct pattern_var *p;
unsigned int targlen = strlen(target);
unsigned int targlen = strlen (target);
for (p = start ? start->next : pattern_vars; p != 0; p = p->next)
{
@@ -666,7 +666,7 @@ create_new_variable_set (void)
struct variable_set_list *
push_new_variable_scope (void)
{
current_variable_set_list = create_new_variable_set();
current_variable_set_list = create_new_variable_set ();
if (current_variable_set_list->next == &global_setlist)
{
/* It was the global, so instead of new -> &global we want to replace
@@ -689,7 +689,7 @@ pop_variable_scope (void)
struct variable_set *set;
/* Can't call this if there's no scope to pop! */
assert(current_variable_set_list->next != NULL);
assert (current_variable_set_list->next != NULL);
if (current_variable_set_list != &global_setlist)
{
@@ -844,7 +844,7 @@ define_automatic_variables (void)
|| shell->origin == o_env_override))
{
/* overwrite whatever we got from the environment */
free(shell->value);
free (shell->value);
shell->value = xstrdup (default_shell);
shell->origin = o_default;
}
@@ -992,7 +992,7 @@ target_environment (struct file *file)
{
struct variable *gv;
gv = lookup_variable_in_set (v->name, strlen(v->name),
gv = lookup_variable_in_set (v->name, strlen (v->name),
&global_variable_set);
if (gv)
v->export = gv->export;
@@ -1065,9 +1065,9 @@ target_environment (struct file *file)
{
char *value = recursively_expand_for_file (v, file);
#ifdef WINDOWS32
if (strcmp(v->name, "Path") == 0 ||
strcmp(v->name, "PATH") == 0)
convert_Path_to_windows32(value, ';');
if (strcmp (v->name, "Path") == 0 ||
strcmp (v->name, "PATH") == 0)
convert_Path_to_windows32 (value, ';');
#endif
*result++ = xstrdup (concat (3, v->name, "=", value));
free (value);
@@ -1075,9 +1075,9 @@ target_environment (struct file *file)
else
{
#ifdef WINDOWS32
if (strcmp(v->name, "Path") == 0 ||
strcmp(v->name, "PATH") == 0)
convert_Path_to_windows32(v->value, ';');
if (strcmp (v->name, "Path") == 0 ||
strcmp (v->name, "PATH") == 0)
convert_Path_to_windows32 (v->value, ';');
#endif
*result++ = xstrdup (concat (3, v->name, "=", v->value));
}

View File

@@ -204,7 +204,7 @@ construct_vpath_list (char *pattern, char *dirpath)
}
#ifdef WINDOWS32
convert_vpath_to_windows32(dirpath, ';');
convert_vpath_to_windows32 (dirpath, ';');
#endif
/* Skip over any initial separators and blanks. */
@@ -355,7 +355,7 @@ selective_vpath_search (struct vpath *path, const char *file,
#ifdef HAVE_DOS_PATHS
/* We need the rightmost slash or backslash. */
{
const char *bslash = strrchr(file, '\\');
const char *bslash = strrchr (file, '\\');
if (!n || bslash > n)
n = bslash;
}