Commit graph

62 commits

Author SHA1 Message Date
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
Wolfgang (Blub) Bumiller
515cafe8bd Lexer should keep newlines in merged lines, so will the preprocessor, but therefore the lexer will replace comments with actual spaces so we don't get borken output... also don't error about redifining a macro when inside a non-outputting #if branch 2012-11-16 23:13:53 +01:00
Wolfgang (Blub) Bumiller
990450bfe0 ## concatenation, -Wpreprocessor warning about redefining macros, #undef 2012-11-16 22:54:59 +01:00
Wolfgang (Blub) Bumiller
d237ff1736 don't error on non-EOL EOF at the end of a macro line 2012-11-16 22:41:29 +01:00
Wolfgang (Blub) Bumiller
0ad2b8b2c7 also use recursive-expansion on macros without parameters 2012-11-16 22:38:58 +01:00
Wolfgang (Blub) Bumiller
57ac55ad01 recursively call the preprocessor on expanded macros 2012-11-16 22:31:51 +01:00
Wolfgang (Blub) Bumiller
05a26333fc Expand macros into a string buffer 2012-11-16 22:22:31 +01:00
Wolfgang (Blub) Bumiller
99dd208880 moving ftepp_delete out of ftepp_preprocess so that it can actually be called recursively 2012-11-16 22:07:53 +01:00
Wolfgang (Blub) Bumiller
03f0e39f7f ftepp_out can now output to a string buffer 2012-11-16 22:06:07 +01:00
Wolfgang (Blub) Bumiller
b8a5c87360 Correctly handle nested #ifs 2012-11-16 22:02:38 +01:00
Wolfgang (Blub) Bumiller
5b91c2af5e Relax the preprocessor condition: # in the middle of a line also counts, but take care of builtin numbers since they use # as well 2012-11-16 21:37:34 +01:00
Wolfgang (Blub) Bumiller
7e660951c2 Fix a bug in macro call parameter parsing 2012-11-16 21:27:15 +01:00
Wolfgang (Blub) Bumiller
d688820518 Parsing parameters for a macro call 2012-11-16 21:20:31 +01:00
Wolfgang (Blub) Bumiller
a56c224f9c macro_body parse function shouldn't skip whitespace inside 2012-11-16 20:50:28 +01:00
Wolfgang (Blub) Bumiller
6c0b4a46fe moving ftepp_out further up, using it in ftepp_macro_call, generating output of parameter-less macros 2012-11-16 20:49:37 +01:00
Wolfgang (Blub) Bumiller
5f287fc476 ftepp_macro_call/ftepp_skipallwhite 2012-11-16 20:46:52 +01:00
Wolfgang (Blub) Bumiller
0bd0a430d6 Also allow empty-parameter-list macros 2012-11-16 20:41:20 +01:00
Wolfgang (Blub) Bumiller
c48b9dbf61 Parsing basic macro body, no special tokens yet 2012-11-16 20:38:44 +01:00
Wolfgang (Blub) Bumiller
52d7a5d7be Set the mergelines flag only for preprocessor commands 2012-11-16 20:32:03 +01:00