The arguments of public functions are marked as READ by default to prevent 203/204 warnings.
The reason is probably that there is no requirement imposed by the host on the user that they read all the arguments.
Smilarly the array/reference arguments need not be modified but the forward takes both cases into consideration.
This prevents warning 214 on array arguments of public functions.
If you used #pragma option -d3 or #pragma option -Z the corresponding
constants (debug and __compat respectively) were not updated; now the
are.
Fixes#253.
If a reference argument is not read within the function, the compiler does not trigger an unused symbol warning.
This commit modifies the compiler to trigger warnings in such cases.
Notes:
I spent some time checking through every reference that was made to the `uREAD` flag in the entire codebase. As far as I could see, there would be no side-effects of this commit.
Currently, the destructors are triggered for each indirection level of the multi-dimensional array. The PAWN Implementer Guide states that the destructor must be triggered for the actual data only.
Apart from the above correction, this commit also fixes a typo which caused wrong sizes to be passed to the destructor.
The destructors for local variables were not being called when the function returns without the user expclitly giving a return statement.
This commit adds code to call the destructors for the local variables on an implicit return.
1. Adds a generic new warning which is triggered when meaningless combination of class specifiers are used.
2. This commit adds code to trigger a warning for the following two cases:
- constant reference
- - not meaningful as as references always point to cells in PAWN (unlike C++ where it would help costly copies while guaranteeing to not modify the object) which makes const reference is as good as pass-by-value
- constant variable arguments
- - for similar reasons as in the previous case
Using 2^23 allocates 128MB memory for the hash table. Seems like
a waste of memory, especially for small scripts.
For example, I didn't notice a huge difference in time between 1000
and the old number when compiling most of YSI includes and tests.
Hash tables double in size when they need more space, it's pretty
efficient (at least this implementation does so).
In `initarray`, `prev1` and `prev2` are dangling pointers. When assigned, they point to an address of an item in the literal queue. The compiler checks the literal queue size before adding an element. If the size isn't sufficient to hold another element, it reallocates the literal queue to accommodate more items. When the reallocation happens, the previous references (`prev1` and `prev2`) to the elements of the literal queue are invalidated. De-referencing the broken pointers will cause undefined behavior.
This commit replaces the pointers with indexes. The indexes are invariant to the reallocation.