-
Notifications
You must be signed in to change notification settings - Fork 84
dev #734
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
Closed
Closed
dev #734
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…for" loops We already temporarily increase `pc_nestlevel` before the whole loop (to store the assignments on a separate compound level), so we don't need to do it again.
… end with the same kind of statement
…se" branch Previously we had to clear all assignments in the "true" branch if the "false" one was present, so the compiler won't report assignments in the "true" branch as unused if the "false" branch also contains assignments to the same variables.
…return` and `exit`
This fixes a bug with assignments being falsely reported as unused after `return` or `exit`.
Example:
```
ReturnValue(&arg)
{
if (/* ... */)
{
arg = 1;
return;
}
arg = 2; // previous assignment "arg = 1" was falsely reported as unused on this line
}
```
… `memoizeassignments()` and `restoreassignments()`
…default value is invalid
…guments named not as in the previous implementation
…xpressions inside a single `return` statement
Example:
```
StringOrigin()
{
static const string[] = "Hello world";
return string;
}
ReturnString()
{
return StringOrigin(), StringOrigin();
}
```
Before this fix, the heap space allocated by the first `StringOrigin()` call wasn't being freed.
…t be shown again for the next enum item. Also rename the variable into more descriptive "warn_overflow".
# Conflicts: # source/compiler/sc5.c
When you have `///` in the global scope with nothing after it, an extra space still gets appended to the output. However, this space isn't taken in to consideration when calculating the new length of the pawndoc and with enough of them you can get memory corruption.
…ns, treat them as errors
… the scope of the current file
It is used by almost all scripts, so why shouldn't it be officially supported?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
tagof(tag)as default value__nameof(__nameof#461)()s in#strings. (Track the depth of()s in#strings. #471)pragma deprecatedmessage in error 4:uASSIGNEDat the beginning of function bodyoperator=on tag-mismatched returnsgotoon a previously defined label__pragma#pragma deprecated#assertwork without debug mode (-d0)*= 1and<<= 0working as+= 1__emitdelete_symbols()instead ofdestructsymbols()ifandswitchstatementsif,switch,while,do-whileandforstatementsifbranches end with the same kind of statementreturnandexitrestoreassignments()anddemoteassignments()into one functionclearassignments(),memoizeassignments()andrestoreassignments()uASSIGNEDflag for global variablestagofsizeof/tagofused for a default value is invalidconstbeing applied only to the highest array dimensionreturnstatement Example: ``` StringOrigin() { static const string[] = "Hello world"; return string; }++.__pragmato be used as a standalone statement__pragma("naked")erasing theflagDEPRECATEDflag__pragmasizeofbeing used on a pointer0instead ofNULL0/1withfalse/trueinflooreddiv()callsFALSE/TRUEinstead of0/1for boolean variablesaligncellifstatement end with terminal statementsswitchhas a default case and all cases end with terminal statementsswitchcases end with terminal statements; * when bothifbranches end with different kinds of terminal statements; * when function ends with an endless loop.trueifbranch ends with a terminal statement and thefalsebranch is emptygotogototTERMINALreturnstatement has a constant return value and is preceded by aswitchstatement with all cases ending with terminal statementsexitstatements as terminal#assertworks without debug mode, we don't need that workaround anymore.decl_enum()BOOLTAGconstant instead of callingpc_addtag("bool")sOPTIMIZE_DEFAULTintosOPTIMIZE_FULLuse of operator "~" on a "bool:" value always results in "true"; did you mean operator "!"?possible misuse of comma operatorinttoshort__pragma: Warn on extra characters after "unused", "unread", "unwritten", "nodestruct" and "naked"#pragma warning enable/disable__pragma: Fix "error 001: expected token: "-string-", but found "!"" message on empty parameter string__pragma("warning")""strings ignore new lines.__timestamppawnrunsuseamxStringas a built-in modulesymbol_cache_add()add symbols with the same name into the start of the liststockis used in a local variable declaration. Also, continue parsing the variable declaration, as if it was defined with keywordnew, in order to avoid further error/warning messages.switchstatement starts, not where it endspc_pushwarnings()andpc_popwarnings()frominttovoid#pragma warning popis used more times than#pragma warning push#pragma warning enablenot working properly because ofstrgetting clobbered after the use ofpreproc_expr()#pragma warning pop0/1instead ofFALSE/TRUEsc_tokensfrom sc2.c to scvars.c and add a declaration for it in sc.hnumber()uPREDEFflagfinddepend()duplicatestring()instead ofstrdup()returnstatements__static_assertand__static_checklex()__static_assertand__static_checkbool:-tagged operatorsuser_inc()anduser_dec()getting merged into one function in release builds (issue Compiler calls overloaded operator++instead of--#627)0instead ofFALSEconstvalue::indexload.u.*andpush.upseudo-opcodes (fixes__emit(load.u.pri)with pre/post operators #568)SC_FASTCALLfrom the headers foremit_*functionsemit_*functions at the beginning of sc1.cerrorset()inemit_*functionserrstartinside functionerror(), use a local variable instead__pragmatestsdo-whileloops2.10.11in preparation...reportnameinto a global variableconst staticto declare constants limited to the scope of the current fileconst_valis actually a compile-time constantfatal error 111:for user errors/warnings.