Skip to content

Conversation

@JLWalsh
Copy link

@JLWalsh JLWalsh commented Aug 11, 2024

  • Move macro 'arraysize' from amx.h to sc.h
  • Make use of macro 'arraysize'
  • Fix potential undefined behavior in 'alignframe()'
  • Remove leftover stuff
  • Make sure 'float'/'double' to 'cell' type punning is safe
  • Allow the use of tagof(tag) as default value
  • Add tests
  • __nameof (__nameof #461)
  • Track the depth of ()s in # strings. (Track the depth of ()s in # strings. #471)
  • Check switch/case values for tag mismatch (Check switch/case values for tag mismatch #475)
  • Reimplement redundant pragma deprecated warning at the site of declaration #242, taking public functions in to account.
  • Fix Clang warnings
  • pawndisasm: Mark functions meant for internal use as 'static'
  • Fix potential memory leak in 'pc_createtmpsrc()'
  • Fix values assigned to boolean variables
  • Fix incorrect error message
  • Add a test
  • Use pragma deprecated message in error 4:
  • Move declarations.
  • Enable CMake folders
  • Add error message for invalid option case
  • Prepent option name with - in error message
  • Docker feature
  • Warn if a value assigned to a variable is not used upon the next assignment or symbol destruction
  • Update the array size test to accomodate for the new warning
  • Add tests
  • Suppress warning 240 for the cases whence the previous value is a zero value assigned at variable definition
  • Issue warning 204 at the line where the assignment appears, not at the end of function
  • Don't issue warning 204 if the assignment operator is overloaded
  • Detect more unused assignments for function arguments by marking them as uASSIGNED at the beginning of function body
  • Override the tag only if the enum element used for array indexing belongs to a named enum
  • Fix the use of a tag from the wrong value when handling compound overloaded assignments
  • Add tests
  • Use operator= on tag-mismatched returns
  • Add tests
  • Add tests
  • Print an error if an operator is declared or defined as public
  • Add tests
  • Fix assertion failure when a native operator is declared without a base function
  • Add tests
  • Clear assignments before the "else" branch, not after the "if" branch
  • Don't clear assignments after switch "case" branches
  • Clear the assignment flag for local variables when using goto on a previously defined label
  • Add more test cases
  • Operator __pragma
  • Fix memory leak in #pragma deprecated
  • Memoize the 'compound statement' nesting level for loops
  • Add a distinct error for division by zero
  • Warn if switch control expression is constant
  • Add tests
  • Fix error 094 not being printed if the dividend is not a constant value
  • Fix increment and decrement operations not marking the symbol as "written"
  • Update the tests for warning 214
  • Restrict local constants to the scope they're defined in
  • Add tests
  • Make #assert work without debug mode (-d0)
  • Add tests
  • Fix enum increments *= 1 and <<= 0 working as += 1
  • Warn if the shift count is negative or too big
  • Add tests
  • Update one of the tests for __emit
  • Update the tests to cover right shift operations
  • Warn on invalid shift count for enum increment
  • Warn if not all enum items are covered by a switch statement
  • Add tests
  • Warn about shift overflow in enum item declarations
  • Update tests
  • Memoize the 'compound statement' nesting level for loops
  • Clear assignments when 'break' and 'continue' are used
  • Don't bother traversing the local symbols table to unset the 'uASSIGNED' flag when error messages are being silenced
  • Check for unused assignments in delete_symbols() instead of destructsymbols()
  • Turn "nestlevel" into a global variable
  • Add a new field in the "symbol" struct to store the 'compound statement' nesting level for assignments
  • After for/while/do-while loops only clear the assignments made inside the loop
  • Demote the "compound statement" nesting level for assignments done inside if and switch statements
  • Do not clean up the assignments before if, switch, while, do-while and for statements
  • Also detect unused assignments (warning 240) to "passed-by-reference" function arguments
  • Rewrite the tests
  • Don't increase the compound level for the initialization section in "for" loops
  • Don't forget to demote the level of assignments if both if branches end with the same kind of statement
  • Detect unused assignments in the "true" "if" branch if there's a "false" branch
  • Also detect unused assignments in all "switch" branches
  • Clean up assignments to "passed-by-reference" function arguments on return and exit
  • Merge restoreassignments() and demoteassignments() into one function
  • Add new test cases
  • Remove the symbol table argument from functions clearassignments(), memoizeassignments() and restoreassignments()
  • Do not set the uASSIGNED flag for global variables
  • Add a check for tagof
  • Avoid a fatal error when the argument of sizeof/tagof used for a default value is invalid
  • Update the tests
  • Fix const being applied only to the highest array dimension
  • Add tests
  • Fix NULL pointer dereference when a state function is defined with arguments named not as in the previous implementation
  • Add tests
  • Fix bad code generation when returning an array returned by another function
  • Add tests
  • Fix heap space being leaked when there are multiple comma-separated expressions inside a single return statement Example: ``` StringOrigin() { static const string[] = "Hello world"; return string; }
  • Update the tests
  • Remove redundant variable declaration
  • Reset variable "overflow" when the warning has been shown, so it won't be shown again for the next enum item. Also rename the variable into more descriptive "warn_overflow".
  • Update tests
  • Add tests
  • Extra test for literals with ++.
  • Allow __pragma to be used as a standalone statement
  • Fix __pragma("naked") erasing the flagDEPRECATED flag
  • Update tests
  • Add a P-code test for __pragma
  • New warning: "enum increment has no effect on zero value"
  • Show the new warning only once per enum
  • Print warning 242 only when the increment (shift counter) is non-zero and not out of range
  • Update tests
  • Compare the contents of default arrays between function declaration(s) and implementation
  • Add tests
  • Fix sizeof being used on a pointer
  • Fix potential pointer truncation on 64-bit systems for the "-H" parameter
  • Fix incorrect pointer comparisons with 0 instead of NULL
  • Replace 0/1 with false/true in flooreddiv() calls
  • Fix inconsistent parameter naming between function declarations and implementations
  • Use FALSE/TRUE instead of 0/1 for boolean variables
  • sc6.c: Fix invalid use of macro aligncell
  • Detect unreachable code if both branches of the preceding if statement end with terminal statements
  • Add tests
  • Also detect unreachable code when switch has a default case and all cases end with terminal statements
  • Update tests
  • Don't print warning 209 ("function should return a value") in the following cases: * when all switch cases end with terminal statements; * when both if branches end with different kinds of terminal statements; * when function ends with an endless loop.
  • Update tests
  • Fix false detection of unreachable code when the true if branch ends with a terminal statement and the false branch is empty
  • Update tests
  • Detect unreachable code after goto
  • Update tests
  • Fix labels being falsely reported as unreachable when they were previously used via goto
  • Update tests
  • Clarify the description for tTERMINAL
  • Don't warn about unreachable code if a return statement has a constant return value and is preceded by a switch statement with all cases ending with terminal statements
  • Update tests
  • Treat exit statements as terminal
  • Update tests
  • Don't show the new warning when it's caused by overflow
  • Add tests
  • Update the enum increment test not to trigger warning 245. Also remove the "#pragma option -d1" line - now that #assert works without debug mode, we don't need that workaround anymore.
  • New warning: "multiplication overflow in enum item declaration"
  • Add tests
  • Return the '\n' symbol that was previously removed by accident
  • Warn when an empty enum root symbol gets redefined
  • Properly handle "enum root" symbols being redefined by enum elements
  • Remove redundant code from decl_enum()
  • Add tests
  • "enum item" => "enum element"
  • "semicolumn" => "semicolon"
  • Fix potential truncation of usage flags
  • Add a constant for the "bool" tag and use it instead of hardcoded "1"
  • Use the BOOLTAG constant instead of calling pc_addtag("bool")
  • Do not track unused assignments for static local variables
  • Update tests
  • Rename sOPTIMIZE_DEFAULT into sOPTIMIZE_FULL
  • Make more function declarations C89-compliant
  • New warning: use of operator "~" on a "bool:" value always results in "true"; did you mean operator "!"?
  • Add tests
  • New diagnostic: possible misuse of comma operator
  • Add tests
  • Update the tests for warning 248
  • Don't carry the sign bit when casting the symbol usage flags from int to short
  • __pragma: Warn on extra characters after "unused", "unread", "unwritten", "nodestruct" and "naked"
  • Simplify the code for #pragma warning enable/disable
  • Use named constants to enable/disable/toggle warnings, instead of hardcoded values
  • __pragma: Fix "error 001: expected token: "-string-", but found "!"" message on empty parameter string
  • Implement __pragma("warning")
  • Update tests
  • Better (fionacci) buffer growth.
  • Make "" strings ignore new lines.
  • Multi-line tests.
  • Add new built-in constant __timestamp
  • Make pawnruns use amxString as a built-in module
  • Add tests
  • Make certain commands raw strings.
  • Fix raw errors not having multi-line strings.
  • Fix assertion failure in certain erroneous scenarios
  • Properly parse the array index sub-expression when the array symbol or the subscription token are invalid
  • Add tests
  • Make symbol_cache_add() add symbols with the same name into the start of the list
  • Add tests
  • Skim through the case values when there's a case outside of switch
  • Add tests
  • Do not erase the code for the whole expression when the last comma-separated sub-expression has a constant result
  • Add tests
  • Print error 010 when keyword stock is used in a local variable declaration. Also, continue parsing the variable declaration, as if it was defined with keyword new, in order to avoid further error/warning messages.
  • Add tests
  • Print warning 244 ("enum element not handled in switch") at the line where the switch statement starts, not where it ends
  • Update tests
  • Remove unused variable
  • Change the return type of pc_pushwarnings() and pc_popwarnings() from int to void
  • Print an error when #pragma warning pop is used more times than #pragma warning push
  • Fix #pragma warning enable not working properly because of str getting clobbered after the use of preproc_expr()
  • Properly initialize and clean up the warning stack
  • Error when there's no matching #pragma warning pop
  • Add tests
  • Fix raw error test.
  • Add multiline string length tests.
  • Fix use of 0/1 instead of FALSE/TRUE
  • Move array sc_tokens from sc2.c to scvars.c and add a declaration for it in sc.h
  • Fix incompatible pointer type being passed to function number()
  • Fix invalid token index
  • Fix variables shadowing outer variables, remove redundant variable declarations
  • Fix unused assignment at initialization
  • Remove unused uPREDEF flag
  • Get rid of function finddepend()
  • Rename "warning_047.pwn/meta" to "error_047.pwn/meta"
  • Fix the character conversion loop relying on a 4-byte cell size
  • __pragma: Check if the option string is packed/unpacked in a more reliable way
  • Use duplicatestring() instead of strdup()
  • Extend warning 247 to other arithmetic and comparison operators
  • Update tests
  • Fix clang warnings
  • Indentation fix
  • Fix potential NULL pointer dereferences
  • Remove unreachable return statements
  • __pragma: Move the string processing code into a separate function, so it could be reused by other operators
  • Implement operators __static_assert and __static_check
  • Add tests
  • Implement recording of tokens read by lex()
  • Use the newly implemented token recording mechanism to record expressions checked in __static_assert and __static_check
  • Update tests
  • Test overloaded bool:-tagged operators
  • Fix user_inc() and user_dec() getting merged into one function in release builds (issue Compiler calls overloaded operator ++ instead of -- #627)
  • Fix the use of 0 instead of FALSE
  • Turn array-size-related assertions into compile-time checks
  • Remove the description for already removed flag "uPREDEF"
  • Check if the entry function is actually defined, not only declared
  • Add tests
  • Add missing entry point into the "multiline_string_sizes" test
  • Ignore state specifications on old-style forward declarations
  • Fix typo in the description for constvalue::index
  • Add tests
  • Skip warning ID 249
  • Reformat struct "assigninfo" into "symstate", so it could be used to store multiple symbol usage flags
  • Do not erase code for fetching the value from variable arguments of load.u.* and push.u pseudo-opcodes (fixes __emit(load.u.pri) with pre/post operators #568)
  • Update P-code tests
  • Simplify the code even more
  • Remove SC_FASTCALL from the headers for emit_* functions
  • Add forward declarations for emit_* functions at the beginning of sc1.c
  • Do not use errorset() in emit_* functions
  • Do not modify errstart inside function error(), use a local variable instead
  • Fix wrongly printed starting line number for one of the warnings in __pragma tests
  • Add tests
  • __emit: Use proper search criterion for global variables
  • __emit: Switch to the code segment when used outside functions
  • Fix misleading closing comments
  • Fix typos discovered with codespell
  • Pass variadic array cell arguments by temporarily storing them on the heap
  • Add tests
  • Warn when variables used inside of a loop condition aren't modified in the loop body
  • Disable the new diagnostics when a function or an array is used inside a loop condition
  • Add tests
  • Disable warnings 250 and 251 when a global variable is used inside a loop condition
  • Update tests
  • Don't count function arguments passed by const reference as modified
  • Add two more test cases to make sure passed-by-reference function arguments don't conflict with the new warnings
  • Make the new diagnostics actually work on do-while loops
  • Update tests
  • Move the remaining declaration in sc1.c
  • Add tests
  • 2.10.11 in preparation...
  • Fix sampctl link (Fix sampctl link in readme #671)
  • Use GitHub-flavored Markdown to highlight the MCVE code in the issue template
  • Add codepage translation files.
  • Fix a bug with empty global pawndoc:
  • Treat explicit zero array size as an error
  • Add tests
  • Use GitHub-flavored Markdown to highlight the MCVE code in the issue template
  • Fix build errors on Linux and OS X
  • Remove excess trailing whitespaces
  • Fix assertion failures for native functions returning arrays
  • Add tests
  • Do not ignore return array size specifications in operator declarations, treat them as errors
  • Add tests
  • Turn reportname into a global variable
  • Allow a combination of const static to declare constants limited to the scope of the current file
  • Add tests
  • Modify the tests to make sure const_val is actually a compile-time constant
  • Add ".pwn" to the official list of extensions.
  • Don't print fatal error 111: for user errors/warnings.
  • Starting -O2 upgrades
  • type mismatch fix.
  • Fix preprocessor hanging indefinitely when running #include on WSL

Daniel-Cortez and others added 30 commits July 3, 2020 18:23
…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.
…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()`
…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".
Daniel-Cortez and others added 29 commits May 2, 2021 19:08
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.
It is used by almost all scripts, so why shouldn't it be officially supported?
@JLWalsh JLWalsh closed this Aug 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

__emit(load.u.pri) with pre/post operators

4 participants