Skip to content
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

Update compiler #116



Copy link

commented Aug 15, 2014

Here a first batch. As it would be probably a bad idea to fully update compiler v3.0 to v3.2 ; we can at least push fix for some known annoying issues/crashes and adding minor welcomed features. This doesn't deal with opcodes or such at all.

Most of patches come from commits from SourceMod, some from SA-MP community and few others from some Pawn version (diff from previous version). I've put reference in each commit. So if one addition feels wrong, we can easily revert.

When I could, this has been tested before and after. This should be safe.

@Arkshine Arkshine changed the title Update compiler safe fix feature Update compiler Aug 15, 2014


This comment has been minimized.

Copy link

commented Aug 17, 2014

@Arkshine okay, re: the variadic bug. I'll fix this on SM (alliedmodders/sourcemod#132) and then do a PR for AMX Mod X separately, so you can remove that chunk from this PR. The SM fix uses better opcodes, and less of them.


This comment has been minimized.

Copy link

commented Aug 25, 2014


Arkshine added 26 commits Aug 12, 2014
Compiler: Increase input line length.
1023 can be achieved really fastly, e.g. with some SQL definitions.
This is the same value as SM.
Compiler: Add #pragma deprecated.
This is based on SM, including patch to support macros/constants (
Updated also some pawn includes to use this new pragma.
Compiler: Fix in recursion detection.
Original fix imported from pawn 3.1.3522.
This fixes where for some plugins you would have:

   Stack/heap size:      16384 bytes; usage is unknown, due to recursion

Now, you get:

   Stack/heap size:      16384 bytes; estimated max. usage=782 cells (3128 bytes)
Compiler: Add #warning directive.
Basically same as error but as warning.
Imported from SA-MP: pawn-lang/compiler@1bd6be9


  #warning don't eat egg.


  warning.sma(1) : warning 234: user warning: don't eat egg.
Compiler: Add __line
Imported from SA-MP: pawn-lang/compiler@605ae7f
This is a backport from Pawn 4.0. It sets to the current line number during compile time.
Documention for 3.x actually mention this.
Compiler: Fix runtime error in variadic functions that return strings.
Imported from SM-AM: pawn-lang/compiler@1d1244c.

"This fixes a bug where returning a string from a variadic function caused
an invalid memory access error during runtime. It seems like they forgot
to update existing string return code for variadic functions."
Compiler: Fix the "@" character was not allowed in macro definitions …
…(while the documentation stated that they were).

Imported from Pawn 3.1.3599.
Compiler: Improve sizeof return on array without specifiying the dime…

Imported from Pawn 3.1.3636.

"When making an array without specifiying the dimensions, but where the element
count at the lowest dimension is the same for all, the compiler now "counts"
this size, rather than setting the lowest dimension as "variable length".

An example for this situation is the declaration:
    new my_array[][] = { {1,0}, {2,1}, {3,1} }
No dimensions are given, but the new compiler determines that the minor
dimension is 2 (and the major dimension is 3). Previous compilers set the
minor dimension to 0 --meaning "variable"."
Compiler: Fix #elseif handling not working as expected.
Improted from Pawn 3.1.3636.

-- Example

#define VAR 1

#if VAR == 1
  // code
#elseif VAR == 2
  // code

Returns error(38).
Compiler: Update VERSION_INT.
Some people may want to check compiler version with __Pawn, and it would be a good idea to bump the version.
Since we have a special version, and to avoid to use digit which may be used by official version, I propose using letters, so: 0x30A.
This should be resonneable.
Compiler: Revert "Fix runtime error in variadic functions that return…
… strings."

Better fix by dvander will be provided later.
Compiler: Revert "Add #warning directive."
Probably not that useful.
Arkshine added 6 commits Aug 17, 2014
Compiler: Fix enum field size was not taken into account when implici…
…tly passed to a function.

Imported from Pawn 3.3.3930.



enum tag

new var[tag];

foo(const string[], size = sizeof(string))
    // size returns 1 before fix, 32, after.

public plugin_init()

Compiler: Improve/fix recursion detection.
Imported from Pawn 3.2.3664 and 3.3.3875.

@Arkshine Arkshine force-pushed the Arkshine:update-compiler-safe-fix-feature branch from fd9705a to f30c7a6 Aug 26, 2014

Arkshine pushed a commit that referenced this pull request Aug 26, 2014

@Arkshine Arkshine merged commit 1463103 into alliedmodders:master Aug 26, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed

@Arkshine Arkshine deleted the Arkshine:update-compiler-safe-fix-feature branch Aug 26, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.