Commit graph

686 commits

Author SHA1 Message Date
Dale Weiler
8bee9a6819 fix the intrinsic fail 2013-04-24 09:18:24 +00:00
Dale Weiler
dc8523c650 Merge branch 'master' into cooking 2013-04-24 01:46:53 +00:00
Dale Weiler
489ad486bc Get it compiling in visual studio again. 2013-04-24 01:43:53 +00:00
Dale Weiler
10738da2fb Make it compile as C++ code too 2013-04-23 22:50:47 +00:00
Wolfgang Bumiller
f6d554874b initialize the vector member array so that 'cleanup' won't delete uninitialized pointers 2013-04-23 16:54:05 +02:00
Dale Weiler
160e7cf7ee Remove trailing whitespace 2013-04-21 10:24:55 +00:00
Wolfgang Bumiller
46752af74b parser_const_string now uses hashtables; hashtables may want to dup an empty string without it becoming NULL - also replacing ir_strdup with the new util_ one 2013-04-17 18:23:30 +02:00
Dale Weiler
1f0a1b8140 Perliminary parser reworking, required for the proposed multithreading. 2013-04-17 00:52:52 +00:00
Wolfgang Bumiller
1f667c4b35 ast_expression_delete: delete varparam if it is set - fixes another leak 2013-04-15 21:05:59 +02:00
Dale Weiler
ef528d6710 Added tracing to strdup for allocations, fixed some memleaks, this isn't pretty (trying to track down some weird memory leak issues) 2013-04-14 23:51:16 +00:00
Dale Weiler
cbeac3e5f2 Implemented smart intrinsic / builtin system. When you use trivial math functions like "pow", if they don't exist as a builtin, the compiler will implement its own versions, likewise, if a compiler builtin depends on a function that exists, it will use it, likewise if it doesn't it will implement it. If you explicitally use __builtin_ (prefixed) versions, the compiler again will select the best option it can, be it a combination of both builtins and compiler builtins, all compiler builtins, OR, all builtins (most performant). 2013-03-09 08:53:39 +00:00
Dale Weiler
d8d78f61a7 Implemented "reverse" enum attribute, e.g enum : reverse { A, B, C, D } -> A,B,C,D = 3,2,1,0 2013-03-09 05:07:14 +00:00
Dale Weiler
662612d66f Better diagnostic when "floor" cannot be found. 2013-03-08 09:23:35 +00:00
Dale Weiler
f19adcd1b3 Implemented __builtin_mod, and % operator. Added floor builtin to the standalone executor. Mod works so long as the compiler can find a suitable definition of "float floor(float)", otherwise it prints a diagnostic and gives up (original id1 Quake had floor so we can depend on it). 2013-03-08 09:17:54 +00:00
Dale Weiler
b971ddec3a Implemented concept of enumeration attributes (can be further extended, but currently only "flag" is implemented as an attribute). An enumeration with a flag attribute will act as a "flagged enumeration", one that automatically handles exponentiation of the constants defined inside it, i.e enum : flag { A, B, C }, A,B,C will equal 2, 4, 8. 2013-03-08 08:01:45 +00:00
Dale Weiler
479f3b9343 Implemented __builtin_exp 2013-03-08 03:46:25 +00:00
Dale Weiler
12340a6bd0 Actually generate an ast_call for __builtin_pow for the ** operator, otherwise the operator yeilds a ast_function, making "a ** b" not work, but since it's a function, allows **(a, b). Also added tests for exponentiation operator. 2013-03-07 23:05:40 +00:00
Dale Weiler
d3c7b6fb39 Implement exponentiation operator ** as well as __builtin_pow (used for exponentiation operator). Use of exponentiation operator with constants results in const folded (precomputed at compile time exponentiation), otherwise runtime exponentiation with some clever loops (slow!). 2013-03-07 21:31:19 +00:00
Dale Weiler
eb0e3c2898 Make it compile as C++ code again. 2013-02-06 10:36:27 +00:00
Wolfgang Bumiller
9bc774dcd3 find aliases in parser_find_global instead of parser_sya_operand 2013-02-06 10:55:06 +01:00
Dale Weiler
cb1a6a6a6b Store the ast nodes for aliases 2013-02-06 09:44:23 +00:00
Dale Weiler
1e60bafcdc Aliases to aliases is a bad idea, revert. Added better tests to show unused aliases 2013-02-06 09:28:42 +00:00
Dale Weiler
21e890602d Fix alias bug. Implemented support for aliases of vectors (x, y, z components). Also made aliases corrector resident (e.g alias to vector foo, named bop, indexing bol_x [instead of bop_x] will result in a correction suggestion of bop_x now). 2013-02-06 09:09:47 +00:00
Dale Weiler
6fc141733f Support for aliases to aliases too. 2013-02-06 08:43:11 +00:00
Dale Weiler
060bc0be10 Some sanity checks for aliases (undeclared variable checks, and incompatible types in alias checks.) 2013-02-06 05:51:05 +00:00
Dale Weiler
3dc8e9bb9c add todo 2013-02-06 05:38:34 +00:00
Dale Weiler
e464cc1ea6 Implemented generalized attribute aliases. You can now alias functions, locals, or globals with [[alias("old_name")]] type new_name; 2013-02-06 05:30:09 +00:00
Dale Weiler
52ffc6db10 Merge branch 'cooking' of github.com:graphitemaster/gmqcc into cooking 2013-02-05 17:16:09 +00:00
Dale Weiler
b3e87c3280 ast referencing 2013-02-05 17:14:56 +00:00
Wolfgang Bumiller
4b5afe3456 ast_array_index_codegen: never regenerate code 2013-02-05 17:54:14 +01:00
Dale Weiler
e2c424d607 Merge branch 'cooking' of github.com:graphitemaster/gmqcc into cooking 2013-02-05 16:35:12 +00:00
Dale Weiler
8e87082e1d Merge branch 'cooking' of github.com:graphitemaster/gmqcc into cooking
Conflicts:
	parser.c
2013-02-05 16:34:55 +00:00
Wolfgang Bumiller
72106b0982 removing some left-over alloc checks 2013-02-05 17:34:40 +01:00
Dale Weiler
fed0f8b6b4 Work in progress <=> operator. 2013-02-05 16:34:03 +00:00
Wolfgang Bumiller
f860759758 fixing that comment 2013-02-05 17:24:02 +01:00
Wolfgang Bumiller
15141897ae insert an error when an operator doesn't get found - note the comment... 2013-02-05 17:17:38 +01:00
Dale Weiler
31ce4c2afa Better handling of multiple body functions. 2013-02-05 03:28:20 +00:00
Wolfgang Bumiller
e662efae61 fix: rotate_entfield_array_index_nodes deleting the old array caused expressions to be deleted recursively 2013-02-03 23:38:06 +01:00
Dale Weiler
319783e873 Better printing of token errors. 2013-02-02 01:03:39 +00:00
Dale Weiler
ccdfd4c65a oops 2013-02-01 23:12:48 +00:00
Dale Weiler
a3559548a8 Fix ~ unary operator (can now const-fold). Also things like b &= ~1 work now. We also cache ast_value of float (-1) for -1-x (which is how ~ is implemented). 2013-02-01 23:10:23 +00:00
Dale Weiler
03b933bc7a Work in progress ~ operator implemented as -1-x. 2013-02-01 12:56:01 +00:00
Dale Weiler
b9f46f4ef7 Not an assembler instruction, but virtual instruction used by the IR. 2013-01-30 06:31:24 +00:00
Dale Weiler
9f5f2b6d74 Fix pragma parsing that I broke. 2013-01-30 05:51:28 +00:00
Dale Weiler
e12d492d67 Removing #error/#warning/#message from parser, and making it part of preprocessor as directives again. 2013-01-30 05:49:08 +00:00
Dale Weiler
36c5722273 Rename 2013-01-30 05:35:07 +00:00
Dale Weiler
d201cfe6b4 Work in progress options cleanup. 2013-01-30 05:24:30 +00:00
Dale Weiler
f3c5c40104 Fix splint warning 2013-01-30 01:38:37 +00:00
Dale Weiler
3d35804a7d Removed #warning and #error from ftepp, and made it part of the parser routine. These are "directives" that should exist regardless if -fftepp is enabled, like #pragma. Implemented #warning, #message and #error as directives in parser instead. 2013-01-30 01:24:58 +00:00
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
Dale Weiler
36d02d010e Got rid of all the memleaks. We can now merge with master. 2013-01-04 11:53:40 +00:00
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