All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaud Lacombe <lacombar@gmail.com>
To: linux-kbuild@vger.kernel.org
Cc: Michal Marek <mmarek@suse.cz>, Arnaud Lacombe <lacombar@gmail.com>
Subject: [RFC 2/9] genksyms: finalize rename
Date: Wed,  4 May 2011 22:03:17 -0400	[thread overview]
Message-ID: <1304561004-2684-3-git-send-email-lacombar@gmail.com> (raw)
In-Reply-To: <1304561004-2684-1-git-send-email-lacombar@gmail.com>

---
 scripts/genksyms/.gitignore |    6 ++--
 scripts/genksyms/Makefile   |   45 +++++++++++++-----------------------------
 scripts/genksyms/genksyms.c |   11 ++++-----
 scripts/genksyms/genksyms.l |    7 ++---
 scripts/genksyms/genksyms.y |    2 +
 5 files changed, 27 insertions(+), 44 deletions(-)

diff --git a/scripts/genksyms/.gitignore b/scripts/genksyms/.gitignore
index be5cadb..0983577 100644
--- a/scripts/genksyms/.gitignore
+++ b/scripts/genksyms/.gitignore
@@ -1,4 +1,4 @@
-keywords.c
-lex.c
-parse.[ch]
 genksyms
+genksyms.tab.c
+lex.genksyms.c
+genksyms.hash.c
diff --git a/scripts/genksyms/Makefile b/scripts/genksyms/Makefile
index e420fe4..82bb25f 100644
--- a/scripts/genksyms/Makefile
+++ b/scripts/genksyms/Makefile
@@ -2,52 +2,35 @@
 hostprogs-y	:= genksyms
 always		:= $(hostprogs-y)
 
-genksyms-objs	:= genksyms.o parse.o lex.o
+genksyms-objs	:= genksyms.o genksyms.tab.o
 
 # -I needed for generated C source (shipped source)
 HOSTCFLAGS_parse.o := -Wno-uninitialized -I$(src)
 
-# dependencies on generated files need to be listed explicitly
-$(obj)/lex.o: $(obj)/parse.h $(obj)/keywords.c
-
 # -I needed for generated C source (shipped source)
 HOSTCFLAGS_lex.o := -I$(src)
 
-ifdef GENERATE_PARSER
-
-# gperf
+clean-files	:= genksyms.tab.c lex.genksyms.c genksyms.hash.c
 
-quiet_cmd_keywords.c = GPERF   $@
-      cmd_keywords.c = gperf -L ANSI-C -a -C -E -g -H is_reserved_hash	\
-		       -k 1,3,$$ -N is_reserved_word -p -t $< > $@
-
-$(obj)/keywords.c: $(obj)/keywords.gperf FORCE
-	$(call if_changed,keywords.c)
-	cp $@ $@_shipped
+$(obj)/genksyms.tab.o: $(obj)/lex.genksyms.c $(obj)/genksyms.hash.c
 
-# flex
+ifdef GENKSYMS_GENPARSER
 
-quiet_cmd_lex.c = FLEX    $@
-      cmd_lex.c = flex -o$@ -d $< $(obj)/parse.h
+$(obj)/genksyms.tab.c: $(src)/genksyms.y
+$(obj)/lex.genksyms.c: $(src)/genksyms.l
+$(obj)/genksyms.hash.c: $(src)/genksyms.gperf
 
-$(obj)/lex.c: $(obj)/lex.l $(obj)/parse.h $(obj)/keywords.c FORCE
-	$(call if_changed,lex.c)
+%.tab.c: %.y
+	bison -l -b $* -p $(notdir $*) $<
 	cp $@ $@_shipped
 
-# bison
-
-quiet_cmd_parse.c = BISON   $@
-      cmd_parse.c = bison -o$@ -dtv $(filter-out FORCE,$^)
-
-$(obj)/parse.c: $(obj)/parse.y FORCE
-	$(call if_changed,parse.c)
+lex.%.c: %.l
+	flex -L -P$(notdir $*) -o$@ $<
 	cp $@ $@_shipped
-	cp $(@:.c=.h) $(@:.c=.h)_shipped
 
-$(obj)/parse.h: $(obj)/parse.c ;
-
-clean-files	+= parse.output
+%.hash.c: %.gperf
+	gperf -t --output-file $@ -L ANSI-C -a -C -E -g -H is_reserved_hash -k 1,3,$$ -N is_reserved_word -p -t $<
+	cp $@ $@_shipped
 
 endif
 
-targets += keywords.c lex.c parse.c parse.h
diff --git a/scripts/genksyms/genksyms.c b/scripts/genksyms/genksyms.c
index f99115e..034c30b 100644
--- a/scripts/genksyms/genksyms.c
+++ b/scripts/genksyms/genksyms.c
@@ -748,11 +748,10 @@ int main(int argc, char **argv)
 	if ((strcmp(arch, "h8300") == 0) || (strcmp(arch, "blackfin") == 0))
 		mod_prefix = "_";
 	{
-		extern int yydebug;
-		extern int yy_flex_debug;
-
-		yydebug = (flag_debug > 1);
-		yy_flex_debug = (flag_debug > 2);
+#ifdef YYDEBUG
+		extern int genksymsdebug = (flag_debug > 1);
+#endif
+		genksymsset_debug(flag_debug > 2);
 
 		debugfile = stderr;
 		/* setlinebuf(debugfile); */
@@ -763,7 +762,7 @@ int main(int argc, char **argv)
 		fclose(ref_file);
 	}
 
-	yyparse();
+	genksymsparse();
 
 	if (flag_dump_types && visited_symbols) {
 		while (visited_symbols != (struct symbol *)-1L) {
diff --git a/scripts/genksyms/genksyms.l b/scripts/genksyms/genksyms.l
index fe50ff9..06953f0 100644
--- a/scripts/genksyms/genksyms.l
+++ b/scripts/genksyms/genksyms.l
@@ -29,11 +29,10 @@
 #include <ctype.h>
 
 #include "genksyms.h"
-#include "parse.h"
 
 /* We've got a two-level lexer here.  We let flex do basic tokenization
    and then we categorize those basic tokens in the second stage.  */
-#define YY_DECL		static int yylex1(void)
+#define YY_DECL		static int genksymslex1(void)
 
 %}
 
@@ -98,7 +97,7 @@ MC_TOKEN		([~%^&*+=|<>/-]=)|(&&)|("||")|(->)|(<<)|(>>)
 
 /* Bring in the keyword recognizer.  */
 
-#include "keywords.c"
+#include "genksyms.hash.c"
 
 
 /* Macros to append to our phrase collection list.  */
@@ -141,7 +140,7 @@ yylex(void)
     }
 
 repeat:
-  token = yylex1();
+  token = genksymslex1();
 
   if (token == 0)
     return 0;
diff --git a/scripts/genksyms/genksyms.y b/scripts/genksyms/genksyms.y
index 09a265c..bff24d4 100644
--- a/scripts/genksyms/genksyms.y
+++ b/scripts/genksyms/genksyms.y
@@ -471,3 +471,5 @@ yyerror(const char *e)
 {
   error_with_pos("%s", e);
 }
+
+#include "lex.genksyms.c"
-- 
1.7.3.4.574.g608b.dirty


  reply	other threads:[~2011-05-05  2:03 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-05  2:03 [RFC 0/9] Kbuild: factor parser rules Arnaud Lacombe
2011-05-05  2:03 ` Arnaud Lacombe [this message]
2011-05-05  2:06   ` [RFC 2/9] genksyms: finalize rename Arnaud Lacombe
2011-05-05 14:23   ` Michal Marek
2011-05-23  2:17     ` Arnaud Lacombe
2011-05-23  3:32       ` Arnaud Lacombe
2011-05-05  2:03 ` [RFC 3/9] genksyms: pass hash and lookup functions name and target language though the input file Arnaud Lacombe
2011-05-05  2:03 ` [RFC 4/9] genksyms: regen parser Arnaud Lacombe
2011-05-05  2:03 ` [RFC 5/9] kconfig: constify `kconf_id_lookup' Arnaud Lacombe
2011-05-05  2:03 ` [RFC 6/9] kconfig: regen parsers Arnaud Lacombe
2011-05-05  2:03 ` [RFC 7/9] kbuild: merge parser generation rules Arnaud Lacombe
2011-05-05 13:32   ` Michal Marek
2011-05-05 14:50     ` Arnaud Lacombe
2011-05-05  2:03 ` [RFC 8/9] kconfig: regen parser Arnaud Lacombe
2011-05-05  2:03 ` [RFC 9/9] genksyms: " Arnaud Lacombe
     [not found] ` <1304561004-2684-2-git-send-email-lacombar@gmail.com>
2011-05-05 14:18   ` [RFC 1/9] genksyms: rename parser files Michal Marek
2011-05-23  2:06     ` Arnaud Lacombe
2011-05-23  5:48       ` Arnaud Lacombe

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=1304561004-2684-3-git-send-email-lacombar@gmail.com \
    --to=lacombar@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=mmarek@suse.cz \
    /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.