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
Operator __pragma
#526
Operator __pragma
#526
Conversation
That's a good solution to multiple properties. |
Why didn't you reuse the existing |
Because the code for
... , I had to make the compiler memoize the specified attributes, so they could be applied to the symbol later - the most obvious solution was to store bit flags into a global variable.
Thus the only thing left to reuse is the code responsible for applying the attributes to symbols (which isn't really that much of code), which could be moved into separate reusable functions: SC_FUNC void pragma_unused(symbol *sym, int unread, int unwritten)
{
sym->usage |= unwritten ? 0 : uREAD;
if (sym->ident == iVARIABLE || sym->ident == iREFERENCE
|| sym->ident == iARRAY || sym->ident == iREFARRAY)
sym->usage |= unread ? 0 : uWRITTEN;
}
SC_FUNC void pragma_nodestruct(symbol *sym)
{
if (sym->ident==iVARIABLE || sym->ident==iARRAY)
sym->usage |= uNODESTRUCT;
} |
That makes sense. |
Done, moved the code for While I was at it, I also fixed a potential memory leak in |
This issue has been automatically marked as stale because it has not had recent activity. |
I've merged this, but it would be nice if it were possible to use Func()
{
__pragma("naked");
} |
Done. NakedFunc()
{
__pragma("naked", "deprecated - use NakedFunc2() instead");
} |
Oh, I just discovered that |
The tests don't really cover that, but they're only testing compiler warnings. Is that actually correct? |
If by "that" you mean all other attributes not being tested inside functions, then I think it might unnecessarily bloat the tests. As you can see it in ab66969, the only difference is in the code that calls functions |
Let me rephrase: I just discovered that I was just talking about |
Ah, so that's what you meant. EDIT: OK, done: #571. |
What this PR does / why we need it:
This PR implements operator
__pragma
(see #267).Currently available options:
deprecated
unused
unread
unwritten
nodestruct
naked
Examples of use:
Which issue(s) this PR fixes:
Fixes #267
What kind of pull this is:
Additional Documentation: