Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Macro contents detection #50

Closed
Y-Less opened this issue Mar 30, 2015 · 7 comments
Closed

Macro contents detection #50

Y-Less opened this issue Mar 30, 2015 · 7 comments

Comments

@Y-Less
Copy link
Member

Y-Less commented Mar 30, 2015

This:

#define A%0\10;%1 B
#define B%0B C

A

When compiled with "-l" produces "C". My understanding of the pre-processor is that it should produce just "B"...

@Y-Less
Copy link
Member Author

Y-Less commented Mar 30, 2015

I played with a few methods, it is the "\10;" that causes it, somehow... I actually saw the same bug years ago in fixes.inc, but didn't put the two together:

https://github.com/Y-Less/sa-mp-fixes/blob/90f0e9ba42f8afc7f41241bb1521058bbcf6d9b4/fixes.inc#L8128-L8140

@Y-Less
Copy link
Member Author

Y-Less commented Apr 3, 2015

Also possibly related:

#define stock%0\n;%9 stock%0 __stock$
#define iterfunc%0(%1) %0(%1) TYPES:
#define TYPES:%0$ TYPES:

stock iterfunc A(b)
{
}

That hangs the compiler, I don't think it should. My expected output is:

Match stock:

stock iterfunc A(b) __stock${
}

Match iterfunc:

stock A(b) TYPES: __stock${
}

Match TYPES:

stock A(b) TYPES:{
}

No matches left. But it just hangs.

@oscar-broman
Copy link
Contributor

Not sure if it helps, but this is what my macro debugger spits out:

SUBST(test.pwn): 5.0-20 = (28) stock iterfunc A(b) __stock$
SUBST(test.pwn): 5.6-19 = (12)  A(b) TYPES:
SUBST(test.pwn): 5.12-27 = (6) TYPES:
SUBST(test.pwn): 5.12-18 = (6) TYPES:
SUBST(test.pwn): 5.12-18 = (6) TYPES:
SUBST(test.pwn): 5.12-18 = (6) TYPES:
SUBST(test.pwn): 5.12-18 = (6) TYPES:
etc..

BTW, maybe a feature could be added to check if a macro replaces into the same thing then throw an error.

@Y-Less
Copy link
Member Author

Y-Less commented Apr 3, 2015

I really wanted your stepper, but it wasm't online. Thanks - that is clearly wrong.

@oscar-broman
Copy link
Contributor

Yeah sorry about that. I've been meaning to improve this and create a pull request here.

@Y-Less
Copy link
Member Author

Y-Less commented Apr 3, 2015

OK, I would love to see how much junk gets spit out using that on the YSI test script!

@Zeex Zeex added the bug label Apr 10, 2015
@Southclaws Southclaws removed the bug label Jan 4, 2018
@Southclaws
Copy link
Collaborator

When compiled with "-l" produces "C"

Could this be related to the how -l produces inaccurate results? I remember you brought it up recently.

Gonna close this with "stale" for now as it's either fixed or not a huge problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants