diff options
| author | Alexander Viro <viro@parcelfarce.linux.theplanet.co.uk> | 2004-06-13 08:13:34 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-07 21:02:07 -0700 |
| commit | 87ce1691126e447c34d16abc1624d6ca0e079a4a (patch) | |
| tree | 4681fcb8d0dfbffaec78626dd811a954015d6177 /validation | |
| parent | 758eba2b81ccacce770a719792a93c12a7a9e45b (diff) | |
| download | sparse-dev-87ce1691126e447c34d16abc1624d6ca0e079a4a.tar.gz | |
[PATCH] line-splicing fixes in sparse
Ugh. Line-splicing was badly b0rken and overcomplicated to boot.
Moved to nextchar(), nextchar() split into fast inlined version and full
(non-inline) one it falls back on.
See comments in the testcases below
Diffstat (limited to 'validation')
| -rw-r--r-- | validation/phase2/backslash | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/validation/phase2/backslash b/validation/phase2/backslash new file mode 100644 index 00000000..29c85b4d --- /dev/null +++ b/validation/phase2/backslash @@ -0,0 +1,62 @@ +/* + * '\\' has a special meaning on phase 2 if and only if it is immediately + * followed by '\n'. In any other position it's left alone as any other + * character. + * + * [5.1.1.2(1.2)]: + * Each instance of a backslash character (\) immediately followed by + * a new-line character is deleted, splicing physical source lines to + * form logical source lines. Only the last backslash on any physical + * source line shall be eligible for being part of such a splice. + * A source file that is not empty shall end in a new-line character, + * which shall not be immediately preceded by a backslash character + * before any such splicing takes place. + * + * Note that this happens on the phase 2, before we even think of any + * tokens. In other words, splicing is ignorant of and transparent for + * the rest of tokenizer. + */ + +#define A(x) #x +#define B(x) A(x) +/* This should result in "\a" */ +/* XXX: currently sparse produces "a" */ +/* Partially fixed: now it gives "\\a", which is a separate problem */ +B(\a) + +#define C\ + 1 +/* This should give 1 */ +C + +#define D\ +1 +/* And this should give D, since '\n' is removed and we get no whitespace */ +/* XXX: currently sparse produces 1 */ +/* Fixed */ +D + +#define E '\\ +a' +/* This should give '\a' - with no warnings issued */ +/* XXX: currently sparse complains a lot and ends up producing a */ +/* Fixed */ +E + +/* This should give nothing */ +/* XXX: currently sparse produces more junk */ +/* Fixed */ +// junk \ +more junk + +/* This should also give nothing */ +/* XXX: currently sparse produces / * comment * / */ +/* Fixed */ +/\ +* comment *\ +/ + +/* And this should complain since final newline should not be eaten by '\\' */ +/* XXX: currently sparse does not notice */ +/* Fixed */ +\ |
