From 3b4ec5258f23df47c3783d47bee256f33f2914df Mon Sep 17 00:00:00 2001 From: "Ilya V. Matveychikov" Date: Thu, 30 Jul 2015 19:11:43 +0300 Subject: [PATCH] Fix notes produced by clang compiler note: use '==' to turn this assignment into an equality comparison --- assemble.c | 6 +++--- bin.c | 16 ++++++++-------- coff.c | 4 ++-- dbgcv.c | 4 ++-- directiv.c | 2 +- equate.c | 4 ++-- expans.c | 2 +- extern.c | 2 +- hll.c | 4 ++-- input.c | 4 ++-- invoke.c | 2 +- label.c | 2 +- macro.c | 4 ++-- omf.c | 2 +- parser.c | 2 +- preproc.c | 2 +- string.c | 4 ++-- types.c | 4 ++-- 18 files changed, 35 insertions(+), 35 deletions(-) diff --git a/assemble.c b/assemble.c index 638e35c..c0720cf 100644 --- a/assemble.c +++ b/assemble.c @@ -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; diff --git a/bin.c b/bin.c index 904cc8d..45d54c6 100644 --- a/bin.c +++ b/bin.c @@ -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; } diff --git a/coff.c b/coff.c index 2fbef6a..6a5b69b 100644 --- a/coff.c +++ b/coff.c @@ -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++ ); diff --git a/dbgcv.c b/dbgcv.c index de855db..a1ea0ec 100644 --- a/dbgcv.c +++ b/dbgcv.c @@ -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 */ diff --git a/directiv.c b/directiv.c index 1543b1f..32b3387 100644 --- a/directiv.c +++ b/directiv.c @@ -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() */ diff --git a/equate.c b/equate.c index 1834ffe..b4b4b61 100644 --- a/equate.c +++ b/equate.c @@ -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 ); diff --git a/expans.c b/expans.c index 47f2bf5..489a2a4 100644 --- a/expans.c +++ b/expans.c @@ -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; diff --git a/extern.c b/extern.c index 63dd855..a7db65d 100644 --- a/extern.c +++ b/extern.c @@ -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 diff --git a/hll.c b/hll.c index 343ba82..c757120 100644 --- a/hll.c +++ b/hll.c @@ -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 ); diff --git a/input.c b/input.c index 4d8c743..711e9d7 100644 --- a/input.c +++ b/input.c @@ -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; } diff --git a/invoke.c b/invoke.c index 3377c07..5353675 100644 --- a/invoke.c +++ b/invoke.c @@ -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 ); diff --git a/label.c b/label.c index 268a575..41a1f04 100644 --- a/label.c +++ b/label.c @@ -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! diff --git a/macro.c b/macro.c index 4114b2e..259d907 100644 --- a/macro.c +++ b/macro.c @@ -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; diff --git a/omf.c b/omf.c index 1387633..8210a4e 100644 --- a/omf.c +++ b/omf.c @@ -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; } diff --git a/parser.c b/parser.c index 2fa5b3d..87f95f8 100644 --- a/parser.c +++ b/parser.c @@ -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; diff --git a/preproc.c b/preproc.c index 0ec985b..cea7db2 100644 --- a/preproc.c +++ b/preproc.c @@ -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 ); diff --git a/string.c b/string.c index 3639bb5..dff830f 100644 --- a/string.c +++ b/string.c @@ -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 ); diff --git a/types.c b/types.c index c77c4f8..7691630 100644 --- a/types.c +++ b/types.c @@ -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; }