diff mbox

kbuild: genksyms fix for typeof handling

Message ID 20160825095308.23937-1-npiggin@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Nicholas Piggin Aug. 25, 2016, 9:53 a.m. UTC
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(-)

Comments

Michal Marek Aug. 25, 2016, 6:11 p.m. UTC | #1
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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)