Dale Weiler
783b7b6594
Update license headers
2015-01-09 14:53:35 -05:00
Dale Weiler
8f7242d314
Implement support for #include MACRO and #include __LINE__
2014-11-07 03:12:34 -05:00
Dale Weiler
103e549615
Don't emit whitespace when stringifying TOKEN_WHITE.
...
Other aspects of the preprocessor already skip whitespace leading up to a token. The only situation in which a TOKEN_WHITE can
exist as part of the token stream during stringification, is when the whitespace is trailing after a token. This is situation is
really only possible in the context of a macro argument. This behaviour is inconsistent.
Consider the following
FOO( space_before)
FOO(space_after )
The former will reduce to "space_before" since the preprocessor will skip whitespace leading up to the token `space_before', while
the latter will reduce to "space_after ".
The C preprocessor doesn't preserve whitespace, so we won't either. This doesn't break any existing code.
2014-11-07 02:01:17 -05:00
Dale Weiler
2208136403
Implement support for indirect macro expansions in the preprocessor. This closes #36
2014-09-27 01:48:03 -04:00
Dale Weiler
0d1a740bc7
Fix style
2014-04-08 05:06:16 -04:00
Dale Weiler
0db41f4279
Only increment the buffer location for macro output whitespace stripping if the situation is actually stripable, otherwise macros like #define foo(X) bar(#X), with foo(test) will expand to bartest) instead of bar(test). This should fix Xonotic builds.
2014-04-08 04:02:23 -04:00
Dale Weiler
15d1277158
Added memory protection to prevent mismatching of mem_d or vec_free on pointers which are otherwise unknown to be allocated memory or allocated vectors. Also fixed the preprocessor to only strip on ' ' and '\t' around macros.
2014-04-08 03:26:08 -04:00
Dale Weiler
f1650c42d9
Match C's preprocessor semantics for token pasting with '##'.
2014-04-07 06:00:04 -04:00
Dale Weiler
a934e0fe4b
Happy new year!
2014-01-01 06:24:16 -05:00
Dale Weiler
af53c0cb83
Mask out the math constant precedence stuff unless -fftepp-mathdefs
2013-12-01 10:52:42 -05:00
Dale Weiler
6a44b72db3
Mask ftepp math constants with a compiler flag
2013-12-01 10:45:43 -05:00
Dale Weiler
b20e2a9d34
User supplied math constants take precedence
2013-12-01 10:30:24 -05:00
Dale Weiler
11ecc6cb0b
Ignore emitting implicit math constants in the preprocessor if they exist.
2013-12-01 10:26:36 -05:00
Dale Weiler
ab2a4f1318
Some math constants
2013-11-23 10:31:51 -05:00
Dale Weiler
b5b9559d6f
Make preprocessor predefs use their own context opposed to the lexer context.
2013-10-19 02:52:47 -04:00
Dale Weiler
c210340081
Undo fix and actually use a macro in the accumulation test .. just incase.
2013-10-17 20:34:16 -04:00
Dale Weiler
c675ba8086
Does this fix it?
2013-10-17 20:25:02 -04:00
Dale Weiler
f008cc257d
Some cleanups
2013-10-11 09:32:46 -04:00
Dale Weiler
87d9371a5c
Refactor some util/platform usage and extend file system file interface to accept its own flags and EOF
2013-10-11 06:12:56 -04:00
Dale Weiler
34c18ab860
Make it compile with mingw32 again
2013-10-11 04:58:49 -04:00
Dale Weiler
033cf7c7d3
More cleanups
2013-10-11 03:59:25 -04:00
Dale Weiler
12a864abf5
Some more platform / compiler specific code refactoring.
2013-10-11 03:02:38 -04:00
Dale Weiler
151606e255
Initial platform / compiler specific code refactoring.
2013-10-11 02:39:30 -04:00
Dale Weiler
90824c2093
Add seperate warning flag for directive in macro.
2013-09-30 15:59:36 -04:00
Dale Weiler
8f359f3849
Warn when preprocessor directive is found inside a macro body.
2013-09-30 15:57:01 -04:00
Dale Weiler
ccd8f1acc6
Added style + indent rule, fixed some indenting as well
2013-08-19 02:16:16 +00:00
Dale Weiler
2a79339735
Remove that idiom, and use GMQCC_ARRAY_COUNT.
2013-08-17 23:39:06 +00:00
Dale Weiler
772dbfae26
Make it compile in visual studio again, without warnings.
2013-08-16 09:03:36 +00:00
Dale Weiler
a622d5163b
Rework some build stuff for better output and to enable strict prototypes
2013-08-16 03:28:02 +00:00
Dale Weiler
1201f06a55
Remove vec_upload
2013-08-14 06:19:48 +00:00
Dale Weiler
d6ca5673dc
Use the _t consistency naming scheme. Also various cleanups.
2013-07-30 16:00:51 +00:00
Dale Weiler
8db9724c5d
Revert "Smaller memory footprint, 4/8 bytes vs 12/24 for individual token lex_ctx's. Use to be a 'shallow' copy of the details in lex_file, now it's a pointer to the contents in lex_file."
...
This reverts commit cddf70f46b
.
2013-07-26 16:17:41 +00:00
Dale Weiler
cddf70f46b
Smaller memory footprint, 4/8 bytes vs 12/24 for individual token lex_ctx's. Use to be a 'shallow' copy of the details in lex_file, now it's a pointer to the contents in lex_file.
2013-07-26 16:09:26 +00:00
Dale Weiler
04406b191f
Less terse, it confuses people.
2013-06-15 08:56:34 +00:00
Dale Weiler
8afd373e4f
Fixed whitespace
2013-06-14 21:36:16 +00:00
Dale Weiler
144672fada
Strict prototyping
2013-06-06 02:51:13 +00:00
Dale Weiler
11179a2a71
Major header reworking, this respects the namespaces properly. Makes object dependency more obvious, allows for better make caches, and prevents misuse of library features, i.e use con_* instead of printf.
2013-06-04 02:47:07 +00:00
Dale Weiler
0b6269f607
column printing for warnings and errors now
2013-05-30 19:36:01 +00:00
Dale Weiler
f892b32335
Major export cleanup. Anything that was exported but wasn't used outside where it was implemented has been turned into static, and their exports have been removed. This actually makes the compiler compile slightly faster.
2013-05-29 03:29:04 +00:00
Wolfgang Bumiller
c5225b2fa1
fixing a few leaks - code_write doesn't delete the code object anymore, code_cleanup has to be called
2013-05-07 19:56:41 +02:00
Dale Weiler
9fee84f250
less globals
2013-04-25 12:08:13 +00:00
Wolfgang Bumiller
3a4aba0b31
Grrrr
2013-04-24 17:47:42 +02:00
Dale Weiler
6284cc673d
typo
2013-04-24 04:50:07 +00:00
Dale Weiler
b3fc77efd6
Implemented __TIME_STAMP__ predef, expands to a timestamp of when the __FILE__ was last modified, returned in the format: "Www Mmm dd hh:mm:ss yyyy", where Www is the weekday, Mmm the month (in letter), dd the day of the month, hh:mm:ss the time, and yyyy the year.
2013-04-24 04:48:05 +00:00
Dale Weiler
35988b6191
Make ftepps __NULL__ translate to gmqccs untyped nil keyword (this isn't correct behaviour of the __NULL__ constant, but it works)
2013-04-24 04:17:17 +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
Dale Weiler
160e7cf7ee
Remove trailing whitespace
2013-04-21 10:24:55 +00:00
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