-
Notifications
You must be signed in to change notification settings - Fork 72
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
Fixes for function and variable declarations #631
base: dev
Are you sure you want to change the base?
Conversation
5041af0
to
14009f6
Compare
Those missing specifier rules are causing YSI to stop building. I know I usually say that breaking YSI isn't a blocker for new compiler versions because it does a lot of silly things, but I'm not entirely sure this is a silly thing. If a forward declaration has MAKE_STOCK(func);
func()
{
} |
…unction declarations
…les whose name starts with `@`
…ions and repeated declarations if previous declaration(s) had those specifiers
…on the next pass "forward" declarations won't be required to have those specifiers at first
… function has already been defined
…ion declarations/definitions. Also rename "uSTATIC" into "uDECLSTATIC".
…of other arguments
…he class specifiers and `__pragma`
This fixes a bug with `__pragma` being expected twice in certain cases.
This fixes another bug with `__pragma` being expected twice in variable declarations starting with specifiers `public`, `static` and `stock`.
…n forward declarations
…d in one of function declarations
…clarations Example: Func(){} forward stock Func();
Hmm... haven't seen such non-trivial application of keyword EDIT: OK, done. Also rebased the changes to the current |
fd5b254
to
3f762c7
Compare
This issue has been automatically marked as stale because it has not had recent activity. |
To clarify why I added this new requirement for class specifiers in function implementations, my main concern was that in 3.10.10 (without this PR) class specifiers either had no effect in function declarations (see #624) or could even make the compiler generate invalid code (#621), so this new requirement was supposed to point users at the parts of their code that could cause problems in compiler versions up to 3.10.10. @Y-Less I already removed that rule for specifier |
…he function has already been defined
I'm actually not sure what the most sensible result is here. It seems there are equally good arguments for "all specifiers are additive", so this declares a forward static Func();
forward stock Func();
Func()
{
} "all specifiers must build", so only this is valid: forward static Func();
forward static stock Func();
static stock Func()
{
} "only the definition has specifiers": forward Func();
forward Func();
static stock Func()
{
} In that I don't think any one of them is obviously more "correct" than the others. Having said that, I'd vote for the first one as it gives the most options. Regardless of which is chosen the rule should be applied evenly to |
There is another option - remove old-style declarations, but that's a bigger change. |
Or rahter that's a breaking change. |
…ired in following function re-declarations or definition
…n is already defined
…ier is introduced in its own function declaration or definition, e.g.: ``` forward static Func(); forward public Func(); ```
…nd its name starts with `@`
8c42de8
to
8a9d5cc
Compare
What this PR does / why we need it:
This PR does the following:
static stock
/stock static
in new-style function declarations (see Combination ofstatic
andstock
specifiers not allowed in function declarations #622).static
variables with a name starting with@
(see Assertion failure when defining a static global variable with a name starting with@
#623).static
on variables whose name starts with@
as an invalid combination of class specifiers (see No errors when usingstock
on a variable with a name starting with@
#625).public
specifier only in its declaration #621,static
specifier has no effect when only used in function declaration #624) by introducing the following rules:forward
declarations #635).__pragma
being expected twice in function/variable declarations starting with keywordspublic
,static
andstock
.Which issue(s) this PR fixes:
Fixes #621, #622, #623, #624, #625, #635
What kind of pull this is:
Additional Documentation: