diff mbox

[RFC,2/9] genksyms: finalize rename

Message ID 1304561004-2684-3-git-send-email-lacombar@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Arnaud Lacombe May 5, 2011, 2:03 a.m. UTC
---
 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(-)

Comments

Arnaud Lacombe May 5, 2011, 2:06 a.m. UTC | #1
Hi,

On Wed, May 4, 2011 at 10:03 PM, Arnaud Lacombe <lacombar@gmail.com> wrote:
>
I kept this one separated from the previous to facilitate rebase after
the branch has reach an acceptable state as I seem to remember this
code has got a few changes in the -kbuild tree.

 - Arnaud
--
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
Michal Marek May 5, 2011, 2:23 p.m. UTC | #2
On Wed, May 04, 2011 at 10:03:17PM -0400, Arnaud Lacombe wrote:
> ---
>  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

Given that you are overwriting most of this by "kbuild: merge parser
generation rules", I suggest you only do the necessary minimum at this
point, i.e. only reflect the file renames and #include the lexer into
the parser.

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
Arnaud Lacombe May 23, 2011, 2:17 a.m. UTC | #3
Hi,

On Thu, May 5, 2011 at 10:23 AM, Michal Marek <mmarek@suse.cz> wrote:
> On Wed, May 04, 2011 at 10:03:17PM -0400, Arnaud Lacombe wrote:
>> ---
>>  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
>
> Given that you are overwriting most of this by "kbuild: merge parser
> generation rules", I suggest you only do the necessary minimum at this
> point, i.e. only reflect the file renames and #include the lexer into
> the parser.
>
That would break bisect-ability, which I would like to keep.

 - Arnaud
--
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
Arnaud Lacombe May 23, 2011, 3:32 a.m. UTC | #4
Hi,

On Sun, May 22, 2011 at 10:17 PM, Arnaud Lacombe <lacombar@gmail.com> wrote:
> Hi,
>
> On Thu, May 5, 2011 at 10:23 AM, Michal Marek <mmarek@suse.cz> wrote:
>> On Wed, May 04, 2011 at 10:03:17PM -0400, Arnaud Lacombe wrote:
>>> ---
>>>  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
>>
>> Given that you are overwriting most of this by "kbuild: merge parser
>> generation rules", I suggest you only do the necessary minimum at this
>> point, i.e. only reflect the file renames and #include the lexer into
>> the parser.
>>
> That would break bisect-ability, which I would like to keep.
>
Just thinking about it, I will re-do all the pre-merge operations
(renaming, adaptation, ...) on .l/.y/.gperf files, then do the merge,
then regenerate all parsers. That will remove needs for intermediate
parsers regeneration, and hopefully, keep bisect-ability as long as
parsers are no regenerated.

  - Arnaud
--
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/.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"