public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kbuild: genksyms fix for typeof handling
@ 2016-08-25  9:53 Nicholas Piggin
  2016-08-25 18:11 ` Michal Marek
  0 siblings, 1 reply; 2+ messages in thread
From: Nicholas Piggin @ 2016-08-25  9:53 UTC (permalink / raw)
  To: linux-kbuild, Michal Marek; +Cc: Nicholas Piggin, Jan Beulich

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] kbuild: genksyms fix for typeof handling
  2016-08-25  9:53 [PATCH] kbuild: genksyms fix for typeof handling Nicholas Piggin
@ 2016-08-25 18:11 ` Michal Marek
  0 siblings, 0 replies; 2+ messages in thread
From: Michal Marek @ 2016-08-25 18:11 UTC (permalink / raw)
  To: Nicholas Piggin, linux-kbuild; +Cc: Jan Beulich

On 2016-08-25 11:53, Nicholas Piggin wrote:
> 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>

Thanks, applied to kbuild.git#kbuild.

Michal


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-25 18:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-25  9:53 [PATCH] kbuild: genksyms fix for typeof handling Nicholas Piggin
2016-08-25 18:11 ` Michal Marek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox