diff options
author | Alexander Viro <viro@parcelfarce.linux.theplanet.co.uk> | 2004-06-13 08:13:32 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-07 21:02:06 -0700 |
commit | 758eba2b81ccacce770a719792a93c12a7a9e45b (patch) | |
tree | e70c295b2297a1864351d297b9902b8c2ff9a9bd /validation | |
parent | Warn about unhandled expression and statement types in inlining. (diff) | |
download | sparse-758eba2b81ccacce770a719792a93c12a7a9e45b.tar.gz sparse-758eba2b81ccacce770a719792a93c12a7a9e45b.tar.bz2 sparse-758eba2b81ccacce770a719792a93c12a7a9e45b.zip |
[PATCH] comments handling fix in sparse
If we get a newline in the middle of a comment, stream->pos.newline
is set and remains set. In effect, newlines in the middle of multiline
comments drift to its end. This is wrong - e.g.
#define A /* foo
*/ B
is 100% legitimate - since every comment is treated as if replaced with
single space, the above is equivalent to
#define A B
Current code treats it as
#define A
B
which is bogus. Fix is trivial - we simply should restore ->newline we had
at the beginning of comment once we finish skipping it.
BTW, I'm starting to put new testcases into subdirectories - by translation
phase (multibyte character mapping == phase 1, line-splicing == phase 2,
tokenizer == phase 3, macro-expansion == phase 4, remapping from source
charset to execution charset == phase 5, merging adjacent string constants
== phase 6, conversion of tokens from preprocessor to compiler ones and
translation proper == phase 7, linking == phase 8). We obviously don't
have many of those (no multibyte handling, source and execution charsets
are identical and having no backend we obviously do not link anything),
but it's easier to keep track of what's what in the tests that way. We
already have way too many preprocessor<n>.c in there and going for saner
names will only create confusion between preprocessor and parser tests.
I'm not moving existing testcases - that's just for new ones...
Diffstat (limited to 'validation')
-rw-r--r-- | validation/phase3/comments | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/validation/phase3/comments b/validation/phase3/comments new file mode 100644 index 0000000..8f51a30 --- /dev/null +++ b/validation/phase3/comments @@ -0,0 +1,9 @@ +/* + * Each comment should be treated as if it had been a single space. + */ + +/* This should give nothing */ +/* XXX: currently sparse produces Y */ +/* Fixed */ +#define X /* + */ Y |