22 Commits

Author SHA1 Message Date
Daniel_Cortez
06feab9224 emit/__emit: Code cleanup 2017-11-11 20:50:07 +07:00
Zeex
17ebeb8ebe Revert "triggers an error for issue #129"
This reverts commit 9e4a2b283fd01549d05058c8946ecee974e30dbe.

Reverting because of #198.
2017-10-23 08:04:02 +06:00
Zeex
2a85a9fa33 Merge pull request #190 from YashasSamaga/i154-fix
trigger error if an array of unknown size is being returned
2017-10-08 02:48:48 +06:00
Zeex
9daeae3d1a Merge pull request #151 from YashasSamaga/i129-fix
triggers an error for issue #129
2017-10-08 02:47:20 +06:00
Daniel_Cortez
6119df8f2b Rename asm to emit, add __emit as an alternate keyword. 2017-10-06 15:51:24 +07:00
Yashas
00a1cd7e88 trigger an error if an array of unknown size is returned 2017-09-29 16:21:33 +05:30
VVWVV
f7edb7dd90 Fix asm operator in expressions
Signed-off-by: VVWVV <d0u61ev@gmail.com>
2017-08-01 22:35:40 +03:00
VVWVV
e19354a52c Add new asm operator instead of #emit
Signed-off-by: VVWVV <d0u61ev@gmail.com>
2017-07-29 22:02:26 +03:00
Zeex
43cd36b891 Fix false 'assignment to itself' warning
Change lvalue type (ident) to iEXPRESSION if a unary operator is
applied to it ('!', '~', '-'). This allows the self-assignment
check to pass.

Fixes #78.
2017-05-01 12:09:08 +06:00
Yashas
9e4a2b283f triggers an error for issue #129
cond ? array1 : array2

Triggers an array if the size of array1 and array2 do not match.
2017-02-12 22:25:12 +05:30
Zeex
3a4878f54b Fix clang warnings 2017-02-11 19:32:10 +06:00
Zeex
f9e9c181dd Mark symbols as read when they are passed as function arguments
This is an improved version of the earlier fix for bug #131.

Also should fix https://github.com/Misiur/YSI-Includes/issues/154.
2017-01-28 12:59:49 +06:00
Zeex
25b21eb0aa Improve reparse check
Only reparse if the function has a tagged result (old behavior) or a
global variable is passed as one of its arguments at some point before
declaration/definition.

Also warn if need to reparse so that developers are aware of potential
performance hit.

Fixes #131.
2017-01-22 17:26:14 +06:00
Zeex
69f1ec61f9 Fix typo in constant name (DEPRICATED -> DEPRECATED) 2017-01-21 14:33:46 +06:00
Sergei Marochkin
485361acb4 Revert and fix it (thanks to @oscar-broman) 2016-09-07 09:44:08 +03:00
Sergei Marochkin
b5959fcf15 Remove Linux crash lines 2016-09-05 11:16:56 +03:00
Marcin Misiurski
8e11f682d6 Fix enum field size (credit to @Arkshine) 2015-03-25 14:19:10 +01:00
Zeex
4d2c600507 Fix crash on error 33 in ternary operator
If one of the two values is a string literal and the other is a
non-array, the symbol associated with the first one will be NULL.
But the code checked if sym->name!=NULL rather than sym!=NULL,
hence the crash.

--------- test code --------

main() {
    new a, b;
    return (a != 0 ? b : "string");
}

----- end of test code -----
2014-04-21 10:52:44 +07:00
Zeex
53ef10ffc7 Fix crash when using tagof(tagname:)
This fixes #18.
2014-02-19 22:31:50 +07:00
Zeex
53221dd2cc Introduce #pragma naked
When applied to a function #pragma naked merely disables the "should return
a value" warning for the function. It's intended to be used with functions
that return a value via #emit instead of the normal return statement.

This pragma works only on function definitions, not declarations. It's also
pretty stupid - the function may be defined way after this directive and it
won't stop on things coming in between.

For example, here all declarations between #pragma naked and f() are
effectively ignored:

#pragma naked

new x;       // ignored
forward g(); // ignored
native n();  // ignored

f() {
    // f() becomes naked
}

Note that #pragma naked does not affect generated code in any way, unlike
e.g. __declspec(naked) or __attribute__((naked)) in C/C++ where the compiler
omits the code for the prolog and epilog.
2014-01-05 01:26:10 +07:00
Zeex
c20d9cb33b Fix compile crash when calling a function at global scope
This fixes a crash that occurs if a global variable is initialized
with the result of a function call.

See 3) here: http://forum.sa-mp.com/showthread.php?t=355877

--------- test code --------

native use(...);

f() {
	return 0;
}

new x = f();

main() {
	use(x);
}

----- end of test code -----
2014-01-01 16:49:55 +07:00
Zeex
766b96bcf3 Lower case directory names 2013-09-19 13:06:46 +07:00