The MASM Forum

64 bit assembler => UASM Assembler Development => Topic started by: Biterider on June 20, 2018, 05:26:34 AM

Title: Symbol not defined
Post by: Biterider on June 20, 2018, 05:26:34 AM
Hi
I want to report a long-standing error reporting problem which is the "Error A2102: Symbol not defined: ...", that reports an incorrect file & line number.
It reports one of the project files and a non-existent line number.
I would expect it to indicate the file and line number where an unspecified symbol occurred.

It is not urgent but annoying  ::)

Biterider
Title: Re: Symbol not defined
Post by: habran on June 20, 2018, 07:54:13 AM
Can you provide a source file which is causing that error?
Title: Re: Symbol not defined
Post by: Biterider on June 20, 2018, 07:07:37 PM
Hi Habran
I will prepare a test case by this weekend.
Biterider
Title: Re: Symbol not defined
Post by: habran on June 20, 2018, 07:37:58 PM
 8)
Title: Re: Symbol not defined
Post by: Biterider on June 22, 2018, 04:52:17 PM
Hi
Short update: I created a small project of 8 files, where one includes the next. Since I could not trigger the described problem, I went back to a more complex project and found that the line number correct but not the filename.
Maybe that helps a bit  ;)
I will try different things with the test case.

Biterider
Title: Re: Symbol not defined
Post by: habran on June 22, 2018, 05:34:27 PM
Keep up good job :t
Are you using the modified exe or normal one?
Try to switch them.
Title: Re: Symbol not defined
Post by: HSE on June 22, 2018, 11:55:59 PM
Hi!
We have talked about the same before. It's a jwasm problem. Nidud solved for AsmC exactly a year ago.
.  Bad file names in errors messages.   (http://masm32.com/board/index.php?topic=6342.0)
Title: Re: Symbol not defined
Post by: habran on June 23, 2018, 02:32:29 PM
Thanks HSE :t
I have implemented that in attached UASM.
Biterider, try if it fixes that problem. It is still with #IF fix.
Title: Re: Symbol not defined
Post by: Biterider on June 23, 2018, 03:07:18 PM
Hi
Perfect, the bug is gone  :eusa_dance:
Thanks everybody!

Biterider
Title: Re: Symbol not defined
Post by: LiaoMi on June 29, 2018, 01:21:02 AM
Quote from: habran on June 23, 2018, 02:32:29 PM
Thanks HSE :t
I have implemented that in attached UASM.
Biterider, try if it fixes that problem. It is still with #IF fix.

Hi habran,

is it possible to publish a revised version, where the "Symbol is not defined" already fixed, but without editing the conditions for "IF".

Many thanks in advance  :P
Title: Re: Symbol not defined
Post by: Biterider on June 29, 2018, 02:43:50 AM
Hi LiaoMi
Did you have a problem with the "#if" hack? This could be important to know to understand a possible compatibility issue.

Biterider
Title: Re: Symbol not defined
Post by: habran on June 29, 2018, 05:06:20 AM
The release version of UASM.exe posted above is with fix for #if, affecting only if 0 and, which is safe and should be rejected with masm as well.
IF defined(SYMBOL) and (SYMBOL ge 1020) gets converted in first pass to IF 0 and (SYMBOL ge 1020) if SYMBOL is not defined and IF 1 and (SYMBOL ge 1020) if SYMBOL is defined.
There are some other small fixes included. Use this one until Johnsa build and upload it on GIT and terrspace.
Title: Re: Symbol not defined
Post by: LiaoMi on June 29, 2018, 06:06:10 PM
Quote from: Biterider on June 29, 2018, 02:43:50 AM
Hi LiaoMi
Did you have a problem with the "#if" hack? This could be important to know to understand a possible compatibility issue.

Biterider

Hi Biterider, habran, 

there are no problems, I was just worried about compatibility  :icon_rolleyes: this desire have no compelling reasons.

Quote from: habran on June 29, 2018, 05:06:20 AM
The release version of UASM.exe posted above is with fix for #if, affecting only if 0 and, which is safe and should be rejected with masm as well.
IF defined(SYMBOL) and (SYMBOL ge 1020) gets converted in first pass to IF 0 and (SYMBOL ge 1020) if SYMBOL is not defined and IF 1 and (SYMBOL ge 1020) if SYMBOL is defined.
There are some other small fixes included. Use this one until Johnsa build and upload it on GIT and terrspace.

Thanks for the explanation  :t
Title: Re: Symbol not defined
Post by: Biterider on July 01, 2018, 06:10:04 PM
Hi
Finally I found a workable solution. It's ugly, but it works on ML and the unmodified version of UASM.
As an example, the original translation of basetsd.h shows the following code section:

if (defined(__midl) and (501 lt __midl))
  INT_PTR typedef SDWORD
  ...
else
  if defined(_WIN64)
    INT_PTR typedef QWORD
    ...
  else
    INT_PTR typedef _W64
    ...
  endif
endif

Now, as we know, if "__midl" is not defined, we have a problem on the first line, since the second condition is evaluated, regadles of the result of the first.
The solution is the split the "if" conditional sentence. In this case we will need 2 consecutive nested conditional sentences.
To restore the logic of the "else" clause, I introduce an additional symbol (??AND_xxx), that is only used for that purpose. To recycle it, it has to be resetted at the begining.
Now, it looks like:

??AND_001 = 0
if defined(__midl)
  if 501 lt __midl
    INT_PTR typedef SDWORD
    ...
  else
    ??AND_001 = 1
  endif
else
  ??AND_001 = 1
endif

if ??AND_001 eq 1
  if defined(_WIN64)
    INT_PTR typedef QWORD
    ...
  else
    INT_PTR typedef _W64
    ...
  endif
endif


Regards, Biterider
Title: Re: Symbol not defined
Post by: LiaoMi on July 01, 2018, 06:23:50 PM
Hi Biterider,

brilliant solution  :t how did you come to this option ?! In this case, you can control the parameters as its done in cmake, a single list of such variables is required, I dont know if this list is needed at all  :biggrin: but such a macro implementation is very convenient  :eusa_clap:
Title: Re: Symbol not defined
Post by: habran on July 01, 2018, 08:53:41 PM
Ausgezeichnet Biterider :t
Hoever, I'll keep that hack, I like it there  8)

I have added  Options.strict_masm_compat if someone insist to keep that stupid error there ;)