All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Cc: linux-sparse@vger.kernel.org
Subject: [PATCH] fix {pp-number} ## ...
Date: Fri, 16 Feb 2024 21:44:30 +0300	[thread overview]
Message-ID: <d67f161a-acb5-4cda-a51a-69a4178e9c9f@p183> (raw)

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;

                 reply	other threads:[~2024-02-16 18:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d67f161a-acb5-4cda-a51a-69a4178e9c9f@p183 \
    --to=adobriyan@gmail.com \
    --cc=linux-sparse@vger.kernel.org \
    --cc=luc.vanoostenryck@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.