diff --git a/History.txt b/History.txt index 38d49a9..51f63cf 100644 --- a/History.txt +++ b/History.txt @@ -1,7 +1,7 @@ Changelog - __.__.2022, v2.16: + 14.11.2022, v2.16: Bugfixes: - format mz: in the binary map of listings, the RVA of segments belonging @@ -51,6 +51,8 @@ 0x140000000 for PE64 exes, 0x180000000 for PE64 dlls (MS link compat). - error 2058 ( "magnitude of offset exceeds 16-bit" ) changed to a warning ( level 3 ); see offset15.asm & offset16.asm. + - if option -Zg is on, OPATTR is to return language bits for procs/protos + only; see opattr10.asm. 09.04.2022, v2.15: diff --git a/src/data.c b/src/data.c index b83276c..ee946ee 100644 --- a/src/data.c +++ b/src/data.c @@ -1289,7 +1289,8 @@ ret_code data_dir( int i, struct asm_tok tokenarray[], struct asym *type_sym ) #if 1 /* v2.11: Set the symbol's langtype. It may have been set * by a PUBLIC directive, so take care not to overwrite it. - * Problem: Masm doesn't do this - might be a bug. + * Problem: Masm doesn't do this - might be a bug, but it + * affects return value of OPATTR. */ if ( sym->langtype == LANG_NONE ) sym->langtype = ModuleInfo.langtype; diff --git a/src/expreval.c b/src/expreval.c index a6172d5..f962a19 100644 --- a/src/expreval.c +++ b/src/expreval.c @@ -1302,6 +1302,8 @@ enum opattr_bits { /* * T_DOT_TYPE: implement .TYPE as an alias for OPATTR * T_OPATTR: + * compatibility: Masm (tested v6-9) sets the language bits ( bits 8-10 ) + * for PROCs only, not for labels ( even if they are declared public with language attribute ) */ static ret_code opattr_op( int oper, struct expr *opnd1, struct expr *opnd2, struct asym *sym, char *name ) /*********************************************************************************************************/ @@ -1391,8 +1393,11 @@ static ret_code opattr_op( int oper, struct expr *opnd1, struct expr *opnd2, str if ( oper == T_OPATTR ) /* v2.12: no language if symbol isn't defined properly */ //if ( opnd2->sym ) - if ( opnd2->sym && opnd2->kind != EXPR_ERROR ) - opnd1->value |= opnd2->sym->langtype << 8; + if ( opnd2->sym && opnd2->kind != EXPR_ERROR ) { + /* v2.16: for Masm compatible code generation (-Zg), language must only be set if isproc=true */ + if ( opnd2->sym->isproc || ( Options.masm_compat_gencode == FALSE ) ) + opnd1->value |= opnd2->sym->langtype << 8; + } DebugMsg1(("opattr_op returns %Xh\n", opnd1->value)); return( NOT_ERROR );