Commit graph

114 commits

Author SHA1 Message Date
Dale Weiler
dc7e18ec73 Some inline never hurt anyone .. actually, C made a bad decision in it's design, everything should've always been implicitly inline, since most code back in the day was small, if you had large bodies, there should've been an 'outline' keyword for that instead :P 2013-04-17 11:02:42 +00:00
Dale Weiler
0b0b6423ba Use hashtable for macro definitions in the preprocessor, this speeds up the search for them, and the removal of them making it O(1) instead of O(n). This also makes my 30 second xonotic compiles take only 13 seconds 2013-04-17 10:51:33 +00:00
Dale Weiler
d7be99c9dd More perliminary reworking for threading 2013-04-17 06:30:09 +00:00
Dale Weiler
c2b5a95961 GCC specific stuff compile flags. 2013-04-15 06:23:13 +00: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
3e7340c52c More external function flatening (less external symbols) 2013-04-14 01:07:39 +00:00
Dale Weiler
3f40fcb965 Fix possible buffer overflows. 2013-04-13 18:17:15 +00:00
Dale Weiler
95172861f5 Fix possible bug 2013-04-13 18:04:07 +00:00
Dale Weiler
c74889f648 Fix some memory leaks. 2013-04-13 18:01:26 +00:00
Wolfgang Bumiller
3593a1b6b8 Merge branch 'master' into cooking 2013-02-12 14:31:27 +01:00
Wolfgang Bumiller
1dfd375738 include: guard the actual inclusion with ftepp->output_on so that include inside #if 0 doesn't happen 2013-02-11 12:13:27 +01:00
Dale Weiler
c8959a2452 BOOM 2013-02-10 13:57:22 +00:00
Dale Weiler
a568d43487 Implemented __VA_COUNT__ 2013-02-08 12:30: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
530dbd85b2 properly mask #message, #warning, #error by ftepp->output_on 2013-02-03 23:23:50 +01:00
Dale Weiler
5f9f6c11b8 Get it compiling with C++ compilers again. 2013-01-30 06:49:50 +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
76614b311e s/WARN_PREPROCESSOR/WARN_CPP/g (to stay somewhat compatible with gcc/clang warnings for the preprocessor) 2013-01-30 01:32:10 +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
Dale Weiler
7ea1033a43 Handle all possible subscript errors 2013-01-27 21:31:18 +00:00
Dale Weiler
1597f38f45 Better handling of __VA_ARGS__ subscripting. 2013-01-27 21:27:50 +00:00
Dale Weiler
6fc5b32123 Fix warning, and better tests for __VA_ARGS__ 2013-01-27 13:03:02 +00:00
Dale Weiler
b4fbba5708 Implement subscripting for __VA_ARGS__, and added test-case. This only works on INTCONST for now. 2013-01-27 12:55:56 +00:00
Wolfgang Bumiller
d5ba5a6e6a linenumbers and macros are stupid 2013-01-16 23:34:54 +01:00
Wolfgang Bumiller
7d2b0e9638 more linenumber madness 2013-01-16 22:58:43 +01:00
Wolfgang Bumiller
dfad837f5b this might fix some linenumbering, I hope 2013-01-15 22:29:44 +01:00
Wolfgang Bumiller
dfa6d0c9ad call ftepp_recursion_header/footer only when there are newlines in the expanded macro 2013-01-15 22:03:16 +01:00
Wolfgang Bumiller
4d72c85f73 __STD_QCCX__ on -std=qccx - I have no idea about what qccx does/can do but at least now -fftepp includes the macros... 2013-01-06 20:52:12 +01:00
Wolfgang Bumiller
9edae7fa0a Merge remote-tracking branch 'origin/pp-unary-numbers' 2013-01-03 14:58:02 +01: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
Dale Weiler
a2f63aae33 Implemented __TIME__ for ftepp 2013-01-02 21:53:46 +00:00
Dale Weiler
908f6ded8a Implemented __DATE__ for ftepp 2013-01-02 21:51:22 +00:00
Wolfgang Bumiller
654eceb33b Allow unary minus in ftepp_if_value 2013-01-02 17:26:35 +01:00
Wolfgang Bumiller
38a664ed72 __VA_ARGS__ support 2013-01-02 14:15:16 +01:00
Wolfgang Bumiller
3c212c8389 fix a leak: delete the output string of macro calls 2013-01-02 10:45:55 +01:00
Wolfgang Bumiller
dce7a0c72b update old_string on failure in ftepp_macro_expand to not segfault on a preprocessor-error inside recursive preprocessor calls 2013-01-02 10:44:39 +01:00
Wolfgang Bumiller
c7280fca52 when recursinve into macros copy the previous line number; fixes macros showing line 1 for each error 2013-01-02 10:35:00 +01:00
Dale Weiler
29db4a44ed Happy new years! 2013-01-01 05:08:55 +00:00
Wolfgang Bumiller
048ef3e796 fix: ftepp_delete needs to ftepp_flush to not cause a leak on errors 2012-12-30 10:37:15 +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
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
Dale Weiler
0a57c408c0 Added ftepp predefs flag (ability to turn on/off predefs) disabled by default (even with -ftepp), enabled with -E, to enable use -fftepp-predefs. 2012-12-24 00:21:55 +00:00
Dale Weiler
bd12429cd0 Implemented __FILE__, __LINE__, __RANDOM__, __RANDOM_LAST__, __COUNTER__ and __COUNTER_LAST__ as predefined macros. __FUNCTION__ is not implemented yet due to the overall complexity in making it constant. 2012-12-24 00:12:24 +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
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
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
f78ab9061b added -Wcpp (for turning off cpp warnings defined with #warning like GCC/clang/pathscale .. no more [-Wunused-variable]) 2012-12-21 03:12:58 +00:00
Dale Weiler
36a90bb866 Implemented #warning and #error preprocessor directives, they're functionally equivalent to CPPs (supporting both string constant and non-string constant versions). Warnings however are printed with a [-Wunused-variable] which isn't correct (TODO: allow systematic changes of -W paramaters in relation to warning fields for preprocessor directives. 2012-12-21 03:08:21 +00:00