Fix notes produced by clang compiler

note: use '==' to turn this assignment into an equality comparison
This commit is contained in:
Ilya V. Matveychikov 2015-07-30 19:11:43 +03:00
parent ad7507fd7f
commit 3b4ec5258f
18 changed files with 35 additions and 35 deletions

View File

@ -532,7 +532,7 @@ static void CmdlParamsInit( int pass )
add_cmdline_tmacros();
add_incpaths();
if ( Options.ignore_include == FALSE )
if ( env = getenv( "INCLUDE" ) )
if ( (env = getenv( "INCLUDE" )) != NULL )
AddStringToIncludePath( env );
}
DebugMsg(("CmdlParamsInit exit\n"));
@ -1001,9 +1001,9 @@ static int OnePass( void )
DebugMsg1(("OnePass(%u) cur/nxt=%X/%X src=%X.%u mlvl=%u: >%s<\n", Parse_Pass+1, LineStoreCurr, LineStoreCurr->next, LineStoreCurr->srcfile, LineStoreCurr->lineno, MacroLevel, LineStoreCurr->line ));
ModuleInfo.CurrComment = NULL; /* v2.08: added (var is never reset because GetTextLine() isn't called) */
#if USELSLINE
if ( Token_Count = Tokenize( LineStoreCurr->line, 0, ModuleInfo.tokenarray, TOK_DEFAULT ) )
if ( (Token_Count = Tokenize( LineStoreCurr->line, 0, ModuleInfo.tokenarray, TOK_DEFAULT )) != 0 )
#else
if ( Token_Count = Tokenize( CurrSource, 0, ModuleInfo.tokenarray, TOK_DEFAULT ) )
if ( (Token_Count = Tokenize( CurrSource, 0, ModuleInfo.tokenarray, TOK_DEFAULT )) != 0 )
#endif
ParseLine( ModuleInfo.tokenarray );
LineStoreCurr = LineStoreCurr->next;

16
bin.c
View File

@ -484,7 +484,7 @@ static ret_code DoFixup( struct dsym *curr, struct calc_param *cp )
/* check if symbol's segment name contains a '$'.
* If yes, search the segment without suffix.
*/
if ( tmp = strchr( seg->sym.name, '$' ) ) {
if ( (tmp = strchr( seg->sym.name, '$' )) != NULL ) {
int namlen = tmp - seg->sym.name;
struct dsym *segfirst;
for( segfirst = SymTables[TAB_SEG].head; segfirst; segfirst = segfirst->next ) {
@ -1011,7 +1011,7 @@ static void pe_emit_import_data( void )
}
/* avoid . in IDs */
if ( pdot = strchr( p->name, '.') )
if ( (pdot = strchr( p->name, '.')) != NULL )
*pdot = '_';
/* import directory entry */
@ -1432,13 +1432,13 @@ static void pe_set_values( struct calc_param *cp )
#endif
/* set export directory data dir value */
if ( curr = (struct dsym *)SymSearch( edataname ) ) {
if ( (curr = (struct dsym *)SymSearch( edataname )) != NULL ) {
datadir[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress = curr->e.seginfo->start_offset;
datadir[IMAGE_DIRECTORY_ENTRY_EXPORT].Size = curr->sym.max_offset;
}
/* set import directory and IAT data dir value */
if ( curr = (struct dsym *)SymSearch( ".idata$" IMPDIRSUF ) ) {
if ( (curr = (struct dsym *)SymSearch( ".idata$" IMPDIRSUF )) != NULL ) {
struct dsym *idata_null;
struct dsym *idata_iat;
uint_32 size;
@ -1452,13 +1452,13 @@ static void pe_set_values( struct calc_param *cp )
}
/* set resource directory data dir value */
if ( curr = (struct dsym *)SymSearch(".rsrc") ) {
if ( (curr = (struct dsym *)SymSearch(".rsrc")) != NULL ) {
datadir[IMAGE_DIRECTORY_ENTRY_RESOURCE].VirtualAddress = curr->e.seginfo->start_offset;
datadir[IMAGE_DIRECTORY_ENTRY_RESOURCE].Size = curr->sym.max_offset;
}
/* set relocation data dir value */
if ( curr = (struct dsym *)SymSearch(".reloc") ) {
if ( (curr = (struct dsym *)SymSearch(".reloc")) != NULL ) {
datadir[IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress = curr->e.seginfo->start_offset;
datadir[IMAGE_DIRECTORY_ENTRY_BASERELOC].Size = curr->sym.max_offset;
}
@ -1466,14 +1466,14 @@ static void pe_set_values( struct calc_param *cp )
/* fixme: TLS entry is not written because there exists a segment .tls, but
* because a _tls_used symbol is found ( type: IMAGE_THREAD_DIRECTORY )
*/
if ( curr = (struct dsym *)SymSearch(".tls") ) {
if ( (curr = (struct dsym *)SymSearch(".tls")) != NULL ) {
datadir[IMAGE_DIRECTORY_ENTRY_TLS].VirtualAddress = curr->e.seginfo->start_offset;
datadir[IMAGE_DIRECTORY_ENTRY_TLS].Size = curr->sym.max_offset;
}
#if AMD64_SUPPORT
if ( ModuleInfo.defOfssize == USE64 ) {
if ( curr = (struct dsym *)SymSearch( ".pdata" ) ) {
if ( (curr = (struct dsym *)SymSearch( ".pdata" )) != NULL ) {
datadir[IMAGE_DIRECTORY_ENTRY_EXCEPTION].VirtualAddress = curr->e.seginfo->start_offset;
datadir[IMAGE_DIRECTORY_ENTRY_EXCEPTION].Size = curr->sym.max_offset;
}

4
coff.c
View File

@ -1250,7 +1250,7 @@ static void coff_create_drectve( struct module_info *modinfo, struct coffmod *cm
imp != NULL ||
#endif
exp != NULL ) {
if ( cm->directives = (struct dsym *)CreateIntSegment( szdrectve, "", MAX_SEGALIGNMENT, modinfo->Ofssize, FALSE ) ) {
if ( (cm->directives = (struct dsym *)CreateIntSegment( szdrectve, "", MAX_SEGALIGNMENT, modinfo->Ofssize, FALSE )) != NULL ) {
struct dsym *tmp;
int size = 0;
struct qitem *q;
@ -1421,7 +1421,7 @@ static ret_code coff_write_module( struct module_info *modinfo )
if ( modinfo->g.SafeSEHQueue.head ) {
struct qnode *sehp;
unsigned cnt = 0;
if ( cm.sxdata = (struct dsym *)CreateIntSegment( ".sxdata", "", MAX_SEGALIGNMENT, modinfo->Ofssize, FALSE ) ) {
if ( (cm.sxdata = (struct dsym *)CreateIntSegment( ".sxdata", "", MAX_SEGALIGNMENT, modinfo->Ofssize, FALSE )) != NULL ) {
cm.sxdata->e.seginfo->info = TRUE;
/* calc the size for this segment */
for( sehp = modinfo->g.SafeSEHQueue.head; sehp ; sehp = sehp->next, cnt++ );

View File

@ -1053,7 +1053,7 @@ void cv_write_debug_tables( struct dsym *symbols, struct dsym *types, void *pv )
/* scan symbol table for types */
sym = NULL;
while ( sym = SymEnum( sym, &i ) ) {
while ( (sym = SymEnum( sym, &i )) != NULL ) {
if ( sym->state == SYM_TYPE && sym->typekind != TYPE_TYPEDEF && sym->cvtyperef == 0 ) {
/**/myassert( cv.currtype >= 0x1000 ); /* check for overflow */
cv_write_type( &cv, sym );
@ -1063,7 +1063,7 @@ void cv_write_debug_tables( struct dsym *symbols, struct dsym *types, void *pv )
/* scan symbol table for SYM_TYPE, SYM_INTERNAL */
sym = NULL;
while ( sym = SymEnum( sym, &i ) ) {
while ( (sym = SymEnum( sym, &i )) != NULL ) {
switch ( sym->state ) {
case SYM_TYPE: /* may create an S_UDT entry in the symbols table */
if ( Options.debug_ext < CVEX_NORMAL ) /* v2.10: no UDTs for -Zi0 and -Zi1 */

View File

@ -257,7 +257,7 @@ ret_code IncBinDirective( int i, struct asm_tok tokenarray[] )
DebugMsg1(("IncBinDirective: filename=%s, offset=%" I32_SPEC "u, size=%" I32_SPEC "u\n", StringBufferEnd, fileoffset, sizemax ));
/* try to open the file */
if ( file = SearchFile( StringBufferEnd, FALSE ) ) {
if ( (file = SearchFile( StringBufferEnd, FALSE )) != NULL ) {
/* transfer file content to the current segment. */
if ( fileoffset )
fseek( file, fileoffset, SEEK_SET ); /* fixme: use fseek64() */

View File

@ -261,7 +261,7 @@ ret_code EqualSgnDirective( int i, struct asm_tok tokenarray[] )
if( tokenarray[0].token != T_ID ) {
return( EmitErr( SYNTAX_ERROR_EX, tokenarray[0].string_ptr ) );
}
if ( sym = CreateAssemblyTimeVariable( tokenarray ) ) {
if ( (sym = CreateAssemblyTimeVariable( tokenarray )) != NULL ) {
if ( ModuleInfo.list == TRUE ) {
LstWrite( LSTTYPE_EQUATE, 0, sym );
}
@ -512,7 +512,7 @@ ret_code EquDirective( int i, struct asm_tok tokenarray[] )
return( EmitErr( SYNTAX_ERROR_EX, tokenarray[0].string_ptr ) );
}
DebugMsg1(("EquDirective(%s): calling CreateConstant\n", tokenarray[0].string_ptr ));
if ( sym = CreateConstant( tokenarray ) ) {
if ( (sym = CreateConstant( tokenarray )) != NULL ) {
/**/myassert( sym->state == SYM_INTERNAL ); /* must not be a text macro */
if ( ModuleInfo.list == TRUE ) {
LstWrite( LSTTYPE_EQUATE, 0, sym );

View File

@ -437,7 +437,7 @@ int RunMacro( struct dsym *macro, int idx, struct asm_tok tokenarray[], char *ou
* text macros are expanded only selectively
*/
if ( tokenarray[idx].token == T_ID ) {
if ( sym = SymSearch( tokenarray[idx].string_ptr ) ) {
if ( (sym = SymSearch( tokenarray[idx].string_ptr )) != NULL ) {
if ( sym->state == SYM_MACRO && sym->isdefined == TRUE &&
sym->isfunc == TRUE && tokenarray[idx+1].token == T_OP_BRACKET ) {
bool is_exitm2;

View File

@ -918,7 +918,7 @@ ret_code PublicDirective( int i, struct asm_tok tokenarray[] )
sym = SymSearch( token );
if ( Parse_Pass == PASS_1 ) {
if ( sym == NULL ) {
if ( sym = SymCreate( token ) ) {
if ( (sym = SymCreate( token )) != NULL ) {
sym_add_table( &SymTables[TAB_UNDEF], (struct dsym *)sym );
DebugMsg1(("PublicDirective(%s): new symbol\n", sym->name ));
} else

4
hll.c
View File

@ -569,7 +569,7 @@ static void ReplaceLabel( char *p, uint_32 olabel, uint_32 nlabel )
i = strlen( newlbl );
DebugMsg1(("%u ReplaceLabel(%s->%s, >%s<)\n", evallvl, oldlbl, newlbl, p ));
while ( p = strstr( p, oldlbl ) ) {
while ( (p = strstr( p, oldlbl )) != NULL ) {
memcpy( p, newlbl, i );
p += i;
}
@ -737,7 +737,7 @@ static ret_code QueueTestLines( char *src )
while ( src ) {
//if (*src == ' ') src++; /* v2.11: obsolete */
start = src;
if ( src = strchr( src, EOLCHAR ) )
if ( (src = strchr( src, EOLCHAR )) != NULL )
*src++ = NULLC;
if ( *start )
AddLineQueue( start );

View File

@ -631,7 +631,7 @@ FILE *SearchFile( const char *path, bool queue )
*/
memcpy( fullpath, src, i );
strcpy( fullpath + i, path );
if ( file = fopen( fullpath, "rb" ) ) {
if ( (file = fopen( fullpath, "rb" )) != NULL ) {
DebugMsg1(("SearchFile(): file found, fopen(%s)=%X\n", fullpath, file ));
path = fullpath;
}
@ -653,7 +653,7 @@ FILE *SearchFile( const char *path, bool queue )
* and NO absolute path is given, then search include dirs
*/
if( file == NULL && ModuleInfo.g.IncludePath != NULL && !isabs ) {
if ( file = open_file_in_include_path( path, fullpath ) ) {
if ( (file = open_file_in_include_path( path, fullpath )) != NULL ) {
DebugMsg1(("SearchFile(): open_file_in_include_path(%s)=%X [%s]\n", path, file, fullpath ));
path = fullpath;
}

View File

@ -637,7 +637,7 @@ static int watc_param( struct dsym const *proc, int index, struct dsym *param, b
if ( reg[1] != NULL ) {
char buffer[128];
short sreg;
if ( sreg = GetSegmentPart( opnd, buffer, paramvalue ) )
if ( (sreg = GetSegmentPart( opnd, buffer, paramvalue )) != 0 )
AddLineQueueX( "%r %s, %r", T_MOV, reg[0], sreg );
else
AddLineQueueX( "%r %s, %s", T_MOV, reg[0], buffer );

View File

@ -267,7 +267,7 @@ ret_code LabelDirective( int i, struct asm_tok tokenarray[] )
LstWrite( LSTTYPE_LABEL, 0, NULL );
/* v2.08: if label is a DATA label, set total_size and total_length */
if ( sym = CreateLabel( tokenarray[0].string_ptr, ti.mem_type, &ti, FALSE ) ) {
if ( (sym = CreateLabel( tokenarray[0].string_ptr, ti.mem_type, &ti, FALSE )) != NULL ) {
DebugMsg1(("LabelDirective(%s): label created, memtype=%Xh size=%u\n", sym->name, sym->mem_type, ti.size ));
/* sym->isdata must be 0, else the LABEL directive was generated within data_item()
* and fields total_size & total_length must not be modified then!

View File

@ -209,7 +209,7 @@ static int store_placeholders( char *line, struct mname_list *mnames )
substprf = ( ( start > line && *(start-1) == '&') || *p == '&' );
if ( quote == NULLC || substprf ) {
/* look for this word in the macro parms, and replace it if it is */
if ( start = replace_parm( line, start, p - start, mnames ) ) {
if ( (start = replace_parm( line, start, p - start, mnames )) != NULL ) {
params++;
p = start;
}
@ -605,7 +605,7 @@ struct dsym *CreateMacro( const char *name )
/******************************************/
{
struct dsym *macro;
if ( macro = (struct dsym *)SymCreate( name ) ) {
if ( (macro = (struct dsym *)SymCreate( name )) != NULL ) {
macro->sym.state = SYM_MACRO;
macro->e.macroinfo = LclAlloc( sizeof( struct macro_info ) );
macro->e.macroinfo->parmcnt = 0;

2
omf.c
View File

@ -1532,7 +1532,7 @@ static void omf_write_header_dbgcv( void )
AttachData( &obj, "\001CV", 3 );
omf_write_record( &obj );
for ( i = 0; i < DBGS_MAX; i++ ) {
if ( SymDebSeg[i] = (struct dsym *)CreateIntSegment( SymDebParm[i].name, SymDebParm[i].cname, 0, USE32, TRUE ) ) {
if ( (SymDebSeg[i] = (struct dsym *)CreateIntSegment( SymDebParm[i].name, SymDebParm[i].cname, 0, USE32, TRUE )) != NULL ) {
SymDebSeg[i]->e.seginfo->force32 = TRUE; /* without this a 32-bit segdef is emitted only if segsize > 64kB */
SymDebSeg[i]->e.seginfo->flushfunc = omf_cv_flushfunc;
}

View File

@ -2922,7 +2922,7 @@ ret_code ParseLine( struct asm_tok tokenarray[] )
return( data_dir( i, tokenarray, NULL ) );
case T_ID:
DebugMsg1(("ParseLine: T_ID >%s<\n", tokenarray[i].string_ptr ));
if( sym = IsType( tokenarray[i].string_ptr ) ) {
if( (sym = IsType( tokenarray[i].string_ptr )) != NULL ) {
return( data_dir( i, tokenarray, sym ) );
}
break;

View File

@ -154,7 +154,7 @@ int PreprocessLine( char *line, struct asm_tok tokenarray[] )
* handle it in ANY case and if it defines a number, the line
* must be stored and, if -EP is set, written to stdout.
*/
if ( sym = CreateConstant( tokenarray ) ) {
if ( (sym = CreateConstant( tokenarray )) != NULL ) {
if ( sym->state != SYM_TMACRO ) {
#if FASTPASS
if ( StoreState ) FStoreLine( 0 );

View File

@ -477,7 +477,7 @@ ret_code SizeStrDir( int i, struct asm_tok tokenarray[] )
//sizestr = GetLiteralValue( StringBufferEnd, tokenarray[2].string_ptr );
sizestr = tokenarray[2].stringlen;
if ( sym = CreateVariable( tokenarray[0].string_ptr, sizestr ) ) {
if ( (sym = CreateVariable( tokenarray[0].string_ptr, sizestr )) != NULL ) {
DebugMsg1(("SizeStrDir(%s) exit, value=%u\n", tokenarray[0].string_ptr, sizestr));
LstWrite( LSTTYPE_EQUATE, 0, sym );
return( NOT_ERROR );
@ -585,7 +585,7 @@ ret_code InStrDir( int i, struct asm_tok tokenarray[] )
if ( ( start > 0 ) && ( sizestr >= j ) && j && ( string1 = strstr( p, q ) ))
strpos = string1 - src + 1;
if ( sym = CreateVariable( tokenarray[0].string_ptr, strpos ) ) {
if ( (sym = CreateVariable( tokenarray[0].string_ptr, strpos )) != NULL ) {
DebugMsg1(("InStrDir(%s) exit, value=%u\n", tokenarray[0].string_ptr, strpos));
LstWrite( LSTTYPE_EQUATE, 0, sym );
return ( NOT_ERROR );

View File

@ -101,13 +101,13 @@ struct asym *SearchNameInStruct( const struct asym *tstruct, const char *name, u
if ( *( fl->sym.name ) == NULLC ) {
/* there are 2 cases: an anonymous inline struct ... */
if ( fl->sym.state == SYM_TYPE ) {
if ( sym = SearchNameInStruct( &fl->sym, name, poffset, level ) ) {
if ( (sym = SearchNameInStruct( &fl->sym, name, poffset, level )) != NULL ) {
*poffset += fl->sym.offset;
break;
}
/* or an anonymous structured field */
} else if ( fl->sym.mem_type == MT_TYPE ) {
if ( sym = SearchNameInStruct( fl->sym.type, name, poffset, level ) ) {
if ( (sym = SearchNameInStruct( fl->sym.type, name, poffset, level )) != NULL ) {
*poffset += fl->sym.offset;
break;
}