Fix warnings when building jam.

Sorry for the included whitespace cleanup.
This commit is contained in:
Oliver Tappe 2014-05-12 23:17:14 +02:00
parent c20a732df8
commit 6c03949644
3 changed files with 51 additions and 49 deletions

View File

@ -15,7 +15,7 @@
* *
* Each word must be an individual element in a jam variable value. * Each word must be an individual element in a jam variable value.
* *
* In $(JAMSHELL), % expands to the command string and ! expands to * In $(JAMSHELL), % expands to the command string and ! expands to
* the slot number (starting at 1) for multiprocess (-j) invocations. * the slot number (starting at 1) for multiprocess (-j) invocations.
* If $(JAMSHELL) doesn't include a %, it is tacked on as the last * If $(JAMSHELL) doesn't include a %, it is tacked on as the last
* argument. * argument.
@ -50,13 +50,17 @@
# include <process.h> # include <process.h>
# endif # endif
# ifdef OS_NT # ifdef unix
# include <unistd.h>
# endif
# ifdef OS_NT
# define USE_EXECNT # define USE_EXECNT
# include <process.h> # include <process.h>
# define WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN
# include <windows.h> /* do the ugly deed */ # include <windows.h> /* do the ugly deed */
# define USE_MYWAIT # define USE_MYWAIT
# if !defined( __BORLANDC__ ) # if !defined( __BORLANDC__ )
# define wait my_wait # define wait my_wait
static int my_wait( int *status ); static int my_wait( int *status );
# endif # endif
@ -94,7 +98,7 @@ onintr( int disp )
*/ */
void void
execcmd( execcmd(
char *string, char *string,
void (*func)( void *closure, int status ), void (*func)( void *closure, int status ),
void *closure, void *closure,
@ -133,7 +137,7 @@ execcmd(
cmdtab[ slot ].tempfile = malloc( strlen( tempdir ) + 32 ); cmdtab[ slot ].tempfile = malloc( strlen( tempdir ) + 32 );
sprintf( cmdtab[ slot ].tempfile, "%s\\jam%dt%d.bat", sprintf( cmdtab[ slot ].tempfile, "%s\\jam%dt%d.bat",
tempdir, GetCurrentProcessId(), slot ); tempdir, GetCurrentProcessId(), slot );
} }
@ -223,15 +227,15 @@ execcmd(
} }
# else # else
# ifdef NO_VFORK # ifdef NO_VFORK
if ((pid = fork()) == 0) if ((pid = fork()) == 0)
{ {
execvp( argv[0], argv ); execvp( argv[0], argv );
_exit(127); _exit(127);
} }
# else # else
if ((pid = vfork()) == 0) if ((pid = vfork()) == 0)
{ {
execvp( argv[0], argv ); execvp( argv[0], (char* const*)argv );
_exit(127); _exit(127);
} }
# endif # endif
@ -272,10 +276,10 @@ execwait()
if( !cmdsrunning ) if( !cmdsrunning )
return 0; return 0;
do do
{ {
/* Pick up process pid and status */ /* Pick up process pid and status */
while( ( w = wait( &status ) ) == -1 && errno == EINTR ) while( ( w = wait( &status ) ) == -1 && errno == EINTR )
; ;
@ -377,7 +381,7 @@ my_wait( int *status )
FAILED: FAILED:
errno = GetLastError(); errno = GetLastError();
return -1; return -1;
} }
# endif /* USE_MYWAIT */ # endif /* USE_MYWAIT */

View File

@ -35,14 +35,14 @@
* hcache_init() - read and parse the local .jamdeps file. * hcache_init() - read and parse the local .jamdeps file.
* hcache_done() - write a new .jamdeps file * hcache_done() - write a new .jamdeps file
* hcache() - return list of headers on target. Use cache or do a scan. * hcache() - return list of headers on target. Use cache or do a scan.
* *
* The dependency file format is an ascii file with 1 line per target. * The dependency file format is an ascii file with 1 line per target.
* Each line has the following fields: * Each line has the following fields:
* @boundname@ timestamp @file@ @file@ @file@ ... \n * @boundname@ timestamp @file@ @file@ @file@ ... \n
* */ * */
struct hcachedata { struct hcachedata {
char *boundname; const char *boundname;
time_t time; time_t time;
LIST *includes; LIST *includes;
LIST *hdrscan; /* the HDRSCAN value for this target */ LIST *hdrscan; /* the HDRSCAN value for this target */
@ -54,7 +54,7 @@ typedef struct hcachedata HCACHEDATA ;
static struct hash *hcachehash = 0; static struct hash *hcachehash = 0;
static HCACHEDATA *hcachelist = 0; static HCACHEDATA *hcachelist = 0;
static int queries = 0; static int queries = 0;
static int hits = 0; static int hits = 0;
@ -70,10 +70,10 @@ static int hits = 0;
* We cache the result so the user can't change the cache file during * We cache the result so the user can't change the cache file during
* header scanning. * header scanning.
*/ */
static char* static const char*
cache_name(void) cache_name(void)
{ {
static char* name = 0; static const char* name = 0;
if (!name) { if (!name) {
LIST *hcachevar = var_get("HCACHEFILE"); LIST *hcachevar = var_get("HCACHEFILE");
@ -116,7 +116,7 @@ cache_maxage(void)
* ASCII 0. The returned value is as returned by newstr(), so it need * ASCII 0. The returned value is as returned by newstr(), so it need
* not be freed. * not be freed.
*/ */
char* const char*
read_netstring(FILE* f) read_netstring(FILE* f)
{ {
unsigned long len; unsigned long len;
@ -168,10 +168,10 @@ void
hcache_init() hcache_init()
{ {
HCACHEDATA cachedata, *c; HCACHEDATA cachedata, *c;
FILE *f; FILE *f;
char *version; const char *version;
int header_count = 0; int header_count = 0;
char* hcachename; const char* hcachename;
hcachehash = hashinit (sizeof (HCACHEDATA), "hcache"); hcachehash = hashinit (sizeof (HCACHEDATA), "hcache");
@ -180,7 +180,7 @@ hcache_init()
if (! (f = fopen (hcachename, "rb" ))) if (! (f = fopen (hcachename, "rb" )))
return; return;
version = read_netstring(f); version = read_netstring(f);
if (!version || strcmp(version, CACHE_FILE_VERSION)) { if (!version || strcmp(version, CACHE_FILE_VERSION)) {
fclose(f); fclose(f);
@ -189,11 +189,11 @@ hcache_init()
while (1) while (1)
{ {
char* record_type; const char* record_type;
char *time_str; const char *time_str;
char *age_str; const char *age_str;
char *includes_count_str; const char *includes_count_str;
char *hdrscan_count_str; const char *hdrscan_count_str;
int i, count; int i, count;
LIST *l; LIST *l;
@ -210,14 +210,14 @@ hcache_init()
hcachename, record_type ? record_type : "<null>"); hcachename, record_type ? record_type : "<null>");
goto bail; goto bail;
} }
c = &cachedata; c = &cachedata;
c->boundname = read_netstring(f); c->boundname = read_netstring(f);
time_str = read_netstring(f); time_str = read_netstring(f);
age_str = read_netstring(f); age_str = read_netstring(f);
includes_count_str = read_netstring(f); includes_count_str = read_netstring(f);
if (!c->boundname || !time_str || !age_str if (!c->boundname || !time_str || !age_str
|| !includes_count_str) || !includes_count_str)
{ {
@ -230,7 +230,7 @@ hcache_init()
count = atoi(includes_count_str); count = atoi(includes_count_str);
for (l = 0, i = 0; i < count; i++) { for (l = 0, i = 0; i < count; i++) {
char* s = read_netstring(f); const char* s = read_netstring(f);
if (!s) { if (!s) {
fprintf(stderr, "invalid %s\n", hcachename); fprintf(stderr, "invalid %s\n", hcachename);
goto bail; goto bail;
@ -248,7 +248,7 @@ hcache_init()
count = atoi(hdrscan_count_str); count = atoi(hdrscan_count_str);
for (l = 0, i = 0; i < count; i++) { for (l = 0, i = 0; i < count; i++) {
char* s = read_netstring(f); const char* s = read_netstring(f);
if (!s) { if (!s) {
fprintf(stderr, "invalid %s\n", hcachename); fprintf(stderr, "invalid %s\n", hcachename);
goto bail; goto bail;
@ -272,7 +272,7 @@ hcache_init()
if (DEBUG_HEADER) { if (DEBUG_HEADER) {
printf("hcache read from file %s\n", hcachename); printf("hcache read from file %s\n", hcachename);
} }
bail: bail:
fclose(f); fclose(f);
} }
@ -280,12 +280,12 @@ hcache_init()
void void
hcache_done() hcache_done()
{ {
FILE *f; FILE *f;
HCACHEDATA *c; HCACHEDATA *c;
int header_count = 0; int header_count = 0;
char* hcachename; const char* hcachename;
int maxage; int maxage;
if (!hcachehash) if (!hcachehash)
return; return;

View File

@ -38,9 +38,7 @@
# ifdef USE_PATHUNIX # ifdef USE_PATHUNIX
# if defined( OS_MACOSX ) # if defined( unix )
/* need unistd for the prototype for getcwd to avoid defaulting return to int on 64bit */
/* XXX: others too ? */
# include <unistd.h> # include <unistd.h>
# endif # endif
@ -49,13 +47,13 @@
*/ */
void void
path_parse( path_parse(
const char *file, const char *file,
PATHNAME *f ) PATHNAME *f )
{ {
const char *p, *q; const char *p, *q;
const char *end; const char *end;
memset( (char *)f, 0, sizeof( *f ) ); memset( (char *)f, 0, sizeof( *f ) );
/* Look for <grist> */ /* Look for <grist> */
@ -83,7 +81,7 @@ path_parse(
{ {
f->f_dir.ptr = file; f->f_dir.ptr = file;
f->f_dir.len = p - file; f->f_dir.len = p - file;
/* Special case for / - dirname is /, not "" */ /* Special case for / - dirname is /, not "" */
if( !f->f_dir.len ) if( !f->f_dir.len )
@ -108,7 +106,7 @@ path_parse(
f->f_member.ptr = p + 1; f->f_member.ptr = p + 1;
f->f_member.len = end - p - 2; f->f_member.len = end - p - 2;
end = p; end = p;
} }
/* Look for .suffix */ /* Look for .suffix */
/* This would be memrchr() */ /* This would be memrchr() */
@ -157,13 +155,13 @@ path_build(
# if PATH_DELIM == '/' # if PATH_DELIM == '/'
if( f->f_root.len if( f->f_root.len
&& !( f->f_root.len == 1 && f->f_root.ptr[0] == '.' ) && !( f->f_root.len == 1 && f->f_root.ptr[0] == '.' )
&& !( f->f_dir.len && f->f_dir.ptr[0] == '/' ) ) && !( f->f_dir.len && f->f_dir.ptr[0] == '/' ) )
# else /* unix */ # else /* unix */
if( f->f_root.len if( f->f_root.len
&& !( f->f_root.len == 1 && f->f_root.ptr[0] == '.' ) && !( f->f_root.len == 1 && f->f_root.ptr[0] == '.' )
&& !( f->f_dir.len && f->f_dir.ptr[0] == '/' ) && !( f->f_dir.len && f->f_dir.ptr[0] == '/' )
&& !( f->f_dir.len && f->f_dir.ptr[0] == '\\' ) && !( f->f_dir.len && f->f_dir.ptr[0] == '\\' )
@ -233,8 +231,8 @@ path_parent( PATHNAME *f )
f->f_suffix.ptr = f->f_suffix.ptr =
f->f_member.ptr = ""; f->f_member.ptr = "";
f->f_base.len = f->f_base.len =
f->f_suffix.len = f->f_suffix.len =
f->f_member.len = 0; f->f_member.len = 0;
} }