Commit graph

487 commits

Author SHA1 Message Date
Wolfgang Bumiller
edfe340d09 Fix a warning 2013-01-26 14:43:49 +01:00
Wolfgang Bumiller
b39b61e514 store the actual parsing context before parsing into an expression and use that for the effectless-statement warning 2013-01-25 23:37:06 +01:00
Wolfgang Bumiller
9afe41471b error when using a type not usable as boolean in a condition, ie an if statement 2013-01-25 19:19:23 +01:00
Wolfgang Bumiller
dca9dd56d1 adding missing wantop flag and some related parentheses code 2013-01-18 15:22:03 +01:00
Wolfgang Bumiller
ba207cc04c Major expression parsing code refactoring, getting rid of lots of duplicated code and in the process also fixing a bug. Still thie will require more testing. xonotic code works with it though 2013-01-18 14:50:37 +01:00
Wolfgang Bumiller
1410840ef6 Make the varargs counter more stable, it'll now work with a function pointer with a different number of fixed params 2013-01-17 10:30:32 +01:00
Wolfgang Bumiller
00a9d2a9e3 fixing a possible NULL deref 2013-01-16 20:32:37 +01:00
Wolfgang Bumiller
e311dffcb3 fixing a warning 2013-01-16 16:16:52 +01:00
Wolfgang Bumiller
0ba8455f6a initialize max_param_count to 1 so vararg functions don't try to create an accessor for an array of 0 elements... 2013-01-16 09:37:32 +01:00
Wolfgang Bumiller
e695a5919d reduce the hashtable size a bit 2013-01-15 20:35:30 +01:00
Wolfgang Bumiller
73afc98699 fix: on error it was possible that leaveblock() is called after the function's already been deleted 2013-01-15 14:28:15 +01:00
Wolfgang Bumiller
150c6e21e7 fix a goto to a wrong error-cleanup part 2013-01-15 14:23:17 +01:00
Wolfgang Bumiller
c7ca5683b9 fix a possible leak 2013-01-15 14:20:08 +01:00
Wolfgang Bumiller
0f190026e8 Error on an empty paren expression 2013-01-15 14:18:03 +01:00
Wolfgang Bumiller
ee7d45f492 add a hint about -fvariadic-args to -Wvariadic-function 2013-01-15 11:35:18 +01:00
Wolfgang Bumiller
b208c1a49f Fix a crash... if (!x) delete(x) yeah right... 2013-01-15 10:50:14 +01:00
Wolfgang Bumiller
ab8cc64dfd constant-fold the 1/N division from a_vector/N 2013-01-13 20:53:07 +01:00
Wolfgang Bumiller
3d62cb37f1 allow vec/float 2013-01-13 20:49:16 +01:00
Wolfgang Bumiller
12ffd83d4f parsewarning->compile_warning 2013-01-13 17:32:54 +01:00
Wolfgang Bumiller
8d4e395092 Replacing lots of parseerror calls with compile_error calls and a more correct context information 2013-01-13 17:31:31 +01:00
Wolfgang Bumiller
3652a122ed Removed -fenhanced-diagnostics - it's now --correct, which makes sense since it doesn't affect the compilation process itself 2013-01-12 17:10:07 +01:00
Wolfgang Bumiller
4df6d1e028 guarding vararg code by -fvariadic-args 2013-01-12 16:28:04 +01:00
Wolfgang Bumiller
7dd31ccf77 entity setter array subscript needs to get a correct field type 2013-01-12 15:49:31 +01:00
Wolfgang Bumiller
a01388ea7d Copying arg counter into the local 2013-01-12 15:06:19 +01:00
Wolfgang Bumiller
57c0a09800 Creating the argument counter if requested 2013-01-12 14:59:30 +01:00
Wolfgang Bumiller
e149551744 Added '...(idx,type)' to access varargs 2013-01-12 14:53:48 +01:00
Wolfgang Bumiller
1861660585 builtins are generally not declared const, so don't expect CV_CONST, otherwise we write out va_count for builtin calls as well... 2013-01-12 13:52:42 +01:00
Wolfgang Bumiller
c10d127fd7 While at it: moving generation of reserved:version to just before the functions so no global/immedate is generated _after_ it - at least from the parser's point of view 2013-01-12 13:49:06 +01:00
Wolfgang Bumiller
d78997599a create store to reserved:va_count; fix: don't build vararg accessor ast tree after generating immediates as they create new ones 2013-01-12 13:47:56 +01:00
Wolfgang Bumiller
6dfdf69a8e vararg accessor generation 2013-01-12 13:01:20 +01:00
Wolfgang Bumiller
c69ba2c734 parsing of vararg-counter 2013-01-12 11:29:03 +01:00
Wolfgang Bumiller
ca947d782c Declaration of type-restricted varargs 2013-01-12 11:03:17 +01:00
Wolfgang Bumiller
2f9db8972e keep track of the highest parameter count of calls for later for varargs 2013-01-12 10:58:01 +01:00
Wolfgang Bumiller
3429e7d0cb 'static' shouldn't be accepted in the global scope for now 2013-01-12 10:52:18 +01:00
Wolfgang Bumiller
3436fa7d89 added the --add-info compile switch: it adds a global const string named version to the 'reserved' namespace, ie ends up named 'reserved:version', containing the --version string 2013-01-11 19:18:51 +01:00
Wolfgang Bumiller
88cfa53dc2 replacing an error message in the enum parsing 2013-01-10 22:08:49 +01:00
Wolfgang Bumiller
9c2bc7f381 Allow accessing vector components via the . operator, including components
of expressions, like: (3 * a_vector).y.
2013-01-10 21:03:35 +01:00
Wolfgang Bumiller
aa8b9eb1ad parse_expression_leave: also end at a closing } - enum: check for } and , after an expression again 2013-01-10 18:52:43 +01:00
Wolfgang Bumiller
a468d0b478 simple 'enum' implementation 2013-01-10 18:38:57 +01:00
Wolfgang Bumiller
81cc4194dc fixed a bug which allowed some statements to end in tokens other than semicolons... (ie closing parens) 2013-01-10 15:23:04 +01:00
Wolfgang Bumiller
428453a132 for compile-time constants << and >> are now available 2013-01-10 15:12:19 +01:00
Wolfgang Bumiller
10c7f4f838 don't call correct_edit anew for each scope 2013-01-09 21:16:22 +01:00
Wolfgang Bumiller
6b0a522bb9 Factor out the adding of globals in various places into parser_addglobal; Add globals to the correct_variables lists 2013-01-09 20:42:33 +01:00
Wolfgang Bumiller
be6942d972 fixing a crash caused by the correction: setting correct=NULL after freeing so the later if(correct) check properly fails 2013-01-09 19:12:27 +01:00
Wolfgang Bumiller
57c3d48711 error when trying to break/continue outside of loops/switches instead of segfaulting at codegen 2013-01-07 15:19:53 +01:00
Wolfgang Bumiller
f4d1ef4740 Fix some possible NULL access in an error case 2013-01-07 00:22:16 +01:00
Wolfgang Bumiller
8bc9d4b427 Committing an evil allocator and a trie to speed up the correction stuff 2013-01-05 19:09:36 +01:00
Dale Weiler
793547a132 Implemented -f[no]enhanced-diagnostics, to enable/disable the usage of enhanced diagnostics. 2013-01-04 12:07:42 +00:00
Dale Weiler
5377835f1e Remove constant string literal for correction check, use parse_tokval of the current parser state instead. Accidently left it behind from debugging. 2013-01-04 11:58:27 +00:00
Dale Weiler
2d96b2a3ec Merge branch 'correct' 2013-01-04 11:56:07 +00:00