Commit graph

379 commits

Author SHA1 Message Date
Wolfgang Bumiller
1caf1b3ebe util_strdup: don't use util_memory_a with -DNOTRACK 2013-04-15 20:53:53 +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
7ba7fd5968 Fet rid of explicit file stream flushes, streams are flushed on exit, which we can always gurantee. 2013-04-14 01:32:29 +00:00
Dale Weiler
eb2a74f7e7 Flatten more external functions 2013-04-14 01:25:11 +00:00
Dale Weiler
3e7340c52c More external function flatening (less external symbols) 2013-04-14 01:07:39 +00:00
Dale Weiler
aebab8b68a Push definitions when -O0 2013-02-25 08:52:17 +00:00
Dale Weiler
5acde18ef1 Sigh 2013-02-10 02:09:12 +00:00
Dale Weiler
b0c6dc5ab2 Fix mem leak. 2013-02-10 02:08:17 +00:00
Dale Weiler
8d59d7029d Cleanup cargocult directory and file specific things, to fs.c (renamed file.c which also contains directory handling stuff). Also cleaned up some stuff, and added proper end comments to conditional inclusion stuff. 2013-02-08 12:06:59 +00:00
Wolfgang Bumiller
46892daa3a Reverting this awful unmaintainable mess of option description system 2013-02-04 00:19:56 +01:00
Dale Weiler
a6ecc3cbc4 Cache lengths in corrector. This speeds up the corrector a little. 2013-01-30 23:22:03 +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
18c317a787 Empty string, not "<null>" 2013-01-30 06:28:02 +00:00
Dale Weiler
8c6f4c3fc3 Cleanups 2013-01-30 06:27:06 +00:00
Dale Weiler
44c87bedfc It is used, gcc is a liar. 2013-01-30 06:14:35 +00:00
Dale Weiler
98fd5cd429 Some cleanups and what not. 2013-01-30 06:13:11 +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
480b2fc7b6 Added documentation to all options inside the binary itself. These will be used later for "man/nroff -man"-like documentation on OSs that lack "man" and the concept of system wide documentation. Also it will be nice to add -Wsome_warning help (to get some help about a specific warning/error, etc). 2013-01-30 02:56:58 +00:00
Wolfgang Bumiller
06f53b1a28 When not actually executing, don't complain about invalid progs.dat versions for now. 2013-01-17 17:36:06 +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
199ed6c31f Fix a typo - why the hell does clang not complain? Why the hell does it even compile with clang... 2013-01-11 20:04:46 +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
5ea710e317 In order to avoid release version strings in non-git builds, by default --version on non-tagged commits now also prints 'development build' as the 2nd line 2013-01-11 10:40:33 +01:00
Wolfgang Bumiller
1c1ea1d0f7 strictness sweep: (void)-ing all vec_ macros which don't evaluate to a sensible value 2013-01-10 18:26:35 +01:00
Wolfgang Bumiller
7a5a328c54 --version now prints GMQCC_GITINFO, which is not not defined in gmqcc.h to some empty string, it just won't exist in release builds 2013-01-10 16:07:33 +01:00
Wolfgang Bumiller
10c7f4f838 don't call correct_edit anew for each scope 2013-01-09 21:16:22 +01:00
Wolfgang Bumiller
4f7113116d -Wall now does not set -Wuninitialized-global 2013-01-09 20:39:17 +01:00
Wolfgang Bumiller
9c8ddb3771 An evil optimization to the trie, now has a fixed amount of branches and uses a char-to-index map to index into the branches... 2013-01-06 13:07:28 +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
d97e032fcf Cleanups and add the corrector to the makefile. Starting integration with the parser. 2013-01-04 10:05:41 +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
ae09831227 Introducing TYPE_NOEXPR so that these undefined labels cannot be used on the expression side of goto ternary expressions; ast_label now is TYPE_NOEXPR; we may consider setting ast_ifthen to that too unless we want ifthen to return a value... 2013-01-03 12:49:21 +01:00
Dale Weiler
467a4740da Fix some issues 2013-01-02 16:34:55 +00:00
Dale Weiler
686394654f Implemented a optimized hash-set that can be used in various parts of the compiler (to get a little more speed). I intend this to replace the hackery that is code_genstring, and code_util_str_htgeth. 2013-01-01 07:59:04 +00:00
Dale Weiler
29db4a44ed Happy new years! 2013-01-01 05:08:55 +00:00
Dale Weiler
1182ab55c5 Fix #include for <machine/endian.h> s/endiane/endian/ 2012-12-31 14:40:08 +00:00
Wolfgang Bumiller
e37adb8c47 GMQCC_GITINFO 2012-12-28 20:39:30 +01:00
Wolfgang Bumiller
40b2a26e89 TYPE_NIL, builder->nil, ast_value_codegen for TYPE_NIL 2012-12-28 18:05:28 +01:00
Dale Weiler
8f34e9fa37 added util_vasprintf/util_asprintf .. so we can stop assuming a certian static array size for formatting strings ... I expect to see full migration to this before the next release for protection of over/under flows. As well as identifers >= 1024 bytes :) 2012-12-28 15:02:53 +00:00
Dale Weiler
566dda6ad7 Working on getting gmqcc to work when compiled with tcc 2012-12-28 09:30:01 +00:00
Wolfgang Bumiller
5cfd97c344 -fbail-on-werror option 2012-12-27 12:46:36 +01:00
Wolfgang Bumiller
b42328dbc6 Switch over to LONGBIT 2012-12-26 21:39:00 +01:00
Wolfgang Bumiller
2d66431af4 -q, --quiet option 2012-12-24 10:53:51 +01:00
Dale Weiler
fa155f8a42 Added my awesome MT1997 PRNG, and use it instead of stdio's rand()/srand() .. which are implementation specific .. and simply unsafe (for example one of the compilers at work simply has it's standard library implementation of rand() return 0 always (which is perfectly conformant)). 2012-12-24 01:43:27 +00:00
Wolfgang Bumiller
d3568627e9 code_genstring now caches strings, no need for code_cachestring 2012-12-23 21:42:00 +01:00
Wolfgang Bumiller
cff74493a7 Even safer vector macros 2012-12-23 20:55:15 +01:00
Wolfgang Bumiller
46c2fe2443 Fixing vector macros 2012-12-23 20:49:50 +01:00
Wolfgang Bumiller
e72d141ec4 Uchar -> uchar_t for consistency 2012-12-23 10:34:29 +01:00
Wolfgang Bumiller
a707440e52 -futf8 implementation 2012-12-23 10:23:42 +01:00
Wolfgang Bumiller
fe3d8e44e6 Importing utf8lib 2012-12-23 10:23:41 +01:00
Dale Weiler
da49a40b96 Bump 0.2 -> 0.3 2012-12-23 09:18:17 +00: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
f598fbeaea Actually fix the segfault this time 2012-12-23 08:08:05 +00:00
Dale Weiler
3b27107676 con_default_out for opts.pp_only (removes recently added TODO .. and fixes a segfault) 2012-12-23 07:57:06 +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
Dale Weiler
6951f3dfcc fix comments 2012-12-23 07:19:49 +00:00
Dale Weiler
4224ac5ca0 fixes, and removed a #pragma warning(disable ...) in MSVC .. thanks to the FILE wrapping interface. 2012-12-23 07:18:00 +00:00
Dale Weiler
d18656c2dc Cleanup flexible array / vector system 2012-12-23 07:14:16 +00:00
Dale Weiler
13003bf6af Wrapper around FILE to take advantage of MSVC "secure" CRT. We don't actually defend bounds checks (we just hack in the few ones to silent MSVC .. and to pass WinRT "native code" rules) 2012-12-23 06:05:22 +00:00
Dale Weiler
322fbaf389 More cleanups 2012-12-22 07:54:14 +00:00
Dale Weiler
7753e19ba8 Cleanups 2012-12-22 07:24:25 +00:00
Dale Weiler
88fee02228 Windows stuff for visual studio now offical works with exception to colorized output to cmd (which actually should work). As well as the testsuite which lacks implementations of task_popen/task_pclose. 2012-12-21 06:16:08 -05:00
Dale Weiler
3c003bc168 Get gmqcc/qcvm compiling on windows again. Plus work in progress support for the testsuite on windows (does not compile yet). 2012-12-21 01:00:51 -05:00
Dale Weiler
c7a62970a6 Merge branch 'master' of github.com:graphitemaster/gmqcc 2012-12-20 23:07:33 +00:00
Dale Weiler
e1f0e40341 Implemented roboust compile-time endianess check. 2012-12-20 23:07:06 +00:00
Wolfgang Bumiller
e38bdecd21 Be more correct with sizes; use a better local-alloc strategy 2012-12-20 23:48:41 +01:00
Wolfgang Bumiller
1d3fdea432 Fix util_endianswap; and endianswap the LNO data as well 2012-12-20 22:03:51 +01:00
Wolfgang Bumiller
6cd821d459 -Werror-<warning> should actually use opts_setwerror 2012-12-20 16:53:09 +01:00
Wolfgang Bumiller
b360245b45 -Werror-<warning>, -Wno-error-<warning>, manpage updated 2012-12-20 16:49:10 +01:00
Dale Weiler
2e57a952a7 No more hacks 2012-12-20 10:20:16 +00:00
Dale Weiler
9f742271b1 Another fix 2012-12-20 08:19:43 +00:00
Dale Weiler
d7585a810a FTBFS fixes 2012-12-20 08:17:04 +00:00
Wolfgang (Blub) Bumiller
afaa162aa1 Applying the actual 'Fix FTFBS stuff' part 2012-12-19 22:17:22 +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
384446316a VINSTR_NRCALL, translated like any other call for now; to be used to mark a call which never returns, ie the error builtin 2012-12-19 20:38:32 +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
dccafd65ac More jump removal 2012-12-18 14:03:20 +01:00
Dale Weiler
2587aed697 Allow setting configuration file via commandline 2012-12-18 05:22:23 +00:00
Dale Weiler
4b3e2571af Cleanups of compiler option configuration. Added ini/cfg parser system as well. 2012-12-18 04:57:17 +00:00
Wolfgang (Blub) Bumiller
fe344cb5b2 vcompile_error, vcompile_warning; fixed: removed opts_ globals from con.c; made the lexer use vcompile_warning 2012-12-17 18:22:33 +01:00
Wolfgang (Blub) Bumiller
f7bc1dca08 Revert "Not defining GMQCC_VERSION_ in gmqcc.h but checking if they're defiend and #error if not - they're set in the Makefile - please fix windows builds"
This reverts commit a473979cf5.

-- because visual studio sucks
2012-12-17 16:46:03 +01:00
Wolfgang (Blub) Bumiller
a473979cf5 Not defining GMQCC_VERSION_ in gmqcc.h but checking if they're defiend and #error if not - they're set in the Makefile - please fix windows builds 2012-12-17 16:30:07 +01:00
Dale Weiler
c1c7a93884 Implemented -D for preprocessor 2012-12-17 14:58:55 +00: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
0e4e81d94f Parsing the 'noref' keyword; this also gets rid of some code duplication 2012-12-04 12:17:43 +01:00
Wolfgang (Blub) Bumiller
6b575372cc Don't warn about uninitialized stuff in accessors - remove the liferanges calculated when finalizing accessors, this would add invalid liferanges to function-local arrays and thus suppress warnings randomly 2012-12-02 18:09:59 +01:00
Dale Weiler
37ccf19769 added __STD_VERSION_[MINOR/MAJOR]__, and vec_upload 2012-12-02 04:30:46 +00:00
Wolfgang (Blub) Bumiller
e0a7f8a484 qcvm -printfuns; prog_section_function.nargs is now signed as fteqcc sets builtins with varargs to have -1 params 2012-11-30 20:20:13 +01:00
Wolfgang (Blub) Bumiller
6fc00e523d All ir_instrs now get their lex-context, so that we can create an LNO file with -flno 2012-11-30 18:20:02 +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
03cb670096 don't use vec_size but _vec_end in _vec_remove, since using it on an empty vector is an error anyway; this causes a warning about vec_pop doing an effect-less memmove so vec_pop now doesn't use vec_remove anymore actually 2012-11-30 11:55:32 +01:00
Wolfgang (Blub) Bumiller
e1fe6cff54 Importing tail-recursion optimization 2012-11-30 11:12:53 +01:00
Wolfgang (Blub) Bumiller
a890589031 -O now, additionally to taking a number, can work like -W and -f to take an actual optimization name 2012-11-30 11:05:58 +01:00
Wolfgang (Blub) Bumiller
8e1ce2ab5e generic compile_error/compile_warning functions in con.c, issuing end-of-non-void warning from within the ast now 2012-11-26 16:12:40 +01:00
Dale Weiler
ca52ecc20a Remove trailing whitespace for Blub. 2012-11-26 11:12:06 +00:00
Wolfgang (Blub) Bumiller
7b56ad9405 Revert "Fix type punning warnings"
it's a gcc version issue...

This reverts commit 3e6d173e31.
2012-11-25 14:05:10 +01:00
Dale Weiler
3e6d173e31 Fix type punning warnings 2012-11-25 12:57:28 +00: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
Dale Weiler
9d677bab7c Added comment about hashtable 2012-11-23 20:05:53 +00:00
Dale Weiler
6e047ec65b No copy, just store pointer for hash table 2012-11-23 20:01:58 +00:00
Wolfgang (Blub) Bumiller
4a3921fcb9 Let's #define GMQCC by default 2012-11-23 19:13:09 +01:00
Dale Weiler
e25e83b14c Visual studio __forceinline can be used for GMQCC_INLINE 2012-11-23 06:48:54 +00:00
Dale Weiler
9e3399df19 Implemented hashtable as-per Blubs request 2012-11-23 06:12:01 +00:00
Wolfgang (Blub) Bumiller
968397da61 Fixing clang-warnings about vectors 2012-11-22 20:42:32 +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
Dale Weiler
2e3d572b53 Bump version 2012-11-21 20:33:52 +00:00
Wolfgang (Blub) Bumiller
ebc6954bf5 casting explicitly to boolean values in early out logic 2012-11-21 19:36:28 +01:00
Dale Weiler
61fa54318c Merge branch 'master' into test-suite
Conflicts:
	Makefile
	ir.c
2012-11-19 02:13:46 +00: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
d1373af7fc Make -E print to stdout by default and honor -o, changed handling of source list a bit 2012-11-18 12:51:38 +01:00
Wolfgang (Blub) Bumiller
366557bbab Since like with parsing, the preprocessor state has to be preserved across files for macros, we do that now, and with that introduce a new warning: -Wmultifile-if in case an #if spans over several command-line-provided source files (or progs.src file provided for that matter) 2012-11-18 11:54:11 +01:00
Dale Weiler
0dc4febb91 New test-suite initial implementation. Just need to write some tests. 2012-11-17 02:54:30 +00:00
Wolfgang (Blub) Bumiller
07ca2e6407 importing initial ftepp.c; -E option now executes the preprocessor 2012-11-16 16:57:59 +01:00
Wolfgang (Blub) Bumiller
3bd75546ec moving _vec_remove above the 'exposed interface' comment 2012-11-15 21:24:31 +01:00
Wolfgang (Blub) Bumiller
df61f3c182 Fix a typo causing NOTRACK to fail 2012-11-15 21:18:31 +01:00
Wolfgang (Blub) Bumiller
c583ae24f2 Replacing lexer's vectors and getting rid of the macros 2012-11-15 18:48:38 +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
9a42dd1c3a qcvm -trace now shows the current function name and nest-depth 2012-11-11 23:57:42 +01:00
Wolfgang (Blub) Bumiller
a7d3a2d6ea adding opts_max_array_size with a default of 1024, adding some TODO errors for arrays in the AST 2012-11-11 11:09:36 +01:00
Wolfgang (Blub) Bumiller
cf1ea01de3 parser_compile_file vs parser_compile_string 2012-11-11 10:33:29 +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
a27750966f globals of type .vector will now properly generate 3 globals 2012-11-11 10:13:00 +01:00
Dale Weiler
6b12f4435c Make warns.def and flags.def into a single opts.def. 2012-11-10 21:13:09 +00:00
Wolfgang (Blub) Bumiller
09e18e1bbf mem_r to realloc 2012-11-10 11:16:19 +01:00
Wolfgang (Blub) Bumiller
a195e296a9 -E switch to set opt_pp_only 2012-11-02 18:33:51 +01:00
Wolfgang (Blub) Bumiller
5adc3fd9c1 Don't forget to set the _alloc in vector resize, also set _alloc back in _append if mem_a had failed 2012-10-09 20:56:54 +02: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
b2cb612c70 Adding DEF_SAVEGLOBAL, marking globals as to-be-saved now, for real support of quicksaving 2012-08-23 18:28:05 +02:00
Wolfgang (Blub) Bumiller
fe2f9d79c5 fixing mem-vector resize function 2012-08-23 13:21:14 +02:00
Wolfgang (Blub) Bumiller
8b90fcf482 commenting on the quirks of MUL_VF and MUL_FV in gmqcc.h's instruction list 2012-08-22 18:34:48 +02:00
Wolfgang (Blub) Bumiller
ab714862d6 committing gmqcc.h for previous exec.c commit: qc_program gets .xflags 2012-08-22 17:49:25 +02:00
Wolfgang (Blub) Bumiller
ef3e7231bd it's SUB_V not DUB_V 2012-08-22 17:32:42 +02:00
Wolfgang (Blub) Bumiller
77e5807a83 memvector resize needs to set _count as well 2012-08-22 15:24:24 +02:00
Wolfgang (Blub) Bumiller
93e13c3cb1 option: -force-crc=number, added -info to executor to just show some file info like the crc, and -printfields to print a list of fields along with their type and position 2012-08-22 14:00:57 +02:00
Wolfgang (Blub) Bumiller
0674457c51 Fix some comment styles... 2012-08-21 10:33:37 +02:00
Wolfgang (Blub) Bumiller
b421c42d4b replacing WARN_ERROR with opts_werror 2012-08-18 14:36:33 +02:00
Wolfgang (Blub) Bumiller
0d9435d326 util_fopen... 2012-08-16 14:01:47 +02:00
Wolfgang (Blub) Bumiller
2c020837ea fopen -> fopen_s on windows 2012-08-16 13:45:45 +02:00
Wolfgang (Blub) Bumiller
0c74f8fdb9 make the 'vector' type use qcfloat instead of float 2012-08-16 12:58:54 +02:00
Dale Weiler
d73100ad1b gmqcc now builds on visual studio 2012-08-14 19:06:53 -04:00