Skip to content

Commit

Permalink
Fix outstanding 32/64 warnings on Linux gcc+clang.
Browse files Browse the repository at this point in the history
  • Loading branch information
grafikrobot committed Sep 10, 2020
1 parent 84666e7 commit 84dae08
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 49 deletions.
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ for:
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> NO WARNINGS"
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
src\engine\b2.exe --debug-configuration b2 warnings-as-errors=on toolset=%TEST_TOOLSET%
src\engine\b2.exe --debug-configuration b2 warnings-as-errors=on variant=debug,release address-model=32,64 toolset=%TEST_TOOLSET%
- cmd: |
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> BOOTSTRAP"
Expand Down
24 changes: 3 additions & 21 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,8 @@ stages:
set -e
CXX_PATH=`which ${CXX}`
echo "using ${TEST_TOOLSET} : : ${CXX_PATH} ;" > ${HOME}/user-config.jam
./src/engine/b2 b2 warnings-as-errors=on toolset=${TEST_TOOLSET}
./src/engine/b2 b2 warnings-as-errors=on variant=debug,release address-model=32,64 toolset=${TEST_TOOLSET}
displayName: "No Warnings"
- bash: |
set -e
CXX_PATH=`which ${CXX}`
echo "using ${TEST_TOOLSET} : : ${CXX_PATH} ;" > ${HOME}/user-config.jam
./src/engine/b2 b2 warnings-as-errors=on toolset=${TEST_TOOLSET} address-model=64
displayName: "No-Warn 64bit"
- bash: |
set -e
CXX_PATH=`which ${CXX}`
Expand Down Expand Up @@ -216,14 +210,8 @@ stages:
$env:HOME = $env:HOMEDRIVE + $env:HOMEPATH
$env:path += ';' + $env:CXX_PATH
echo "using" $env:TEST_TOOLSET ":" ":" $env:CXX ";" > $env:HOME/user-config.jam
./src/engine/b2.exe --debug-configuration b2 warnings-as-errors=on toolset=$env:TEST_TOOLSET
./src/engine/b2.exe --debug-configuration b2 warnings-as-errors=on variant=debug,release toolset=$env:TEST_TOOLSET
displayName: "No Warnings"
- powershell: |
$env:HOME = $env:HOMEDRIVE + $env:HOMEPATH
$env:path += ';' + $env:CXX_PATH
echo "using" $env:TEST_TOOLSET ":" ":" $env:CXX ";" > $env:HOME/user-config.jam
./src/engine/b2.exe --debug-configuration b2 warnings-as-errors=on toolset=$env:TEST_TOOLSET address-model=64
displayName: "No-Warn 64bit"
- powershell: |
$env:HOME = $env:HOMEDRIVE + $env:HOMEPATH
$env:path += ';' + $env:CXX_PATH
Expand Down Expand Up @@ -323,14 +311,8 @@ stages:
set -e
CXX_PATH=`which ${CXX}`
echo "using ${TEST_TOOLSET} : : ${CXX_PATH} ;" > ${HOME}/user-config.jam
./src/engine/b2 b2 warnings-as-errors=on toolset=${TEST_TOOLSET}
./src/engine/b2 b2 warnings-as-errors=on variant=debug,release address-model,32,64 toolset=${TEST_TOOLSET}
displayName: "No Warnings"
- bash: |
set -e
CXX_PATH=`which ${CXX}`
echo "using ${TEST_TOOLSET} : : ${CXX_PATH} ;" > ${HOME}/user-config.jam
./src/engine/b2 b2 warnings-as-errors=on toolset=${TEST_TOOLSET} address-model=64
displayName: "No-Warn 64bit"
- bash: |
set -e
CXX_PATH=`which ${CXX}`
Expand Down
5 changes: 2 additions & 3 deletions src/engine/debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,10 @@ static LIST * debug_list_read( FILE * in )
{
int len;
int i;
int ch;
LIST * result = L0;
fscanf( in, "%d", &len );
ch = fgetc( in );
assert( ch == '\n' );
int ch = fgetc( in );
if (ch > 0) assert( ch == '\n' );
for ( i = 0; i < len; ++i )
{
result = list_push_back( result, debug_object_read( in ) );
Expand Down
4 changes: 2 additions & 2 deletions src/engine/execcmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ static int intr;
*/

void argv_from_shell( char const * * argv, LIST * shell, char const * command,
int const slot )
int32_t const slot )
{
static char jobno[ 4 ];
static char jobno[ 12 ];

int i;
int gotpercent = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/engine/execcmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void exec_wait();
* given shell list.
*/
void argv_from_shell( char const * * argv, LIST * shell, char const * command,
int const slot );
int32_t const slot );

/* Interrupt routine bumping the internal interrupt counter. Needs to be
* registered by platform specific exec*.c modules.
Expand Down
6 changes: 4 additions & 2 deletions src/engine/function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3193,7 +3193,7 @@ void argument_list_push( struct arg_list * formal, int32_t formal_count,
for ( j = 0; j < formal[ i ].size; ++j )
{
struct argument * formal_arg = &formal[ i ].args[ j ];
LIST * value;
LIST * value = L0;

switch ( formal_arg->flags )
{
Expand Down Expand Up @@ -3871,7 +3871,9 @@ LIST * function_run( FUNCTION * function_, FRAME * frame, STACK * s )
LIST * l;
LIST * r;
LIST * result = L0;
#ifndef NDEBUG
void * saved_stack = s->data;
#endif

PROFILE_ENTER_LOCAL(function_run);

Expand Down Expand Up @@ -4250,8 +4252,8 @@ LIST * function_run( FUNCTION * function_, FRAME * frame, STACK * s )
backtrace( frame );
assert( saved_stack == s->data );
}
#endif
assert( saved_stack == s->data );
#endif
debug_on_exit_function( function->base.rulename );
PROFILE_EXIT_LOCAL(function_run_INSTR_RETURN);
PROFILE_EXIT_LOCAL(function_run);
Expand Down
4 changes: 2 additions & 2 deletions src/engine/jam_strings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static void assert_invariants( string * self )
}

assert( self->size < self->capacity );
assert( ( self->capacity <= sizeof( self->opt ) ) == ( self->value == self->opt ) );
assert( ( self->capacity <= int32_t(sizeof( self->opt )) ) == ( self->value == self->opt ) );
assert( self->value[ self->size ] == 0 );
/* String objects modified manually after construction to contain embedded
* '\0' characters are considered structurally valid.
Expand Down Expand Up @@ -198,7 +198,7 @@ void string_unit_test()
for ( i = 0; i < limit; ++i )
{
string_push_back( s, (char)( i + 1 ) );
assert( s->size == i + 1 );
assert( s->size == int32_t(i + 1) );
}
assert( s->size == limit );
assert( s->value != s->opt );
Expand Down
2 changes: 1 addition & 1 deletion src/engine/lists.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ LIST * list_unique( LIST * sorted_list )

void list_done()
{
for ( int32_t i = 0; i < sizeof( freelist ) / sizeof( freelist[ 0 ] ); ++i )
for ( int32_t i = 0; i < int32_t(sizeof( freelist ) / sizeof( freelist[ 0 ] )); ++i )
{
LIST * l = freelist[ i ];
while ( l )
Expand Down
4 changes: 2 additions & 2 deletions src/engine/make1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1065,11 +1065,11 @@ static void swap_settings
static CMD * make1cmds( TARGET * t )
{
CMD * cmds = 0;
CMD * last_cmd;
CMD * last_cmd = 0;
LIST * shell = L0;
module_t * settings_module = 0;
TARGET * settings_target = 0;
ACTIONS * a0;
ACTIONS * a0 = 0;
int32_t const running_flag = globs.noexec ? A_RUNNING_NOEXEC : A_RUNNING;

/* Step through actions.
Expand Down
28 changes: 14 additions & 14 deletions src/engine/object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,20 +229,6 @@ static char const * string_set_insert( string_set * set, char const * string,
}


static struct hash_item * object_get_item( OBJECT * obj )
{
return (struct hash_item *)( (char *)obj - offsetof( struct hash_item, data
) );
}


static void object_validate( OBJECT * obj )
{
assert( obj );
assert( object_get_item( obj )->header.magic == OBJECT_MAGIC );
}


/*
* object_new_range() - create an object from a string of given length
*/
Expand Down Expand Up @@ -283,6 +269,20 @@ OBJECT * object_new( char const * const string )

#ifndef object_copy

static struct hash_item * object_get_item( OBJECT * obj )
{
return (struct hash_item *)( (char *)obj - offsetof( struct hash_item, data
) );
}


static void object_validate( OBJECT * obj )
{
assert( obj );
assert( object_get_item( obj )->header.magic == OBJECT_MAGIC );
}


/*
* object_copy() - return a copy of an object
*/
Expand Down

0 comments on commit 84dae08

Please sign in to comment.