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).
https://msdn.microsoft.com/en-us/library/0d294k5z.aspx
It looks like we don't need it. The 'char' type is signed on other
platforms, so why should it be unsigned on Windows? Besides, its
includion in add_definitions() prevented RC from compiling libpawn.rc
with Visual Studio 2017's CMake tools.
* Allow line continuation in single line comments
Other languages allow this:
// this is totally a single \
line comment
For example C++, at least GCC, Visual C++. I don't see why it
should be forbidden.
* Don't insert \a symbols to mark
Because we now don't need to check if there are '\\' in comments
we no longer have to mark their positions with '\a' symbols.
* Don't trim leading space after '\\'
Again, this is how other languages do it and it seems to be more
intuitive. If you don't want spaces just don't indent your lines.
new s[] = "see \
this?"
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.
CMake Warning (dev):
Policy CMP0042 is not set: MACOSX_RPATH is enabled by default. Run "cmake
--help-policy CMP0042" for policy details. Use the cmake_policy command to
set the policy and suppress this warning.
MACOSX_RPATH is not specified for the following targets:
pawnc
This warning is for project developers. Use -Wno-dev to suppress it.
We don't need the whole AMX in order to compile pawndisasm, only a handful of
alignment functions (amx_AlignXXX) that are used in amxdbg.c. Just copy those
functions to amxdbg.
As a bonus, we don't have to fix compile warnings in amx.c now. (maybe somebody
will fix them some day in a distant future...)