507 Commits

Author SHA1 Message Date
Zeex
289cfeb126 v3.10.10 2020-02-08 19:04:51 +06:00
Y-Less
4ede5aa24f
Merge pull request #453 from Daniel-Cortez/statevar-assertion-fix
Fix assertion failure whence the script contains a single state variable
2019-11-07 01:43:08 +01:00
Y-Less
885031670a
Merge pull request #445 from Daniel-Cortez/__addrof
Operator '__addressof'
2019-11-07 01:39:52 +01:00
Y-Less
df323449ad
Merge pull request #454 from Daniel-Cortez/unnamed-enum-tags-fix
Do not allow tags inside the braces of unnamed enums
2019-11-07 01:39:27 +01:00
Y-Less
18b6df7c12
Merge branch 'dev' into __addrof 2019-11-07 01:35:51 +01:00
Amyr Ahmady
51fdf6f825 a simpler fix for '#pragma option' 2019-10-07 15:59:01 +03:30
Amyr Ahmady
ff162b3e2e check if 'i' is '32' for texts with less than 31 characters 2019-10-07 15:23:58 +03:30
Amyr Ahmady
b8dbbe9e43 fix "#pragma option" crash when character count is over 31
For some reason `i` will be `32` after our for loop so an OOB happens when code tries to assign `'\0'` to `name[32]` since `name` size is 32.
Doing a `-1` to `i` fixed this issue and now throws `error 038: extra characters on line` when character count is over 31.
2019-10-07 11:12:59 +03:30
Amyr Ahmady
bd670fb2e0 change "emit" to "__emit" in test files 2019-10-01 18:26:39 +03:30
Amyr Ahmady
d3c0cf6bae remove emit keyword 2019-10-01 17:30:00 +03:30
Daniel_Cortez
11b1f5d8c2 Add tests 2019-09-30 19:02:12 +07:00
Daniel_Cortez
013084e181 Fix tags being silently ignored in anonymous enums 2019-09-30 19:01:34 +07:00
Daniel_Cortez
14228a1cea Fix assertion failure with a state variable 2019-09-29 13:42:04 +07:00
Y_Less
2f642899f1 Fix #451 2019-09-25 19:44:47 +02:00
Zeex
d8ac95acb8 Attempt to fix unresolved snprintf() error on Windows 2019-09-24 11:02:37 +06:00
Y_Less
fc7156241f Squashed commit of the following:
commit 448aa3b0517a48bf1eb23e143716a1d2543f0ee2
Author: Daniel_Cortez <gromovstanislav@yandex.ru>
Date:   Fri Jul 5 19:10:25 2019 +0700

    Update tests for __emit

commit b7fd80382a3481acfcb4e1335cee7071fda064f3
Author: Daniel_Cortez <gromovstanislav@yandex.ru>
Date:   Fri Jul 5 19:10:09 2019 +0700

    __emit: Do not allow pseudo-opcodes to modify constant variables/arrays
2019-09-24 00:20:09 +02:00
Y_Less
8d8b104f38 Squashed commit of the following:
commit 3f87cf177352d2fa7f6f793d51cf77c9dbdd62a1
Author: Daniel_Cortez <gromovstanislav@yandex.ru>
Date:   Fri Jul 26 20:21:36 2019 +0700

    Update tests for 239

commit 913eac5e3dea8125e7a6d47d6398f30d3eb660ad
Author: Daniel_Cortez <gromovstanislav@yandex.ru>
Date:   Fri Jul 26 20:08:52 2019 +0700

    Revert "disable 239 for native functions"

    This reverts commit 8948f207ea9c7cef4e7808751a499310d1407148.
2019-09-23 21:56:43 +02:00
Y_Less
79101592e7 Squashed commit of the following:
commit b32aea5faf3cf5168cf69b1143de6b49853f0879
Author: Yashas <yashas_2010@yahoo.com>
Date:   Tue Oct 16 23:07:47 2018 +0530

    add test for issue #371

commit 66bbe6c4df3593c28fcc229b04c2be428d1da070
Author: Yashas <yashas_2010@yahoo.com>
Date:   Wed Oct 3 17:05:10 2018 +0530

    share usage information across function definitions
2019-09-23 21:54:56 +02:00
Zeex
65d6c98fc2 Fix GCC warning
source/compiler/sc1.c: In function ‘check_tagmismatch_multiple’:
source/compiler/sc1.c:3482:40: warning: ‘"’ directive writing 1 byte into a region of size between 0 and 4094 [-Wformat-overflow=]
         sprintf(formal_tagnames,"%s\"%s\"",formal_tagnames,(tagsym!=NULL) ? tagsym->name : "-unknown-");
                                        ^~
source/compiler/sc1.c:3482:9: note: ‘sprintf’ output 3 or more bytes (assuming 4097) into a destination of size 4095
         sprintf(formal_tagnames,"%s\"%s\"",formal_tagnames,(tagsym!=NULL) ? tagsym->name : "-unknown-");
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2019-09-22 17:23:26 +06:00
Daniel_Cortez
50d54b9d05 Add tests 2019-09-18 19:58:17 +07:00
Daniel_Cortez
1d3b2319fd Implement operator '__addressof' 2019-09-18 19:50:28 +07:00
Daniel_Cortez
65070b6563 Allow symbols to be referenced from outside functions 2019-09-13 19:33:07 +07:00
Daniel_Cortez
ef49529b50 Symbol suggestions: distinguish native functions and Pawn functions 2019-09-13 19:31:35 +07:00
Zeex
ad730d32d8
Merge pull request #431 from Daniel-Cortez/suggestions-fix
Fix incorrect suggestions for state variables
2019-07-03 14:58:45 +06:00
Zeex
f8fec557e0
Merge pull request #433 from Daniel-Cortez/predef-array-fix
Fix assertion failure `glb_declared==0`
2019-07-03 14:58:11 +06:00
Zeex
6fd5198d4e Add a test for #426 2019-06-29 20:39:42 +06:00
Zeex
cf4b65ca66 Reset literal queue after unknown preprocessor directive
Fix an assertion failure at sc1.c:3702 (litidx==0).
2019-06-29 20:32:54 +06:00
Zeex
b2eca9203b
Merge pull request #427 from Y-Less/Branch_ignored_directives
Ignore `#if`d out unknown directives.
2019-06-29 20:29:56 +06:00
Daniel_Cortez
1bb4e42917 Add tests for #436 2019-06-28 23:57:03 +07:00
Daniel_Cortez
5122a99e44 Fix local variables being able to be self-assigned through initialization 2019-06-28 23:56:44 +07:00
Daniel_Cortez
ccb8980f65 Fix 'glb_declared==0' assertion failure 2019-06-23 20:02:49 +07:00
Daniel_Cortez
443979a899 Update tests for suggestions 2019-06-18 22:00:52 +07:00
Daniel_Cortez
303b782517 Fix incorrect suggestions for state variables 2019-06-18 22:00:31 +07:00
Zeex
c9b3e44bcb
Merge pull request #378 from Y-Less/Branch_pragma_nodestruct
Branch pragma nodestruct
2019-06-17 10:58:07 +06:00
Zeex
599415444b
Merge pull request #377 from Y-Less/Branch_pragma_unwritten
Branch pragma unwritten
2019-06-17 10:56:39 +06:00
Stanislav Gromov
0cb9fb3ff6 Misc. minor fixes (#423)
* Misc. minor fixes

* Fix OOB array access in encode_cell()

* Fix memory leaks in plungequalifiedfile()

* Remove redundant NULL pointer checks

* Fix invalid uses of realloc()

* Remove 'do_switch()'

* Don't use 'strlen()' to identify empty strings

* Other minor fixes

* Fix incorrect error message when compression is ineffective

* Add macro 'strempty' to identify empty strings
2019-06-17 02:57:49 +02:00
Zeex
e645ffceef
Merge pull request #397 from Daniel-Cortez/suggestions-fix
More fixes related to suggestions
2019-06-16 12:48:26 +06:00
Y_Less
267c8f8ffd Ignore #ifd out unknown directives.
Makes the compiler slightly more future-proof by allowing us to do something like:

```pawn
#if __Pawn >= 0x03AB
    #message You're on a nice new compiler.
#endif
```

Currently to do that you need to do:

```pawnc
#message You're on a nice new compiler.
```

```pawn
#if __Pawn >= 0x03AB
    #include "message.inc"
#endif
```

Or you get an error that `#message` (or anything else) is an unknown directive if the compiler doesn't recognise it, even if it is disabled.

The only downside to this is that it makes it slightly harder to add new `#if`-like directives:

```pawn
#if __Pawn >= 0x03AB
    #message You're on a nice new compiler.
#elif SHOW_ERROR
    #error You've got an error.
#endif
```

A compiler that fails the first check AND doesn't recognise `#elif` will simply skip it and go all the way to `#endif`.  It will not evaluate it as `#elseif` and potentially run the code within.  It should somehow recognise `#elif` as a `#if`-like directive it just doesn't know and give an error.  That would require some sort of hard convention we don't yet have.  That, or we just define all possible ones now (even if they aren't implemented):

```pawn
#if
#else
#elseif
#elif
#ifdef
#elifdef
#elseifdef
#endif
#fi
#el
#ifndef
#elseifndef
#elifndef
```

Can't think of any more, but that doesn't mean there aren't any (does `iff` make any sense here?)
2019-06-16 02:40:17 +02:00
Zeex
8561b38d6d
Merge pull request #421 from Daniel-Cortez/emit-3
A batch of improvements for the '__emit' operator
2019-06-15 22:24:36 +06:00
Daniel_Cortez
5c4e0c27a7 __emit: Fix undefined behavior
Apparently shifting a 32-bit signed value by 31 bits is UB...
2019-06-08 03:03:01 +07:00
Daniel_Cortez
991eed9303 __emit: Remove excessive local block 2019-06-08 02:59:08 +07:00
Daniel_Cortez
d965a406e4 pawndisasm: Remove extra space after AMX flags 2019-06-08 00:03:10 +07:00
Daniel_Cortez
cbc647d6bd pawndisasm: Properly handle invalid instructions 2019-06-08 00:03:09 +07:00
Daniel_Cortez
95685bf4ae pawndisasm: Remove function 'do_switch()' (a duplicate of 'do_jump()') 2019-06-08 00:03:08 +07:00
Daniel_Cortez
c9dc7008fa pawndisasm: Fix input and output files not being closed properly and 'code' being leaked on errors 2019-06-08 00:03:07 +07:00
Daniel_Cortez
b4f899e557 pawndisasm: Remove unused data from the opcode table 2019-06-08 00:03:06 +07:00
Daniel_Cortez
8394b5a29e __emit: Make sure the opcode table is sorted 2019-06-03 17:06:31 +07:00
Daniel_Cortez
dfefdf3b50 __emit: Add tests 2019-06-03 17:05:26 +07:00
Daniel_Cortez
2cfcd2130b __emit: Implement pseudo-opcodes 2019-06-03 17:04:05 +07:00
Daniel_Cortez
4c260e6c60 __emit: Allow negative offsets for arguments of type 'local variable' 2019-05-04 15:53:08 +07:00