All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicholas Piggin <npiggin@gmail.com>
To: linux-kbuild@vger.kernel.org, Michal Marek <mmarek@suse.com>
Cc: Nicholas Piggin <npiggin@gmail.com>, Jan Beulich <jbeulich@suse.com>
Subject: [PATCH] kbuild: genksyms fix for typeof handling
Date: Thu, 25 Aug 2016 19:53:08 +1000	[thread overview]
Message-ID: <20160825095308.23937-1-npiggin@gmail.com> (raw)

The tokenizer misses counting an open-parenthesis when parsing a
non-trivial typeof beginning with an open-parenthesis. This function
in include/linux/ceph/libceph.h

static type *lookup_##name(struct rb_root *root,
                           typeof(((type *)0)->keyfld) key)

When instantiated in net/ceph/mon_client.c, causes subsequent symbols
including an EXPORT_SYMBOL in that file to be lost.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>

---
 scripts/genksyms/lex.l | 35 +++++++++++++++++------------------
 1 file changed, 17 insertions(+), 18 deletions(-)

diff --git a/scripts/genksyms/lex.l b/scripts/genksyms/lex.l
index e583565..5235aa5 100644
--- a/scripts/genksyms/lex.l
+++ b/scripts/genksyms/lex.l
@@ -289,6 +289,23 @@ repeat:
 	}
       break;
 
+    case ST_TYPEOF_1:
+      if (token == IDENT)
+	{
+	  if (is_reserved_word(yytext, yyleng)
+	      || find_symbol(yytext, SYM_TYPEDEF, 1))
+	    {
+	      yyless(0);
+	      unput('(');
+	      lexstate = ST_NORMAL;
+	      token = TYPEOF_KEYW;
+	      break;
+	    }
+	  _APP("(", 1);
+	}
+	lexstate = ST_TYPEOF;
+	/* FALLTHRU */
+
     case ST_TYPEOF:
       switch (token)
 	{
@@ -313,24 +330,6 @@ repeat:
 	}
       break;
 
-    case ST_TYPEOF_1:
-      if (token == IDENT)
-	{
-	  if (is_reserved_word(yytext, yyleng)
-	      || find_symbol(yytext, SYM_TYPEDEF, 1))
-	    {
-	      yyless(0);
-	      unput('(');
-	      lexstate = ST_NORMAL;
-	      token = TYPEOF_KEYW;
-	      break;
-	    }
-	  _APP("(", 1);
-	}
-	APP;
-	lexstate = ST_TYPEOF;
-	goto repeat;
-
     case ST_BRACKET:
       APP;
       switch (token)
-- 
2.9.3


             reply	other threads:[~2016-08-25  9:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-25  9:53 Nicholas Piggin [this message]
2016-08-25 18:11 ` [PATCH] kbuild: genksyms fix for typeof handling Michal Marek

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=20160825095308.23937-1-npiggin@gmail.com \
    --to=npiggin@gmail.com \
    --cc=jbeulich@suse.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=mmarek@suse.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.