Commit graph

452 commits

Author SHA1 Message Date
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