Commit graph

636 commits

Author SHA1 Message Date
Dale Weiler
18b9473cf8 Itegration of corrector. Seems to be some leaks in the score keeping for the probability system. 2013-01-04 11:44:25 +00:00
Wolfgang Bumiller
cf293bc669 handling the ast-destruction in computed goto 2013-01-03 13:21:11 +01:00
Dale Weiler
7d14fdf530 Merge branch 'master' of github.com:graphitemaster/gmqcc 2013-01-03 12:05:02 +00:00
Dale Weiler
9bda8f61f4 Add specialized diagnostics for when predefined macros are used and ftepp predefined macros are not enabled. 2013-01-03 12:04:32 +00:00
Wolfgang Bumiller
614fcb12f5 check for TYPE_NOEXPR in general when applying an operator 2013-01-03 12:56:26 +01:00
Wolfgang Bumiller
e146fd121c parse_expression now takes a boolean flag on whether or not it should be creating ast_labels for undefined identifiers; creating the label later will pick it up and set its undefined flag to false 2013-01-03 12:46:33 +01:00
Dale Weiler
a168c5efbe More error checking and proper unreferencing of ast nodes if expressions for computed goto fails. 2013-01-02 22:39:24 +00:00
Dale Weiler
c1734d1b27 Some error checking for computed goto. 2013-01-02 22:28:26 +00:00
Dale Weiler
e08e4a9ce0 Remove "got" left behind from debugging. 2013-01-02 21:35:18 +00:00
Dale Weiler
a421d9a33b Implemented computed goto + added goto test for testsuite (tests both normal and computed goto statements). 2013-01-02 21:32:57 +00:00
Wolfgang Bumiller
558a091c08 remove ast.h-include from lexer.h to parser.c... 2013-01-02 15:08:02 +01:00
Dale Weiler
29db4a44ed Happy new years! 2013-01-01 05:08:55 +00:00
Wolfgang Bumiller
0920cb6ec4 Another hardcoded -std=gmqcc option removed and added to the implied -std=gmqcc flags 2012-12-31 12:43:15 +01:00
Wolfgang Bumiller
0626bbef8e remove another hardcoded -std=gmqcc case 2012-12-31 12:40:09 +01:00
Wolfgang Bumiller
d8254cede0 -std=gmqcc now implies -Werror-missing-return-values; another hardcoded error removed 2012-12-31 12:37:47 +01:00
Wolfgang Bumiller
17951ac92c Just allow variable declarations in for-loop initializers in any standard... 2012-12-31 12:35:26 +01:00
Wolfgang Bumiller
d47da25b82 Changing -Wtoo-few-parameters to -Winvalid-parameter-count; removing hardcoded COMPILER_GMQCC code which makes invalid parameter counts an error and instead make -std=gmqcc imply -Werror-invalid-parameter-count 2012-12-31 12:29:25 +01:00
Wolfgang Bumiller
a170154927 nil in ternary, and fix ternary to honor -fcorrect-logic/-ftrue/false-empty-strings 2012-12-31 11:45:00 +01:00
Wolfgang Bumiller
2cf4b4e56d Explicitly allow 'return nil' 2012-12-31 11:39:00 +01:00
Wolfgang Bumiller
4d5153854b This should actually cover all nil cases 2012-12-31 11:34:29 +01:00
Wolfgang Bumiller
5bb9351a3f Allow assigning nil to a field 2012-12-31 11:23:49 +01:00
Wolfgang Bumiller
0c4806b4a0 Adding -Wparenthesis, fixing constant folding of && and || 2012-12-31 11:11:46 +01:00
Wolfgang Bumiller
5a013c5b89 Do we REALLY need to listen to splint? 2012-12-30 11:59:29 +01:00
Wolfgang Bumiller
d9282ed988 Clean up trailing whitespaces 2012-12-30 11:03:59 +01:00
Dale Weiler
46374e94ca Add support for user defined messages for [[deprecated]] generalized attribute 2012-12-30 09:58:52 +00:00
Dale Weiler
921877e8a4 Implement [[deprecated]] general attribute, will mark functions as deprecated. Making calls to functions marked as such will trigger a compiler warning. Enabled by default. 2012-12-30 06:43:07 +00:00
Wolfgang Bumiller
755ee5462f Properly support globals initialized to nil 2012-12-29 21:15:59 +01:00
Wolfgang Bumiller
8bdd060112 -Wdifferent-qualifiers, -Wdifferent-attributes 2012-12-29 17:41:20 +01:00
Wolfgang Bumiller
33be9d4559 Don't allow code like: v * '0 1 0' = 3; to actually work... 2012-12-29 15:13:54 +01:00
Wolfgang Bumiller
73bc4cc3e4 -Ovector-components 2012-12-29 15:05:04 +01:00
Wolfgang Bumiller
14e954284e more general qualifier/attribute parsing, added not-yet-used AST_FLAG_INLINE and [[inline]] 2012-12-28 19:46:28 +01:00
Wolfgang Bumiller
47baca22d9 -Wuninitialized-const, -Wuninitialized-global 2012-12-28 19:07:43 +01:00
Wolfgang Bumiller
77d454725a -Wreserved-names, -fpermissive allows local variables named 'nil' to be created even with -funtyped-nil, they supersede the global untyped 'nil' 2012-12-28 18:22:09 +01:00
Wolfgang Bumiller
2e0216b7c6 'nil' global with -funtyped-nil 2012-12-28 18:16:19 +01:00
Dale Weiler
3688dab048 Fix a very possible bug 2012-12-28 12:50:37 +00:00
Wolfgang Bumiller
a60d0182db finish parsing of labeled loops; ast support added 2012-12-28 00:04:09 +01:00
Wolfgang Bumiller
c702970a0e distinguish between break/continue levels in the parser 2012-12-27 23:52:57 +01:00
Wolfgang Bumiller
ebb7cb2ae3 parsing of loop labels 2012-12-27 23:43:20 +01:00
Wolfgang Bumiller
517b6fed81 Another bool->int fix; now clang-compiled gmqcc actually works... 2012-12-27 14:33:58 +01:00
Wolfgang Bumiller
5cfd97c344 -fbail-on-werror option 2012-12-27 12:46:36 +01:00
Wolfgang Bumiller
f832b86dcd Fixing uninitialized warnings in parser.c 2012-12-26 20:00:17 +01:00
Wolfgang Bumiller
da927b5d41 print an error when static is used in global scope - this is currently not being handled as expected 2012-12-24 11:38:33 +01:00
Wolfgang Bumiller
2b468cb0ee Added the 'static' keyword.
Implements #71
2012-12-24 11:30:58 +01:00
Dale Weiler
d51a6ab3db Whitespace 2012-12-23 09:10:31 +00:00
Dale Weiler
5bc815c63f Revert "Whitespace fixes"
This reverts commit 4580dcf1ea.
2012-12-23 09:10:07 +00:00
Dale Weiler
4580dcf1ea Whitespace fixes 2012-12-23 08:42:53 +00:00
Dale Weiler
c3964cf29d Make compiler and virtual-machine compile as C++ code, also removed gmqcc_voidptr hack. 2012-12-23 07:51:19 +00:00
Dale Weiler
d35d953a91 Remove parser_compile_string_len, and make parser_compiler_string take an additional length argument. 2012-12-23 07:22:15 +00:00
Wolfgang Bumiller
e8cd9411b0 -Wunknown-attribute; and don't error on unknown attributes 2012-12-22 18:16:41 +01:00
Wolfgang Bumiller
7cf0ba5aa8 'noreturn' is now an attribute and parsed as [[noreturn]] 2012-12-22 18:09:56 +01:00
Wolfgang Bumiller
1f070b740f -ffalse-empty-strings in && and || 2012-12-22 17:31:31 +01:00
Wolfgang Bumiller
0fe71af4ce -fcorrect-logic now handles only vectors 2012-12-22 17:18:37 +01:00
Wolfgang Bumiller
8459895fdd Fix a bug with -fperl-logic and -fcorrect-logic 2012-12-22 16:25:19 +01:00
Dale Weiler
fa401b6f56 Cleanups and make compile with clang again with no warnings. 2012-12-22 08:22:50 +00:00
Dale Weiler
7d2a2f2ade cleanups and fixes that cppcheck found 2012-12-22 08:07:54 +00:00
Wolfgang Bumiller
93341dd009 *sigh* 2012-12-20 20:57:05 +01:00
Wolfgang Bumiller
a6547a15f3 no need to check the array, the 2nd NOT is a NOT_F 2012-12-20 20:56:49 +01:00
Wolfgang Bumiller
ccbccad994 fix -fcorrect-logic to use double-not instead of a single one - wow that was a bad one 2012-12-20 20:55:56 +01:00
Wolfgang Bumiller
68c4070f62 Fix the -fcorrect-logic condition 2012-12-20 20:40:59 +01:00
Wolfgang Bumiller
0988b731b7 Fix -fcorrect-logic 2012-12-20 20:33:05 +01:00
Wolfgang Bumiller
4f9c7861ec For loops may have an empty condition - don't try processing a NULL 2012-12-20 20:23:35 +01:00
Wolfgang Bumiller
a985a5cab1 while/for/do now all use process_condition, ast_loop got 2 new parameters for more efficient translation 2012-12-20 20:22:31 +01:00
Wolfgang Bumiller
d72cb42b08 process_condition function used by parse_if - need to still add it to loops 2012-12-20 19:51:30 +01:00
Wolfgang Bumiller
34063108a6 since unary not doesn't fold these, remove them from immediate_is_true 2012-12-20 19:19:12 +01:00
Wolfgang Bumiller
4319922b3c introducing an immediate_is_true which follows the new -f flags on strings and vector truthfulness, used in logic-op constant folding; const folding now disabled for functions-constants on NOT because it's stupid 2012-12-20 19:18:22 +01:00
Wolfgang Bumiller
6b9eff19f1 unary not now uses NOT_F with -ftrue-empty-strings 2012-12-20 19:04:56 +01:00
Wolfgang Bumiller
b85441d6af Making logical 'and' and 'or' use NOT_ in -fcorrect-logic for both operands normally, but only for the first with -fperl-logic 2012-12-20 19:00:23 +01:00
Wolfgang Bumiller
d76e6b103d ast_return needs the correct context... 2012-12-20 15:01:19 +01:00
Wolfgang (Blub) Bumiller
57aaf57dfc Revert "Fix FTFBS stuff"
This reverts commit 2cc51b8eb0.
2012-12-19 22:15:38 +01:00
Dale Weiler
2cc51b8eb0 Fix FTFBS stuff 2012-12-19 21:05:40 +00:00
Wolfgang (Blub) Bumiller
664b6d6604 'noreturn' is - for now - a keyword, and used just like noref/var/const, to mark a function as not-returning 2012-12-19 20:56:22 +01:00
Wolfgang (Blub) Bumiller
ba434c8e22 removing ast_expression_common.variadic, adding ast_expression_common.flags, added AST_FLAG_VARIADIC and AST_FLAG_NORETURN 2012-12-19 20:45:48 +01:00
Rudolf Polzer
acf4da9385 Fixes for some minor bugs clang-analyzer and cppcheck found
Signed-off-by: Dale Weiler <killfieldengine@gmail.com>
2012-12-18 16:54:51 +00:00
Wolfgang (Blub) Bumiller
2a61a65ce0 -fperl-logic now doesn't allow logic ops with operands of different types, but therefore uses the correct output type 2012-12-18 16:56:22 +01:00
Wolfgang (Blub) Bumiller
9b9fbb6e3b Added intrinsic: __builtin_debug_typestring(expr) to get the type of an expression as string 2012-12-18 16:52:30 +01:00
Wolfgang (Blub) Bumiller
b337f630c8 Remove a TODO message 2012-12-18 16:36:06 +01:00
Wolfgang (Blub) Bumiller
b7117e08ce parsewarning and genwarning to use vcompile_warning 2012-12-17 18:26:26 +01:00
Dale Weiler
8e0515de44 Added -Wunknown-pragmas 2012-12-17 16:14:43 +00:00
Wolfgang (Blub) Bumiller
f0687adbaa Error when the assignop for an assignment is invalid, eg. when trying to assign arrays 2012-12-17 16:00:08 +01:00
Wolfgang (Blub) Bumiller
f9b1d057b5 Moving all the global opts_ variables into a struct, now there's one global 'opts' struct 2012-12-06 13:23:53 +01:00
Wolfgang (Blub) Bumiller
04a57d871e unexpected typename error when there are typenames in an expression 2012-12-05 17:14:44 +01:00
Wolfgang (Blub) Bumiller
8777624fe2 ast_block_add_expr now lets the block fully adopt the type of the added expression 2012-12-05 12:57:00 +01:00
Wolfgang (Blub) Bumiller
f140251e85 s/parser_sy_pop/parser_sy_apply_operator/ 2012-12-04 21:04:14 +01:00
Wolfgang (Blub) Bumiller
8e077f378e -Werror now changes the word 'warning' into 'error' 2012-12-04 12:54:53 +01:00
Wolfgang (Blub) Bumiller
0e4e81d94f Parsing the 'noref' keyword; this also gets rid of some code duplication 2012-12-04 12:17:43 +01:00
Wolfgang (Blub) Bumiller
88a4721de7 Parsing noref-pragma 2012-12-03 20:37:02 +01:00
Wolfgang (Blub) Bumiller
02ec45363e Get rid of some code duplication 2012-12-02 17:57:08 +01:00
Wolfgang (Blub) Bumiller
8188d0b9f7 Sanity check for -Wternary-precedence 2012-12-01 12:36:54 +01:00
Wolfgang (Blub) Bumiller
ed4c513b1e -Wternary-precedence; *sight* this is tough 2012-12-01 12:35:46 +01:00
Wolfgang (Blub) Bumiller
b966cd4f4d More ternary fixes 2012-12-01 00:50:04 +01:00
Wolfgang (Blub) Bumiller
43c0343755 Offsetting builtins so we can use 'if builtin!=0' as condition but also allow a '#0' builtin 2012-12-01 00:36:24 +01:00
Wolfgang (Blub) Bumiller
75ab0e6663 and 'const' is a keyword, not an ident 2012-12-01 00:33:07 +01:00
Wolfgang (Blub) Bumiller
ac9d68387c var const / const var - both need to be allowed 2012-12-01 00:32:18 +01:00
Wolfgang (Blub) Bumiller
d52879315d some SYA fix; adding optional variable parsing to the head of a switch block 2012-12-01 00:31:00 +01:00
Wolfgang (Blub) Bumiller
8d014cc6eb changing parse_statement_or_block to return a bool and put the output block into a pointer, so that NULL can still be possible 2012-11-30 21:31:19 +01:00
Wolfgang (Blub) Bumiller
cda62cef20 apparently #0 is a valid builtin number, used for some NULL funcs 2012-11-30 21:25:18 +01:00
Wolfgang (Blub) Bumiller
2a3e7c1cff field constants - revert globals generated after fields 2012-11-30 21:11:25 +01:00
Wolfgang (Blub) Bumiller
316298650e remember if an ast_value is a field-declaration, build fields before globals 2012-11-30 21:03:57 +01:00
Wolfgang (Blub) Bumiller
f587e9cfb3 remove array-field without parens warning since it seems to not be broken in fteqcc anymore 2012-11-30 14:47:55 +01:00
Wolfgang (Blub) Bumiller
535fd5744b lex_ctx of a return will be at the return keyword now 2012-11-30 14:42:18 +01:00
Wolfgang (Blub) Bumiller
207293bf74 revert 1 of the error messages 2012-11-30 14:37:54 +01:00
Wolfgang (Blub) Bumiller
321a1fe0d6 Keep track of the beginning of a block 2012-11-30 14:37:23 +01:00
Wolfgang (Blub) Bumiller
eec61af381 mark vectors as used when their members are used 2012-11-30 14:30:25 +01:00
Wolfgang (Blub) Bumiller
600ecda860 Set the full const/var qualifier; only generate warnings about unimplemented functions if they have no qualifier at all 2012-11-30 14:05:25 +01:00
Wolfgang (Blub) Bumiller
5e23e8296d don't just store a 'bool constant' in the ast/ir, store the complete qualifier: 'int cvq', moved CV_ defines into gmqcc.h 2012-11-30 13:47:28 +01:00
Wolfgang (Blub) Bumiller
8e043c8447 Remove the 'warnreturn' parameter in some parser functions 2012-11-30 12:37:46 +01:00
Wolfgang (Blub) Bumiller
a58061464e actually removing -Wmissing-return-values from parser.c and enabling the ast code for it 2012-11-30 12:11:36 +01:00
Wolfgang (Blub) Bumiller
08551eefba Fix a small typo 2012-11-26 14:05:31 +01:00
Dale Weiler
77272da718 opval is asserted .. need (void) to hide warning when NDEBUG 2012-11-26 02:12:50 +00:00
Wolfgang (Blub) Bumiller
ec2ff09eff operator &~= must not cause the generated binstore to free the destination twice 2012-11-26 00:15:07 +01:00
Wolfgang (Blub) Bumiller
0af62801f4 Don't add redeclared globals a second time 2012-11-25 23:35:31 +01:00
Wolfgang (Blub) Bumiller
38df8b5e40 Another case for -fassign-function-types 2012-11-25 23:28:47 +01:00
Wolfgang (Blub) Bumiller
0d3896ca54 introducing -fassign-function-types, previously guarded by std==qcc this is now the flag to cause a warning (-Wassign-function-types) instead of an error when assigning functions of wrong types 2012-11-25 23:27:48 +01:00
Wolfgang (Blub) Bumiller
2f5a26a4de __builtin_debug_printtype directive... helped me down tracking a bug: parsing typedeffed types in parameter lists properly now 2012-11-25 22:57:11 +01:00
Wolfgang (Blub) Bumiller
08ef8bd045 Only check the ast-type of a switch case, not if it's an ACTUAL constant, fteqcc doesn't either... grrr 2012-11-25 22:40:35 +01:00
Wolfgang (Blub) Bumiller
10f49a38ca actually handle unary plus... 2012-11-25 22:38:52 +01:00
Wolfgang (Blub) Bumiller
42bd37a2e8 Ah right, 'var' is not an actual keyword, support TOKEN_IDENT-var inside functions 2012-11-25 22:26:28 +01:00
Wolfgang (Blub) Bumiller
f1bbdb7d45 Use the correct default cv-qualifier on locals 2012-11-25 22:16:08 +01:00
Wolfgang (Blub) Bumiller
c62e0a93eb Allow 'var' in functions... even there initialized locals seem to be constant by default... laaaaaaaame 2012-11-25 22:15:08 +01:00
Wolfgang (Blub) Bumiller
797ceb9e04 handling TOKEN_CHARCONST - -Wmultibyte-character 2012-11-25 22:11:21 +01:00
Wolfgang (Blub) Bumiller
e2602e6b87 Filling up remaining gotos at the end of a function for when the label is defined after the goto; erroring for missing labels 2012-11-25 21:56:38 +01:00
Wolfgang (Blub) Bumiller
24f9b63475 parsing goto 2012-11-25 21:53:14 +01:00
Wolfgang (Blub) Bumiller
474d8bd6f0 ast_label, and labels later used for goto 2012-11-25 21:27:14 +01:00
Wolfgang (Blub) Bumiller
336d91494f temporarily disable the 'constant' flag when parsing the initializer to avoid the 'assigning to constant' error in a block-local constant 2012-11-25 21:10:43 +01:00
Wolfgang (Blub) Bumiller
22173df7bd Allow 'const' within function bodies 2012-11-25 21:08:30 +01:00
Wolfgang (Blub) Bumiller
3424b7227b Set the output to NULL always before parsing stuff 2012-11-25 20:48:06 +01:00
Wolfgang (Blub) Bumiller
4513fc4d0b fix wrong parameter order in parse_variable calls, dammit I hate how 'bool' and 'int' are implicitly convertible here 2012-11-25 20:29:12 +01:00
Wolfgang (Blub) Bumiller
1b72cb264a more on CV_CONST/CV_VAR, initializers to check 'constant' not just 'hasvalue' 2012-11-25 20:25:39 +01:00
Wolfgang (Blub) Bumiller
6cd432a909 const/variable qualifier flag for parse_variable 2012-11-25 20:22:47 +01:00
Wolfgang (Blub) Bumiller
779c974511 Allow dangling semicolons for now 2012-11-25 20:18:40 +01:00
Wolfgang (Blub) Bumiller
f2887f1208 a '(void)' parameter list does not mean 1 parameter of type void, but empty... xonotic needs this 2012-11-25 19:44:21 +01:00
Wolfgang (Blub) Bumiller
b59401db1b fixed: -frelaxed-switch check was in the wrong position 2012-11-25 19:42:16 +01:00
Wolfgang (Blub) Bumiller
353b1f945f assignment to constant error 2012-11-25 19:37:31 +01:00
Wolfgang (Blub) Bumiller
39f572fe99 constant flag, -finitialized-nonconstants to turn initialized globals into mutable variables 2012-11-25 19:35:00 +01:00
Wolfgang (Blub) Bumiller
6e400ca81f ast: isconst->hasvalue, const keyword will set the const flag 2012-11-25 19:30:10 +01:00
Wolfgang (Blub) Bumiller
55aa53beca Parse the 'not' keyword in if as TOKEN_IDENT 2012-11-25 19:20:00 +01:00
Wolfgang (Blub) Bumiller
ca033e5acd Some side-effect propagation for better warnings, so that comma-operators with assignments in them don't cause the -Weffectless-statement warning, and fixing ternary precedence for fte operator list 2012-11-25 19:19:36 +01:00
Wolfgang (Blub) Bumiller
63d89f9f5a Allow regular AND used on non-float types 2012-11-25 18:56:22 +01:00
Wolfgang (Blub) Bumiller
2c0a9d78df Guard translatable strings by -ftranslatable-strings, defaults to ON with -std=fteqcc 2012-11-25 18:25:01 +01:00
Wolfgang (Blub) Bumiller
66317aaef9 update noops flag while parsing a translatable string 2012-11-25 18:23:48 +01:00
Wolfgang (Blub) Bumiller
7838e772de Translatable string constants 2012-11-25 18:22:00 +01:00
Wolfgang (Blub) Bumiller
0df394dcbc parser_const_string can now create a translatable string 2012-11-25 18:17:08 +01:00
Wolfgang (Blub) Bumiller
e22af32805 Fix parsing of multi-dot field types 2012-11-25 17:43:13 +01:00
Wolfgang (Blub) Bumiller
2884556fe3 multiple dots to start a field type, ie ..float for a fieldpointer field 2012-11-25 17:37:54 +01:00
Wolfgang (Blub) Bumiller
b5d6f454a4 moving cleanvar=false out of a condition 2012-11-25 16:20:22 +01:00
Wolfgang (Blub) Bumiller
2da37129d7 a more verbose error 2012-11-25 15:58:10 +01:00
Wolfgang (Blub) Bumiller
4b619ce1cd -Wconst-var 2012-11-25 15:56:13 +01:00
Wolfgang (Blub) Bumiller
f6a374c1d5 free the _locals vector 2012-11-25 15:31:26 +01:00
Wolfgang (Blub) Bumiller
3c0c002e2f Fix a missing uninitialized value which caused typedefs within functions to cause a segfault 2012-11-25 15:30:31 +01:00
Wolfgang (Blub) Bumiller
63d9e44f56 Allow typedefs to shadow defs of previous scopes 2012-11-25 15:27:22 +01:00
Wolfgang (Blub) Bumiller
b851f542ac Implementing typedef 2012-11-25 15:21:52 +01:00
Wolfgang (Blub) Bumiller
d69b576d6b Fix some uninitialized values 2012-11-25 13:55:29 +01:00
Wolfgang (Blub) Bumiller
613e1e7247 Change the parser to use the hashtable functions 2012-11-25 13:23:37 +01:00
Dale Weiler
5c0a62be96 Add respective license headers + some cleanups 2012-11-24 21:22:35 +00:00
Wolfgang (Blub) Bumiller
86f3ef2194 turn the message about global variable double-declaration into a warning instead of an error on std != gmqcc 2012-11-23 22:30:35 +01:00
Wolfgang (Blub) Bumiller
39b8b6a660 warn about double function declarations... 2012-11-23 22:22:22 +01:00
Wolfgang (Blub) Bumiller
2bc99076cf 'var' is now no keyword anymore, :\ 2012-11-23 22:07:35 +01:00
Wolfgang (Blub) Bumiller
1c7e9c5fde handling 'const' - still need correct separation of constant and just initialized later when we distinguish between them 2012-11-23 21:52:16 +01:00
Wolfgang (Blub) Bumiller
6df6906ed2 Adding an unrecognized keywords error 2012-11-23 21:41:50 +01:00
Wolfgang (Blub) Bumiller
0d33939b1b operator &~= 2012-11-23 14:39:05 +01:00
Wolfgang (Blub) Bumiller
122e80cc4d operators &= and |= 2012-11-23 14:28:11 +01:00
Wolfgang (Blub) Bumiller
553f3df5df *= and /= operators 2012-11-23 14:24:58 +01:00
Wolfgang (Blub) Bumiller
1223e04e05 correcting an error message 2012-11-23 12:28:51 +01:00
Wolfgang (Blub) Bumiller
f22f1af891 Suffix operators, and remembering the const-float-1 in parser_t 2012-11-23 12:25:13 +01:00
Wolfgang (Blub) Bumiller
4079835c7e Parsing of suffix operators, NOTE: applied like prefix operators just to get it committed in a compilable state 2012-11-23 11:57:08 +01:00
Wolfgang (Blub) Bumiller
38f5090778 Prefix ++,-- 2012-11-23 11:52:03 +01:00
Wolfgang (Blub) Bumiller
9a43eb6370 a type_name -> ast_type_to_string conversion 2012-11-23 11:45:22 +01:00
Dale Weiler
c748293ccb Use memcmp for comparing doubles 2012-11-23 06:41:06 +00:00
Dale Weiler
b5507b3127 Make it compile with -Wall and -pedantic 2012-11-23 02:23:22 +00:00
Wolfgang (Blub) Bumiller
905ca8819b unused params in parser.c 2012-11-22 21:44:09 +01:00
Wolfgang (Blub) Bumiller
dfde3a583c Remove unused macro 2012-11-22 21:10:37 +01:00
Wolfgang (Blub) Bumiller
07d5686a47 Fixing shadows in parser.c - moving generate_checksum over the static parser global 2012-11-22 20:47:46 +01:00
Wolfgang (Blub) Bumiller
6983142c4d -dump vs -dumpfin; to see the IR before and after finalizing functions 2012-11-21 21:53:38 +01:00
Wolfgang (Blub) Bumiller
9c8dc43775 error if the ternary operands aren't of the same type - except for the first one of course 2012-11-21 20:56:51 +01:00
Wolfgang (Blub) Bumiller
0787038934 check 'ternaries' count 2012-11-21 20:50:27 +01:00
Wolfgang (Blub) Bumiller
90bd91e294 Utilizing vec_last more 2012-11-21 20:44:43 +01:00
Wolfgang (Blub) Bumiller
55c2148016 operator handling for ternary 2012-11-21 20:41:26 +01:00
Wolfgang (Blub) Bumiller
11f1af78d5 Removing some obsolete messages 2012-11-21 20:40:10 +01:00
Wolfgang (Blub) Bumiller
e0ddf32d2e parsing the ternary 2012-11-21 20:36:42 +01:00
Wolfgang (Blub) Bumiller
f4043faf0b -frelaxed-switch to enable switch on non-constant cases 2012-11-19 22:27:58 +01:00
Wolfgang (Blub) Bumiller
4649c12fa9 Parsing of switches 2012-11-19 22:06:29 +01:00
Wolfgang (Blub) Bumiller
b72900214b fix a warning and remove unused variables 2012-11-19 19:44:26 +01:00
Wolfgang (Blub) Bumiller
ea75003cf4 break and continue support 2012-11-19 19:39:52 +01:00
Wolfgang (Blub) Bumiller
2d8bf20d43 moving 'return' parsing into a function 2012-11-19 19:22:00 +01:00
Wolfgang (Blub) Bumiller
f023004a67 Make functions copy their extparams 2012-11-18 20:06:28 +01:00
Wolfgang (Blub) Bumiller
e8d1e5dbc0 Make the >8 parameter message a warning 2012-11-18 19:19:38 +01:00
Wolfgang (Blub) Bumiller
0330b082a2 The ftepp now always outputs into a string buffer, with -E the buffer will be dumped to stdout or the via -o specified file, without -E it'll be passed to the parser to be compiled 2012-11-18 13:33:53 +01:00
Wolfgang (Blub) Bumiller
f0d56d07fe Merge branch 'master' into ftepp 2012-11-18 13:06:29 +01:00
Wolfgang (Blub) Bumiller
cec58b53e4 Collect accessor functions in the parser so they can later be deleted, fixed that leak 2012-11-18 13:06:16 +01:00
Wolfgang (Blub) Bumiller
f47a20aa53 Removing some code duplication 2012-11-18 13:00:18 +01:00
Wolfgang (Blub) Bumiller
2b65ea599f Some printf/con_out/con_err conversions, guarded some outputs with not-opts_pp_only so the -E switch can print to stdout normally 2012-11-18 11:43:46 +01:00
Wolfgang (Blub) Bumiller
906f319673 Replaced it all... 2012-11-15 18:32:09 +01:00
Dale Weiler
2e84cc0b41 Use new console system everywhere. 2012-11-15 00:28:46 +00:00
Wolfgang (Blub) Bumiller
84088cb5f0 Merging in new-syntax 2012-11-14 21:39:16 +01:00
Dale Weiler
f0750209b7 preliminary segregated console subsystem 2012-11-14 19:17:43 +00:00
Wolfgang (Blub) Bumiller
f3ebbf598f if not() support 2012-11-13 18:55:55 +01:00
Wolfgang (Blub) Bumiller
e7d558dbd8 if not() support 2012-11-13 18:54:25 +01:00
Wolfgang (Blub) Bumiller
51ba2c49d6 improve the warning 2012-11-13 14:46:14 +01:00
Wolfgang (Blub) Bumiller
b1175eabfc Warn (via -Wextensions) when accessing a field-of-array's element without putting the indexed field name in parenthesis 2012-11-13 14:43:20 +01:00
Wolfgang (Blub) Bumiller
b0326c66ed when finishing an array-indexing operation the parser now calls rotate_entfield_array_index_nodes to fixup 'ent.foo[n]' to become 'ent.(foo[n])' 2012-11-13 00:39:39 +01:00
Wolfgang (Blub) Bumiller
d60a76abd1 allowing inexing of array-fields 2012-11-12 23:35:47 +01:00
Wolfgang (Blub) Bumiller
dbdcdb059e array-field setter needs to use STOREP* 2012-11-12 23:05:44 +01:00
Wolfgang (Blub) Bumiller
0340a6a6e7 support for ast_entfield nodes with specific output types, fixing array-field instantiating code to print the correct name on error 2012-11-12 22:39:43 +01:00
Wolfgang (Blub) Bumiller
89d86420ad entity-array-field-setter generation 2012-11-12 22:31:54 +01:00
Wolfgang (Blub) Bumiller
3579e495be code to instantiate field-array accessors 2012-11-12 22:24:11 +01:00
Wolfgang (Blub) Bumiller
0de1ebbc21 Preparing to generate accessors for field arrays 2012-11-12 22:16:18 +01:00
Wolfgang (Blub) Bumiller
f026ca2fc5 more factorizing and shortening of code 2012-11-12 21:12:25 +01:00
Wolfgang (Blub) Bumiller
c18c89cd62 shorten some code 2012-11-12 20:51:12 +01:00
Wolfgang (Blub) Bumiller
83438d9833 call ir_function_finalize on array accessors otherwise they'll blow up stuff 2012-11-11 23:46:03 +01:00
Wolfgang (Blub) Bumiller
511058c018 handling of op-[ 2012-11-11 18:54:08 +01:00
Wolfgang (Blub) Bumiller
d5b95f0412 Handling [ in the SYA 2012-11-11 18:45:43 +01:00
Wolfgang (Blub) Bumiller
2994d308a0 array index opening-paren can now return TOKEN_OPERATOR, partially handled in SYA 2012-11-11 16:43:16 +01:00
Wolfgang (Blub) Bumiller
533f9f2cfc SY_PAREN_ constants to replace magic numbers 2012-11-11 16:36:20 +01:00
Wolfgang (Blub) Bumiller
1ab303c528 Store accessors in the ast_value for access from within the ast - generate accessors after generating all the globals to not mess up the order of globals in the output 2012-11-11 16:22:09 +01:00
Wolfgang (Blub) Bumiller
7d9568f806 array accessor function genaration 2012-11-11 16:06:27 +01:00
Wolfgang (Blub) Bumiller
9324a96f77 properly in all situations where an array is part of a function's return type 2012-11-11 14:17:48 +01:00
Wolfgang (Blub) Bumiller
86e42ad123 Don't allow arrays and other unsupported parameter types to be used in parameter lists 2012-11-11 14:08:02 +01:00
Wolfgang (Blub) Bumiller
df77e062dc Starting to add error messages for when using array types in expressions 2012-11-11 12:32:47 +01:00
Wolfgang (Blub) Bumiller
fb264b90b9 need to use ast_unref rather than ast_delete on the parsed array-size otherwise we end up deleting constants 2012-11-11 12:13:34 +01:00
Wolfgang (Blub) Bumiller
cf1ea01de3 parser_compile_file vs parser_compile_string 2012-11-11 10:33:29 +01:00
Wolfgang (Blub) Bumiller
00a28e48ee parse arrays 2012-11-11 10:13:01 +01:00
Wolfgang (Blub) Bumiller
2cb15e8c2d first parsing of [ - pushing temp changes 2012-11-11 10:13:01 +01:00
Wolfgang (Blub) Bumiller
1869440fd9 Preparing to parse arrays: adding TYPE_ARRAY and union/struct TYPE_ constants to be consistent with fteqcc, filled type-arrays with their data, attempting to parse an array variable and added some error messages to the IR in case of unhandled types 2012-11-11 10:13:01 +01:00
Wolfgang (Blub) Bumiller
c87b056fdc Support non-const initialized locals 2012-11-11 10:13:01 +01:00
Wolfgang (Blub) Bumiller
8687aa9a3e Shouldn't require a 'local' keyword for local fieldpointers 2012-11-11 10:13:01 +01:00
Wolfgang (Blub) Bumiller
a27750966f globals of type .vector will now properly generate 3 globals 2012-11-11 10:13:00 +01:00
Wolfgang (Blub) Bumiller
52daf02444 Support in the AST for TYPE_FIELD globals which are no actual fields 2012-11-11 10:13:00 +01:00
Wolfgang (Blub) Bumiller
fe05d5afd9 added 'var' to the keywords when not in -std=qcc, supporting 'var .float x;' in global-scope to declare a field-pointer variable without creating a field of that name 2012-11-11 10:13:00 +01:00
Wolfgang (Blub) Bumiller
76b21ad192 -std=qcc now errors on C-style function syntax 2012-11-11 10:13:00 +01:00
Wolfgang (Blub) Bumiller
0bb90f284e -std=qcc should error when the '=' is missing in a function declaration before the body 2012-11-11 10:13:00 +01:00
Wolfgang (Blub) Bumiller
0fc3a0c517 Removing old commented-out parsing code 2012-11-11 10:13:00 +01:00
Wolfgang (Blub) Bumiller
016257c44e Making the = in front of function bodies optional 2012-11-11 10:13:00 +01:00
Wolfgang (Blub) Bumiller
7f4047381e new-style syntax 2012-11-11 10:13:00 +01:00
Wolfgang (Blub) Bumiller
e87fd30c48 Enable 'local-already-declared' check for locals even when they are functions - this was previously simply in the wrong 'if' 2012-11-11 10:13:00 +01:00
Wolfgang (Blub) Bumiller
8e30d7cb86 fixing a stupid typo - why doesn't any compiler warn about this crap 2012-11-11 10:12:45 +01:00
Wolfgang (Blub) Bumiller
9141217481 Merged parsing of variable and field declarations into 1 function 2012-11-09 19:10:27 +01:00
Wolfgang (Blub) Bumiller
e143db0cae gcc lost it's magic analyzer and now complains about uninitialized stuff... <sadface> 2012-11-04 11:41:44 +01:00
Wolfgang (Blub) Bumiller
5ff0013357 error on more than 8 params for now since more need special treatment 2012-11-02 22:51:26 +01:00
Wolfgang (Blub) Bumiller
2fa544f681 Error when trying to assign variables whose types are different - with -std=qcc only warn when they are both functions with non-matching parameter types 2012-10-28 20:32:13 +01:00
Wolfgang (Blub) Bumiller
cd8043fc18 a failing 'parse-statement' call should not print 'parse error' at all since at that point more descriptive error message has to have been printed already 2012-10-28 15:53:30 +01:00
Wolfgang (Blub) Bumiller
634a544dca The proper way to deal with error messages which did not cause the parser to bail out early is this, not a 'parse error'-error... 2012-10-28 15:48:51 +01:00
Wolfgang (Blub) Bumiller
478a9249a0 add error for function parameters of invalid types 2012-10-28 15:44:27 +01:00
Wolfgang (Blub) Bumiller
201bfb9803 When erroring while parsing a function and the function had been added to the parser's function list, remove it, otherwise it'll get freed again in the parser's cleanup function 2012-10-28 15:28:39 +01:00
Wolfgang (Blub) Bumiller
5dd8e23dfd Cleaner crc implementation 2012-10-02 17:51:03 +02:00
Wolfgang (Blub) Bumiller
354dd94b95 Generating checksums 2012-10-02 17:09:49 +02:00
Wolfgang (Blub) Bumiller
9d70c3a56e Print a warning if end_sys_fields was declared as a field rather than a global 2012-10-02 15:59:37 +02:00
Wolfgang (Blub) Bumiller
4742ee9123 don't warn about unused end_sys_{globals,fields} 2012-10-02 15:35:43 +02:00
Wolfgang (Blub) Bumiller
ab91dea4e0 the lexer now doesn't _allocate_ the token structure, also: the vector holding the token doesn't shrink so we have much fewer reallocations 2012-08-24 17:37:55 +02:00
Wolfgang (Blub) Bumiller
20b8a191b1 parse_variable refactored, moved out the parsing of function bodies, easier memory handling 2012-08-24 17:23:47 +02:00
Wolfgang (Blub) Bumiller
e1155eebc2 renaming some parser functions, mainly shortining things: parse_type just looks much better than parser_parse_type... 2012-08-24 15:34:48 +02:00