All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix {pp-number} ## ...
@ 2024-02-16 18:44 Alexey Dobriyan
  0 siblings, 0 replies; only message in thread
From: Alexey Dobriyan @ 2024-02-16 18:44 UTC (permalink / raw)
  To: Luc Van Oostenryck; +Cc: linux-sparse

pp-number token may have arbitrary number of dots after first digit

	pp-number:
		digit
		. digit
		pp-number .

which means that merging any pp-number with ... is valid operation and
should yield pp-number:

	#define M(a,b) a##b
	M(1,...)

should preprocess to

	1...

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 pre-process.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/pre-process.c
+++ b/pre-process.c
@@ -482,6 +482,7 @@ static void expand_arguments(int count, struct arg *args)
  *  - number + number -> number
  *  - number + ident -> number
  *  - number + '.' -> number
+ *  - number + '...' -> number
  *  - number + '+' or '-' -> number, if number used to end on [eEpP].
  *  - '.' + number -> number, if number used to start with a digit.
  *  - special + special -> either special or an error.
@@ -524,6 +525,8 @@ static enum token_type combine(struct token *left, struct token *right, char *p)
 			switch (right->special) {
 			case '.':
 				break;
+			case SPECIAL_ELLIPSIS:
+				break;
 			case '+': case '-':
 				if (strchr("eEpP", p[len - 2]))
 					break;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-02-16 18:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-16 18:44 [PATCH] fix {pp-number} ## Alexey Dobriyan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.