Bug 174 - Macros defined in one file and called from another with errors in their definitions
Summary: Macros defined in one file and called from another with errors in their defin...
Alias: None
Product: RMAC
Classification: Unclassified
Component: Core (show other bugs)
Version: unspecified
Hardware: All All
: Normal normal
Assignee: Shamus Hammons
Depends on:
Reported: 2020-09-02 14:48 CDT by ggn
Modified: 2021-06-08 20:50 CDT (History)
1 user (show)

See Also:

Ugh! (3.74 KB, patch)
2020-09-02 14:50 CDT, ggn

Note You need to log in before you can comment on or make changes to this bug.
Description ggn 2020-09-02 14:48:26 CDT
tl;dr, a macro like this:

    .macro lol
    abcd d0,d1
    add d0,d0
    lolol.l #1,d0

when invoked from the same file it is defined, it will report the error line and filename correctly. But when called from a different file, it reports the macro's line correctly but displays the current filename. D'oh!

This required quite a big of jiggling to get working. I thought it'd be really easy but the way macros are defined (i.e. SYM) made it not that trivial. Also sadly I had to add yet another member to SYM type, but it is what it is - I couldn't find an easier way to do it.

I'd be gladly proven wrong though :)
Comment 1 ggn 2020-09-02 14:50:23 CDT
Created attachment 148 [details]
Comment 2 ggn 2020-09-03 13:42:46 CDT
So actually this is a continuation of bug #50 - tomb raidering!
Comment 3 ggn 2020-10-11 07:31:56 CDT
So after speaking to a couple of people about this, we agreed that what should happen when a macro errors out is to report the erroneous line of the macro, as well as the caller site. This can help tremendously if one is trying to suss out errors from invalid macro invocation. Plus, you can never have too much helping info, right? :)

I'm really not very confident in submitting a new patch because my dev folder is a bit messy, but if the above patch is applied and the sprintf replaced with the following, we should be fine.

			sprintf(buf1, "%s %d: Error: %s\nCalled from: %s %d\n", filename, cur_inobj->inobj.imacro->im_macro->lineList->lineno, buf,
			curfname, curlineno);
Comment 4 Shamus Hammons 2021-06-08 20:50:43 CDT
This really isn't all that bad, considering.  :-)  Thanks for the patch!