summaryrefslogtreecommitdiff
path: root/sys/src/cmd/cpp
AgeCommit message (Collapse)Author
2023-03-26cpp: allow qid version change for #pragma onceJacob Moody
2023-03-25cpp: correct #pragma once uniqueness checkJacob Moody
2023-03-21cpp: #pragma once supportJacob Moody
2022-11-04cpp: stringified macros shouldn't split words separate by a dotSigrid Solveig Haflínudóttir
> #define A(s) #s > #define B(s) A(s) > > #define x0 blah blah blah > B(x0) > > #define x1 blah.blah > B(x1) Before the fix, B(x1) would become "blah . blah". After the fix it's "blah.blah", as expected. In fact, the fix has always been there, but commented out on the initial import of The Artwork.
2020-07-13cpp: fix mutually recursive macrosOri Bernstein
Handle cases where parameterless macros expand to each other: #define FOO BAR #define BAR FOO FOO There were cases where the macros didn't make it into the hidesets, and we would recurse infinitely. This fixes that.
2020-04-27missing headers rate a FATAL.Ori Bernstein
2020-04-26copy all the tokens from the tokenrows with a paste.Ori Bernstein
if we do 'CAT(foo bar, baz quux)', the resulting token row should have 3 tokens: 'foo', 'barbaz', 'quux'. tested by jonasa, rebuilding /sys/src, perl, netsurf, and nuklear.
2020-04-25Backed out changeset 2737b9af622bOri Bernstein
not what I wanted to commit.
2020-04-25fix typos in time calculationOri Bernstein
the results of the time calculation were garbled -- and apparently negative on my system when testing, so the test passed when it shouldn't have.
2020-04-19Make priority array max size explicit.Ori Bernstein
we were implicitly depending on UMINUS being the last entry in the operator table -- that's fragile.
2020-04-19fix cpp operator associativityOri Bernstein
We used to treat all operators as right associative, which means that we would evaluate them incorrecty. For example, '2 - 1 + 1' would evaluate as '2 - (1 + 2)', instead of '(2 - 1) + 1'. This adds an assoc parameter to struct pri, and then uses it to decide how to evaluate operators.
2020-04-19dont overflow the stackOri Bernstein
when pushing expressions in cpp, particularly complex ones could overflow the stack and silently corrupt our data structures. add checks when we push, and bump the stack size up.
2020-03-23evaluate #if expressions using vlongOri Bernstein
#if expressions are expected to be evaluated using intmax_t, according to the C99 spec, 6.10.1 p3. On plan9, intmax_t maps to vlong.
2020-03-17Improve the posix preprocessor.Ori Bernstein
This fixes token pasting, making it expand when it should expand, and paste before expansion when it should paste before expanding. #define CAT(a, b) a ## b #define BAR 3 #define FOO CAT(BAR, 3) FOO now produces 33, while #define CAT(a, b) a ## b #define EOF (-1) #define NOP(x) x NOP(CAT(foo, EOF)) CAT(,EOF) CAT(,) produces fooEOF (-1) <empty> respectively.
2019-06-18Always turn on the -+ flag in cppOri Bernstein
C99 comments have been the default in compilers for something like 20 years now. This means we don't need to remember to turn it on when porting software, and gets rid of cryptic errors about unterminated character constants when someone writes something like: // Didn't need to... We still accept the flag to avoid breaking mkfiles, but we do nothing with it. This also removes the documentation, since the option does nothing now.
2016-11-17cmd: remove a bit of unused stuffftrvxmtrx
2015-09-24cpp: handle 4 byte utf sequences (21-bit runes)cinap_lenrek
2015-09-24cpp: fix memory corruption due to input buffer relocationcinap_lenrek
the dynamic input buffer resize code (fillbuf()) is broken as the calling code assumes that memory wont relocate. instead of trying to work out all the cases where this happens, i'm getting rid of fillbuf() and just read the whole file into memory in setsource(). the bug could be reproduced with something as simple as: @{for(i in `{seq 1 10000}){echo $i ', \'; }} | cpp
2015-07-13cpp: search source file directory first for quoted #include (thanks Ori_B)cinap_lenrek
foo.c includes bar/bar.h, which includes "baz.h"; it wants bar/baz.h meanwhile, it also includes meh/quux.h, which includes "baz.h"; it wants meh/baz.h
2012-04-20cpp: fd <= 0 vs. fd < 0cinap_lenrek
2011-12-03cpp: raise macro argument count to 64 (sic) for freetypecinap_lenrek
2011-03-30Import sources from 2011-03-30 iso image - libTaru Karttunen
2011-03-30Import sources from 2011-03-30 iso imageTaru Karttunen