Commit graph

80 commits

Author SHA1 Message Date
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
Wolfgang (Blub) Bumiller
0f99ae3459 ftepp_warn to use vcompile_warning 2012-12-17 18:24:16 +01:00
Dale Weiler
e72d656eb8 Fixes, but still crashes because ... I have no clue, there is no reason for this to crash. 2012-12-17 15:39:22 +00: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
ea08d16c06 ftepp_preprocess_string uses strlen - push nul-byte to verminor and vermajor 2012-12-03 20:23:40 +01:00
Dale Weiler
37ccf19769 added __STD_VERSION_[MINOR/MAJOR]__, and vec_upload 2012-12-02 04:30:46 +00:00
Wolfgang (Blub) Bumiller
44cbf40553 We can now reintroduce the 'preprocessor-directives only after newlines' rule correctly 2012-11-30 15:53:53 +01:00
Wolfgang (Blub) Bumiller
41cb923c0c Wrong condition *sigh* 2012-11-30 15:43:18 +01:00
Wolfgang (Blub) Bumiller
0627e9e06e Still have to parse ahead though 2012-11-30 15:41:01 +01:00
Wolfgang (Blub) Bumiller
b78dab9d71 Don't expand macros inside #if 0 at _all_ 2012-11-30 15:40:19 +01:00
Wolfgang (Blub) Bumiller
7f915c0f2a Don't try to add a slash to actual filenames, only paths... 2012-11-30 15:26:14 +01:00
Dale Weiler
ca52ecc20a Remove trailing whitespace for Blub. 2012-11-26 11:12:06 +00:00
Wolfgang (Blub) Bumiller
b457bfec2a linecounting... 2012-11-25 18:02:54 +01:00
Wolfgang (Blub) Bumiller
07fa97b8e7 linecounting issues in the ftepp 2012-11-25 16:08:41 +01:00
Wolfgang (Blub) Bumiller
e7bf73455d always define GMQCC, never define FTEQCC or QCC, but have __STD_FTEQCC__ and the likes for -std=qcc/gmqcc/fteqcc 2012-11-25 14:29:06 +01:00
Dale Weiler
8bce855f0b Set correct macro for PP based on the selected standard 2012-11-24 00:37:36 +00:00
Wolfgang (Blub) Bumiller
74fce32233 relation operation in #if just as wrong as in fteqcc 2012-11-23 21:05:07 +01:00
Wolfgang (Blub) Bumiller
58c87ac328 Enforce a trailing nul-byte after preprocessing 2012-11-23 19:34:24 +01:00
Wolfgang (Blub) Bumiller
85e98e9f53 Don't ftepp_warn after destroying the lexer... 2012-11-23 19:30:02 +01:00
Wolfgang (Blub) Bumiller
37eaaa76f9 Look for include files in the currently #included file's directory first 2012-11-23 19:29:45 +01:00
Wolfgang (Blub) Bumiller
4a3921fcb9 Let's #define GMQCC by default 2012-11-23 19:13:09 +01:00
Wolfgang (Blub) Bumiller
f6b7ddf72b Don't delete the ftepp prematurely 2012-11-23 15:03:10 +01:00
Dale Weiler
20d65da321 change choice of diagnostics for ftepp to use lex_ctx instance. Cleaned up C++ style comments, and some other things ... 2012-11-23 02:29:01 +00:00
Dale Weiler
b5507b3127 Make it compile with -Wall and -pedantic 2012-11-23 02:23:22 +00:00
Wolfgang (Blub) Bumiller
facd89b188 unsed params in ftepp.c 2012-11-22 21:42:14 +01:00
Dale Weiler
baf69f3725 Fix more warnings 2012-11-22 20:32:08 +00:00
Wolfgang (Blub) Bumiller
e4998e0798 Added #include 2012-11-18 16:22:07 +01:00
Wolfgang (Blub) Bumiller
d3861cea9f Make pragmas pass through the preprocessor so the user can write them manually 2012-11-18 15:30:24 +01:00
Wolfgang (Blub) Bumiller
4c2e5d7ebf update old_string after a recursive preprocess call so we don't reset to a free'd vector; add recursion header/footer pragmas 2012-11-18 14:39:24 +01:00
Wolfgang (Blub) Bumiller
441a224435 Comment about why stringify is so short 2012-11-18 14:29:15 +01:00
Wolfgang (Blub) Bumiller
a014480987 Add quotes to the known control sequences... darn. Add stringification via # 2012-11-18 14:26:40 +01: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