Skip to contentSkip to conversation

Kbuild: factor parser rules

RFC Superseded Arnaud Lacombe 2 participants 18 messages May 5, 2011 – May 23, 2011 1 message not in the archive

Subsystems (2)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

cover Kbuild: factor parser rules

Hi Folks,

I noticed recently that several program under scripts/ implement their own set of gperf/lex/yacc rules. The following patchset aims at factoring all these targets into scripts/Makefiles.lib'. Patches do the job for genksyms' and kconfig', dtc' remains to be done.

I am not really happy with the file naming, in particular the lexer which breaks convention. I would prefer something ala:
- parser: %.tab.c
- lexer: %.lex.c
- hash: %.hash.c

Moreover, I'd prefer to build the lexer and parser as a different compilation unit, but that might be done later on.

The following also allows to automatically regen the %_shipped file upon modification of its associated prerequiresite, provided REGENERATE_PARSERS is defined.

The diff may look mistakenly large as I had to shuffle things around to make them match the same pattern.

Known issue: there should be 2 new warnings introduced in genksyms', only compile tested so far (only on tools, not on the full kernel), in particular, gperf' options may need to be tuned.

Patches are based on v2.6.38. Not for merge, so not signed off on purpose.

Comments welcome!
- Arnaud

Arnaud Lacombe (9):
genksyms: rename parser files
genksyms: finalize rename
genksyms: pass hash and lookup functions name and target language
though the input file
genksyms: regen parser
kconfig: constify `kconf_id_lookup'
kconfig: regen parsers
kbuild: merge parser generation rules
kconfig: regen parser
genksyms: regen parser

 scripts/Makefile.lib                     |   31 +-
 scripts/genksyms/.gitignore              |    6 +-
 scripts/genksyms/Makefile                |   43 +-
 scripts/genksyms/genksyms.c              |   11 +-
 scripts/genksyms/genksyms.gperf          |   59 +
 scripts/genksyms/genksyms.hash.c_shipped |  220 +++
 scripts/genksyms/genksyms.l              |  408 +++++
 scripts/genksyms/genksyms.tab.c_shipped  | 2324 +++++++++++++++++++++++++
 scripts/genksyms/genksyms.y              |  475 ++++++
 scripts/genksyms/keywords.c_shipped      |  220 ---
 scripts/genksyms/keywords.gperf          |   56 -
 scripts/genksyms/lex.c_shipped           | 2709 ------------------------------
 scripts/genksyms/lex.genksyms.c_shipped  | 2242 ++++++++++++++++++++++++
 scripts/genksyms/lex.l                   |  409 -----
 scripts/genksyms/parse.c_shipped         | 2353 --------------------------
 scripts/genksyms/parse.h_shipped         |  139 --
 scripts/genksyms/parse.y                 |  473 ------
 scripts/kconfig/Makefile                 |   25 -
 scripts/kconfig/lex.zconf.c_shipped      |   26 +-
 scripts/kconfig/zconf.gperf              |    2 +-
 scripts/kconfig/zconf.hash.c_shipped     |  273 ++--
 scripts/kconfig/zconf.l                  |    4 +-
 scripts/kconfig/zconf.tab.c_shipped      |   32 +-
 scripts/kconfig/zconf.y                  |    8 +-
 24 files changed, 5959 insertions(+), 6589 deletions(-)
 create mode 100644 scripts/genksyms/genksyms.gperf
 create mode 100644 scripts/genksyms/genksyms.hash.c_shipped
 create mode 100644 scripts/genksyms/genksyms.l
 create mode 100644 scripts/genksyms/genksyms.tab.c_shipped
 create mode 100644 scripts/genksyms/genksyms.y
 delete mode 100644 scripts/genksyms/keywords.c_shipped
 delete mode 100644 scripts/genksyms/keywords.gperf
 delete mode 100644 scripts/genksyms/lex.c_shipped
 create mode 100644 scripts/genksyms/lex.genksyms.c_shipped
 delete mode 100644 scripts/genksyms/lex.l
 delete mode 100644 scripts/genksyms/parse.c_shipped
 delete mode 100644 scripts/genksyms/parse.h_shipped
 delete mode 100644 scripts/genksyms/parse.y
Signature · 1 line
1.7.3.4.574.g608b.dirty
#1 lore raw

RFC 2/9 genksyms: finalize rename

---
 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(-)
scripts/genksyms/.gitignore +3 -3
index be5cadb..0983577 100644
@@ -1,4 +1,4 @@
-keywords.c
-lex.c
-parse.[ch]
 genksyms
+genksyms.tab.c
+lex.genksyms.c
+genksyms.hash.c
scripts/genksyms/Makefile +14 -31

66 lines not on this page · raw message

scripts/genksyms/genksyms.c +5 -6
index f99115e..034c30b 100644
@@ -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) {
scripts/genksyms/genksyms.l +3 -4
index fe50ff9..06953f0 100644
@@ -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;
scripts/genksyms/genksyms.y +2 -0
index 09a265c..bff24d4 100644
@@ -471,3 +471,5 @@ yyerror(const char *e)
 {
   error_with_pos("%s", e);
 }
+
+#include "lex.genksyms.c"
Signature · 1 line
1.7.3.4.574.g608b.dirty
#6 lore raw

RFC 3/9 genksyms: pass hash and lookup functions name and target language though the input file

In reply to Arnaud Lacombe

Renaming hash and lookup functions on the command line would reduces its genericity. Use the .gperf file to pass this information. Do the same for the target language.

---
 scripts/genksyms/Makefile       |    2 +-
 scripts/genksyms/genksyms.gperf |    3 +++
 2 files changed, 4 insertions(+), 1 deletions(-)
scripts/genksyms/Makefile +1 -1
index 82bb25f..de6675d 100644
@@ -29,7 +29,7 @@ lex.%.c: %.l
 	cp $@ $@_shipped
 
 %.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 $<
+	gperf -t --output-file $@ -a -C -E -g -k 1,3,$$ -p -t $<
 	cp $@ $@_shipped
 
 endif
scripts/genksyms/genksyms.gperf +3 -0
index e6349ac..3e77a94 100644
@@ -1,3 +1,6 @@
+%language=ANSI-C
+%define hash-function-name is_reserved_hash
+%define lookup-function-name is_reserved_word
 %{
 struct resword;
 static const struct resword *is_reserved_word(register const char *str, register unsigned int len);
Signature · 1 line
1.7.3.4.574.g608b.dirty
#7 lore raw

RFC 4/9 genksyms: regen parser

In reply to Arnaud Lacombe
---
 scripts/genksyms/genksyms.hash.c_shipped |   96 ++--
 scripts/genksyms/genksyms.tab.c_shipped  |  537 +++++++++---------
 scripts/genksyms/genksyms.tab.h_shipped  |  139 -----
 scripts/genksyms/lex.genksyms.c_shipped  |  911 ++++++++----------------------
 4 files changed, 524 insertions(+), 1159 deletions(-)
 delete mode 100644 scripts/genksyms/genksyms.tab.h_shipped
scripts/genksyms/genksyms.hash.c_shipped +48 -48
index 8060e06..04c6524 100644
@@ -1,5 +1,5 @@
 /* ANSI-C code produced by gperf version 3.0.4 */
-/* Command-line: gperf -L ANSI-C -a -C -E -g -H is_reserved_hash -k '1,3,$' -N is_reserved_word -p -t scripts/genksyms/keywords.gperf  */
+/* Command-line: gperf -t --output-file scripts/genksyms/genksyms.hash.c -a -C -E -g -k '1,3,$' -p -t scripts/genksyms/genksyms.gperf  */
 
 #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
       && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
@@ -28,11 +28,11 @@
 #error "gperf generated tables don't work with this execution character set. Please report a bug to <[email protected]>."
 #endif
 
-#line 1 "scripts/genksyms/keywords.gperf"
+#line 4 "scripts/genksyms/genksyms.gperf"
 
 struct resword;
 static const struct resword *is_reserved_word(register const char *str, register unsigned int len);
-#line 5 "scripts/genksyms/keywords.gperf"
+#line 8 "scripts/genksyms/genksyms.gperf"
 struct resword { const char *name; int token; };
 /* maximum key range = 64, duplicates = 0 */
 
@@ -99,108 +99,108 @@ is_reserved_word (register const char *str, register unsigned int len)
   static const struct resword wordlist[] =
     {
       {""}, {""}, {""},
-#line 30 "scripts/genksyms/keywords.gperf"
+#line 33 "scripts/genksyms/genksyms.gperf"
       {"asm", ASM_KEYW},
       {""},
-#line 12 "scripts/genksyms/keywords.gperf"
+#line 15 "scripts/genksyms/genksyms.gperf"
       {"__asm", ASM_KEYW},
       {""},
-#line 13 "scripts/genksyms/keywords.gperf"
+#line 16 "scripts/genksyms/genksyms.gperf"
       {"__asm__", ASM_KEYW},
       {""}, {""},
-#line 56 "scripts/genksyms/keywords.gperf"
+#line 59 "scripts/genksyms/genksyms.gperf"
       {"__typeof__", TYPEOF_KEYW},
       {""},
-#line 16 "scripts/genksyms/keywords.gperf"
+#line 19 "scripts/genksyms/genksyms.gperf"
       {"__const", CONST_KEYW},
-#line 15 "scripts/genksyms/keywords.gperf"
+#line 18 "scripts/genksyms/genksyms.gperf"
       {"__attribute__", ATTRIBUTE_KEYW},
-#line 17 "scripts/genksyms/keywords.gperf"
+#line 20 "scripts/genksyms/genksyms.gperf"
       {"__const__", CONST_KEYW},
-#line 22 "scripts/genksyms/keywords.gperf"
+#line 25 "scripts/genksyms/genksyms.gperf"
       {"__signed__", SIGNED_KEYW},
-#line 48 "scripts/genksyms/keywords.gperf"
+#line 51 "scripts/genksyms/genksyms.gperf"
       {"static", STATIC_KEYW},
       {""},
-#line 43 "scripts/genksyms/keywords.gperf"
+#line 46 "scripts/genksyms/genksyms.gperf"
       {"int", INT_KEYW},
-#line 36 "scripts/genksyms/keywords.gperf"
+#line 39 "scripts/genksyms/genksyms.gperf"
       {"char", CHAR_KEYW},
-#line 37 "scripts/genksyms/keywords.gperf"
+#line 40 "scripts/genksyms/genksyms.gperf"
       {"const", CONST_KEYW},
-#line 49 "scripts/genksyms/keywords.gperf"
+#line 52 "scripts/genksyms/genksyms.gperf"
       {"struct", STRUCT_KEYW},
-#line 28 "scripts/genksyms/keywords.gperf"
+#line 31 "scripts/genksyms/genksyms.gperf"
       {"__restrict__", RESTRICT_KEYW},
-#line 29 "scripts/genksyms/keywords.gperf"
+#line 32 "scripts/genksyms/genksyms.gperf"
       {"restrict", RESTRICT_KEYW},
-#line 9 "scripts/genksyms/keywords.gperf"
+#line 12 "scripts/genksyms/genksyms.gperf"
       {"EXPORT_SYMBOL_GPL_FUTURE", EXPORT_SYMBOL_KEYW},
-#line 20 "scripts/genksyms/keywords.gperf"
+#line 23 "scripts/genksyms/genksyms.gperf"
       {"__inline__", INLINE_KEYW},
       {""},
-#line 24 "scripts/genksyms/keywords.gperf"
+#line 27 "scripts/genksyms/genksyms.gperf"
       {"__volatile__", VOLATILE_KEYW},
-#line 7 "scripts/genksyms/keywords.gperf"
+#line 10 "scripts/genksyms/genksyms.gperf"
       {"EXPORT_SYMBOL", EXPORT_SYMBOL_KEYW},
-#line 27 "scripts/genksyms/keywords.gperf"
+#line 30 "scripts/genksyms/genksyms.gperf"
       {"_restrict", RESTRICT_KEYW},
       {""},
-#line 14 "scripts/genksyms/keywords.gperf"
+#line 17 "scripts/genksyms/genksyms.gperf"
       {"__attribute", ATTRIBUTE_KEYW},
-#line 8 "scripts/genksyms/keywords.gperf"
+#line 11 "scripts/genksyms/genksyms.gperf"
       {"EXPORT_SYMBOL_GPL", EXPORT_SYMBOL_KEYW},
-#line 18 "scripts/genksyms/keywords.gperf"
+#line 21 "scripts/genksyms/genksyms.gperf"
       {"__extension__", EXTENSION_KEYW},
-#line 39 "scripts/genksyms/keywords.gperf"
+#line 42 "scripts/genksyms/genksyms.gperf"
       {"enum", ENUM_KEYW},
-#line 10 "scripts/genksyms/keywords.gperf"
+#line 13 "scripts/genksyms/genksyms.gperf"
       {"EXPORT_UNUSED_SYMBOL", EXPORT_SYMBOL_KEYW},
-#line 40 "scripts/genksyms/keywords.gperf"
+#line 43 "scripts/genksyms/genksyms.gperf"
       {"extern", EXTERN_KEYW},
       {""},
-#line 21 "scripts/genksyms/keywords.gperf"
+#line 24 "scripts/genksyms/genksyms.gperf"
       {"__signed", SIGNED_KEYW},
-#line 11 "scripts/genksyms/keywords.gperf"
+#line 14 "scripts/genksyms/genksyms.gperf"
       {"EXPORT_UNUSED_SYMBOL_GPL", EXPORT_SYMBOL_KEYW},
-#line 51 "scripts/genksyms/keywords.gperf"
+#line 54 "scripts/genksyms/genksyms.gperf"
       {"union", UNION_KEYW},
-#line 55 "scripts/genksyms/keywords.gperf"
+#line 58 "scripts/genksyms/genksyms.gperf"
       {"typeof", TYPEOF_KEYW},
-#line 50 "scripts/genksyms/keywords.gperf"
+#line 53 "scripts/genksyms/genksyms.gperf"
       {"typedef", TYPEDEF_KEYW},
-#line 19 "scripts/genksyms/keywords.gperf"
+#line 22 "scripts/genksyms/genksyms.gperf"
       {"__inline", INLINE_KEYW},
-#line 35 "scripts/genksyms/keywords.gperf"
+#line 38 "scripts/genksyms/genksyms.gperf"
       {"auto", AUTO_KEYW},
-#line 23 "scripts/genksyms/keywords.gperf"
+#line 26 "scripts/genksyms/genksyms.gperf"
       {"__volatile", VOLATILE_KEYW},
       {""}, {""},
-#line 52 "scripts/genksyms/keywords.gperf"
+#line 55 "scripts/genksyms/genksyms.gperf"
       {"unsigned", UNSIGNED_KEYW},
       {""},
-#line 46 "scripts/genksyms/keywords.gperf"
+#line 49 "scripts/genksyms/genksyms.gperf"
       {"short", SHORT_KEYW},
-#line 42 "scripts/genksyms/keywords.gperf"
+#line 45 "scripts/genksyms/genksyms.gperf"
       {"inline", INLINE_KEYW},
       {""},
-#line 54 "scripts/genksyms/keywords.gperf"
+#line 57 "scripts/genksyms/genksyms.gperf"
       {"volatile", VOLATILE_KEYW},
-#line 44 "scripts/genksyms/keywords.gperf"
+#line 47 "scripts/genksyms/genksyms.gperf"
       {"long", LONG_KEYW},
-#line 26 "scripts/genksyms/keywords.gperf"
+#line 29 "scripts/genksyms/genksyms.gperf"
       {"_Bool", BOOL_KEYW},
       {""}, {""},
-#line 45 "scripts/genksyms/keywords.gperf"
+#line 48 "scripts/genksyms/genksyms.gperf"
       {"register", REGISTER_KEYW},
-#line 53 "scripts/genksyms/keywords.gperf"
+#line 56 "scripts/genksyms/genksyms.gperf"
       {"void", VOID_KEYW},
-#line 41 "scripts/genksyms/keywords.gperf"
+#line 44 "scripts/genksyms/genksyms.gperf"
       {"float", FLOAT_KEYW},
-#line 38 "scripts/genksyms/keywords.gperf"
+#line 41 "scripts/genksyms/genksyms.gperf"
       {"double", DOUBLE_KEYW},
       {""}, {""}, {""}, {""},
-#line 47 "scripts/genksyms/keywords.gperf"
+#line 50 "scripts/genksyms/genksyms.gperf"
       {"signed", SIGNED_KEYW}
     };
 
scripts/genksyms/genksyms.tab.c_shipped +254 -283

1,156 lines not on this page · raw message

scripts/genksyms/genksyms.tab.h_shipped deleted +0 -139

139 lines not on this page · raw message

scripts/genksyms/lex.genksyms.c_shipped +222 -689

1,533 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.7.3.4.574.g608b.dirty

Part of the diff is not shown here. View the raw message.

#8 lore raw

RFC 5/9 kconfig: constify `kconf_id_lookup'

In reply to Arnaud Lacombe
---
 scripts/kconfig/zconf.gperf |    2 +-
 scripts/kconfig/zconf.l     |    4 ++--
 scripts/kconfig/zconf.y     |    8 ++++----
 3 files changed, 7 insertions(+), 7 deletions(-)
scripts/kconfig/zconf.gperf +1 -1
index c9e690e..f14ab41 100644
@@ -9,7 +9,7 @@
 
 struct kconf_id;
 
-static struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len);
+static const struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len);
 
 %%
 mainmenu,	T_MAINMENU,	TF_COMMAND
scripts/kconfig/zconf.l +2 -2
index 3dbaec1..ee92b10 100644
@@ -96,7 +96,7 @@ n	[A-Za-z0-9_]
 
 <COMMAND>{
 	{n}+	{
-		struct kconf_id *id = kconf_id_lookup(yytext, yyleng);
+		const struct kconf_id *id = kconf_id_lookup(yytext, yyleng);
 		BEGIN(PARAM);
 		current_pos.file = current_file;
 		current_pos.lineno = current_file->lineno;
@@ -132,7 +132,7 @@ n	[A-Za-z0-9_]
 	\n	BEGIN(INITIAL); current_file->lineno++; return T_EOL;
 	---	/* ignore */
 	({n}|[-/.])+	{
-		struct kconf_id *id = kconf_id_lookup(yytext, yyleng);
+		const struct kconf_id *id = kconf_id_lookup(yytext, yyleng);
 		if (id && id->flags & TF_PARAM) {
 			zconflval.id = id;
 			return id->token;
scripts/kconfig/zconf.y +4 -4
index 49fb4ab..98c5716 100644
@@ -25,7 +25,7 @@ extern int zconflex(void);
 static void zconfprint(const char *err, ...);
 static void zconf_error(const char *err, ...);
 static void zconferror(const char *err);
-static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken);
+static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken);
 
 struct symbol *symbol_hash[SYMBOL_HASHSIZE];
 
@@ -45,7 +45,7 @@ static struct menu *current_menu, *current_entry;
 	struct symbol *symbol;
 	struct expr *expr;
 	struct menu *menu;
-	struct kconf_id *id;
+	const struct kconf_id *id;
 }
 
 %token <id>T_MAINMENU
@@ -229,7 +229,7 @@ symbol_option_list:
 	  /* empty */
 	| symbol_option_list T_WORD symbol_option_arg
 {
-	struct kconf_id *id = kconf_id_lookup($2, strlen($2));
+	const struct kconf_id *id = kconf_id_lookup($2, strlen($2));
 	if (id && id->flags & TF_OPTION)
 		menu_add_option(id->token, $3);
 	else
@@ -545,7 +545,7 @@ static const char *zconf_tokenname(int token)
 	return "<token>";
 }
 
-static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken)
+static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken)
 {
 	if (id->token != endtoken) {
 		zconf_error("unexpected '%s' within %s block",
Signature · 1 line
1.7.3.4.574.g608b.dirty
#9 lore raw

RFC 6/9 kconfig: regen parsers

In reply to Arnaud Lacombe
---
 scripts/kconfig/lex.zconf.c_shipped  |   26 +---
 scripts/kconfig/zconf.hash.c_shipped |  273 +++++++++++++++++++--------------
 scripts/kconfig/zconf.tab.c_shipped  |   32 +++--
 3 files changed, 183 insertions(+), 148 deletions(-)
scripts/kconfig/lex.zconf.c_shipped +6 -20
index 6eb0397..f14c57c 100644
@@ -1,5 +1,5 @@
 
-#line 3 "scripts/kconfig/lex.zconf.c"
+#line 3 "scripts/kconfig/lex.zconf.c_shipped"
 
 #define  YY_INT_ALIGNED short int
 
@@ -72,6 +72,7 @@ typedef int flex_int32_t;
 typedef unsigned char flex_uint8_t; 
 typedef unsigned short int flex_uint16_t;
 typedef unsigned int flex_uint32_t;
+#endif /* ! C99 */
 
 /* Limits of integral types. */
 #ifndef INT8_MIN
@@ -102,8 +103,6 @@ typedef unsigned int flex_uint32_t;
 #define UINT32_MAX             (4294967295U)
 #endif
 
-#endif /* ! C99 */
-
 #endif /* ! FLEXINT_H */
 
 #ifdef __cplusplus
@@ -160,15 +159,7 @@ typedef unsigned int flex_uint32_t;
 
 /* Size of default input buffer. */
 #ifndef YY_BUF_SIZE
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k.
- * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
- * Ditto for the __ia64__ case accordingly.
- */
-#define YY_BUF_SIZE 32768
-#else
 #define YY_BUF_SIZE 16384
-#endif /* __ia64__ */
 #endif
 
 /* The state buf must be large enough to hold one state per character in the main buffer.
@@ -922,12 +913,7 @@ static int input (void );
 
 /* Amount of stuff to slurp up with each read. */
 #ifndef YY_READ_BUF_SIZE
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k */
-#define YY_READ_BUF_SIZE 16384
-#else
 #define YY_READ_BUF_SIZE 8192
-#endif /* __ia64__ */
 #endif
 
 /* Copy whatever the last rule matched to the standard output. */
@@ -1100,7 +1086,7 @@ YY_RULE_SETUP
 case 6:
 YY_RULE_SETUP
 {
-		struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng);
+		const struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng);
 		BEGIN(PARAM);
 		current_pos.file = current_file;
 		current_pos.lineno = current_file->lineno;
@@ -1175,7 +1161,7 @@ YY_RULE_SETUP
 case 19:
 YY_RULE_SETUP
 {
-		struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng);
+		const struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng);
 		if (id && id->flags & TF_PARAM) {
 			zconflval.id = id;
 			return id->token;
@@ -2073,8 +2059,8 @@ YY_BUFFER_STATE zconf_scan_string (yyconst char * yystr )
 
 /** Setup the input buffer state to scan the given bytes. The next call to zconflex() will
  * scan from a @e copy of @a bytes.
- * @param yybytes the byte buffer to scan
- * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
+ * @param bytes the byte buffer to scan
+ * @param len the number of bytes in the buffer pointed to by @a bytes.
  * 
  * @return the newly allocated buffer state object.
  */
scripts/kconfig/zconf.hash.c_shipped +157 -116

352 lines not on this page · raw message

scripts/kconfig/zconf.tab.c_shipped +20 -12
index 4c5495e..a2cb969 100644
@@ -1,10 +1,9 @@
-
-/* A Bison parser, made by GNU Bison 2.4.1.  */
+/* A Bison parser, made by GNU Bison 2.4.3.  */
 
 /* Skeleton implementation for Bison's Yacc-like parsers in C
    
-      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
-   Free Software Foundation, Inc.
+      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+   2009, 2010 Free Software Foundation, Inc.
    
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -46,7 +45,7 @@
 #define YYBISON 1
 
 /* Bison version.  */
-#define YYBISON_VERSION "2.4.1"
+#define YYBISON_VERSION "2.4.3"
 
 /* Skeleton name.  */
 #define YYSKELETON_NAME "yacc.c"
@@ -102,7 +101,7 @@ extern int zconflex(void);
 static void zconfprint(const char *err, ...);
 static void zconf_error(const char *err, ...);
 static void zconferror(const char *err);
-static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken);
+static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken);
 
 struct symbol *symbol_hash[SYMBOL_HASHSIZE];
 
@@ -188,7 +187,7 @@ typedef union YYSTYPE
 	struct symbol *symbol;
 	struct expr *expr;
 	struct menu *menu;
-	struct kconf_id *id;
+	const struct kconf_id *id;
 
 
 
@@ -255,7 +254,7 @@ typedef short int yytype_int16;
 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
 
 #ifndef YY_
-# if YYENABLE_NLS
+# if defined YYENABLE_NLS && YYENABLE_NLS
 #  if ENABLE_NLS
 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
 #   define YY_(msgid) dgettext ("bison-runtime", msgid)
@@ -806,9 +805,18 @@ static const yytype_uint8 yystos[] =
 
 /* Like YYERROR except do call yyerror.  This remains here temporarily
    to ease the transition to the new meaning of YYERROR, for GCC.
-   Once GCC version 2 has supplanted version 1, this can go.  */
+   Once GCC version 2 has supplanted version 1, this can go.  However,
+   YYFAIL appears to be in use.  Nevertheless, it is formally deprecated
+   in Bison 2.4.2's NEWS entry, where a plan to phase it out is
+   discussed.  */
 
 #define YYFAIL		goto yyerrlab
+#if defined YYFAIL
+  /* This is here to suppress warnings from the GCC cpp's
+     -Wunused-macros.  Normally we don't worry about that warning, but
+     some users do, and we want to make it easy for users to remove
+     YYFAIL uses, which will produce warnings from Bison 2.5.  */
+#endif
 
 #define YYRECOVERING()  (!!yyerrstatus)
 
@@ -865,7 +873,7 @@ while (YYID (0))
    we won't break user code: when these are the locations we know.  */
 
 #ifndef YY_LOCATION_PRINT
-# if YYLTYPE_IS_TRIVIAL
+# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
 #  define YY_LOCATION_PRINT(File, Loc)			\
      fprintf (File, "%d.%d-%d.%d",			\
 	      (Loc).first_line, (Loc).first_column,	\
@@ -1753,7 +1761,7 @@ yyreduce:
   case 48:
 
     {
-	struct kconf_id *id = kconf_id_lookup((yyvsp[(2) - (3)].string), strlen((yyvsp[(2) - (3)].string)));
+	const struct kconf_id *id = kconf_id_lookup((yyvsp[(2) - (3)].string), strlen((yyvsp[(2) - (3)].string)));
 	if (id && id->flags & TF_OPTION)
 		menu_add_option(id->token, (yyvsp[(3) - (3)].string));
 	else
@@ -2300,7 +2308,7 @@ static const char *zconf_tokenname(int token)
 	return "<token>";
 }
 
-static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken)
+static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken)
 {
 	if (id->token != endtoken) {
 		zconf_error("unexpected '%s' within %s block",
Signature · 1 line
1.7.3.4.574.g608b.dirty
#10 lore raw

RFC 7/9 kbuild: merge parser generation rules

In reply to Arnaud Lacombe
---
 scripts/Makefile.lib      |   31 ++++++++++++++++++++++++++++++-
 scripts/genksyms/Makefile |   20 --------------------
 scripts/kconfig/Makefile  |   25 -------------------------
 3 files changed, 30 insertions(+), 46 deletions(-)
scripts/Makefile.lib +30 -1
index 1c702ca..74a73de 100644
@@ -160,13 +160,42 @@ ld_flags       = $(LDFLAGS) $(ldflags-y)
 modname-multi = $(sort $(foreach m,$(multi-used),\
 		$(if $(filter $(subst $(obj)/,,$*.o), $($(m:.o=-objs)) $($(m:.o=-y))),$(m:.o=))))
 
+ifdef REGENERATE_PARSERS
+# GPERF
+# ---------------------------------------------------------------------------
+quiet_cmd_gperf = GPERF $@
+      cmd_gperf = gperf -t --output-file $@ -a -C -E -g -k 1,3,$$ -p -t $<
+$(src)/%.hash.c_shipped: $(src)/%.gperf
+	$(call cmd,gperf)
+
+# LEX
+# ---------------------------------------------------------------------------
+quiet_cmd_flex = LEX     $@
+      cmd_flex = flex -L -P$(notdir $*) -o$@ $<
+$(src)/lex.%.c_shipped: $(src)/%.l
+	$(call cmd,flex)
+
+# YACC
+# ---------------------------------------------------------------------------
+quiet_cmd_bison = YACC    $@
+      cmd_bison = bison -o$@ -l -b $* -p $(notdir $*) $<
+$(src)/%.tab.c_shipped: $(src)/%.y
+	$(call cmd,bison)
+endif
+
 # Shipped files
 # ===========================================================================
 
 quiet_cmd_shipped = SHIPPED $@
 cmd_shipped = cat $< > $@
 
-$(obj)/%:: $(src)/%_shipped
+$(obj)/%.tab.c: $(src)/%.tab.c_shipped
+	$(call cmd,shipped)
+
+$(obj)/lex.%.c: $(src)/lex.%.c_shipped
+	$(call cmd,shipped)
+
+$(obj)/%.hash.c: $(src)/%.hash.c_shipped
 	$(call cmd,shipped)
 
 # Commands useful for building a boot image
scripts/genksyms/Makefile +0 -20
index de6675d..e3295a8 100644
@@ -14,23 +14,3 @@ clean-files	:= genksyms.tab.c lex.genksyms.c genksyms.hash.c
 
 $(obj)/genksyms.tab.o: $(obj)/lex.genksyms.c $(obj)/genksyms.hash.c
 
-ifdef GENKSYMS_GENPARSER
-
-$(obj)/genksyms.tab.c: $(src)/genksyms.y
-$(obj)/lex.genksyms.c: $(src)/genksyms.l
-$(obj)/genksyms.hash.c: $(src)/genksyms.gperf
-
-%.tab.c: %.y
-	bison -l -b $* -p $(notdir $*) $<
-	cp $@ $@_shipped
-
-lex.%.c: %.l
-	flex -L -P$(notdir $*) -o$@ $<
-	cp $@ $@_shipped
-
-%.hash.c: %.gperf
-	gperf -t --output-file $@ -a -C -E -g -k 1,3,$$ -p -t $<
-	cp $@ $@_shipped
-
-endif
-
scripts/kconfig/Makefile +0 -25
index 368ae30..c9ec4d6 100644
@@ -327,28 +327,3 @@ $(obj)/lkc_defs.h: $(src)/lkc_proto.h
 $(obj)/gconf.glade.h: $(obj)/gconf.glade
 	intltool-extract --type=gettext/glade $(obj)/gconf.glade
 
-###
-# The following requires flex/bison/gperf
-# By default we use the _shipped versions, uncomment the following line if
-# you are modifying the flex/bison src.
-# LKC_GENPARSER := 1
-
-ifdef LKC_GENPARSER
-
-$(obj)/zconf.tab.c: $(src)/zconf.y
-$(obj)/lex.zconf.c: $(src)/zconf.l
-$(obj)/zconf.hash.c: $(src)/zconf.gperf
-
-%.tab.c: %.y
-	bison -l -b $* -p $(notdir $*) $<
-	cp $@ $@_shipped
-
-lex.%.c: %.l
-	flex -L -P$(notdir $*) -o$@ $<
-	cp $@ $@_shipped
-
-%.hash.c: %.gperf
-	gperf < $< > $@
-	cp $@ $@_shipped
-
-endif
Signature · 1 line
1.7.3.4.574.g608b.dirty
#13 lore raw

RFC 8/9 kconfig: regen parser

In reply to Arnaud Lacombe
---
 scripts/kconfig/zconf.hash.c_shipped |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
scripts/kconfig/zconf.hash.c_shipped +1 -1
index 96bbec5..40df000 100644
@@ -1,5 +1,5 @@
 /* ANSI-C code produced by gperf version 3.0.4 */
-/* Command-line: gperf -t --output-file scripts/kconfig/zconf.hash.c_shipped -L ANSI-C -a -C -E -g -k '1,3,$' -p -t scripts/kconfig/zconf.gperf  */
+/* Command-line: gperf -t --output-file scripts/kconfig/zconf.hash.c_shipped -a -C -E -g -k '1,3,$' -p -t scripts/kconfig/zconf.gperf  */
 
 #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
       && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
Signature · 1 line
1.7.3.4.574.g608b.dirty
#14 lore raw

RFC 9/9 genksyms: regen parser

In reply to Arnaud Lacombe
---
 scripts/genksyms/genksyms.hash.c_shipped |    2 +-
 scripts/genksyms/lex.genksyms.c_shipped  |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
scripts/genksyms/genksyms.hash.c_shipped +1 -1
index 04c6524..f17d54d 100644
@@ -1,5 +1,5 @@
 /* ANSI-C code produced by gperf version 3.0.4 */
-/* Command-line: gperf -t --output-file scripts/genksyms/genksyms.hash.c -a -C -E -g -k '1,3,$' -p -t scripts/genksyms/genksyms.gperf  */
+/* Command-line: gperf -t --output-file scripts/genksyms/genksyms.hash.c_shipped -a -C -E -g -k '1,3,$' -p -t scripts/genksyms/genksyms.gperf  */
 
 #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
       && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
scripts/genksyms/lex.genksyms.c_shipped +1 -1
index 9a827a2..ec972bc 100644
@@ -1,5 +1,5 @@
 
-#line 3 "scripts/genksyms/lex.genksyms.c"
+#line 3 "scripts/genksyms/lex.genksyms.c_shipped"
 
 #define  YY_INT_ALIGNED short int
 
Signature · 1 line
1.7.3.4.574.g608b.dirty
#2 lore raw

Re: [RFC 2/9] genksyms: finalize rename

In reply to Arnaud Lacombe

Hi,

Quoted 1 line · Arnaud Lacombe

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

#11 lore raw

Re: [RFC 7/9] kbuild: merge parser generation rules

In reply to Arnaud Lacombe

Hi Arnaud,

nice cleanup, I only have a few random comments to this and other patches.

Quoted 8 lines · Arnaud Lacombe

# Shipped files
# ===========================================================================

quiet_cmd_shipped = SHIPPED $@
cmd_shipped = cat $< > $@

-$(obj)/%:: $(src)/%_shipped
+$(obj)/%.tab.c: $(src)/%.tab.c_shipped

scripts/Makefile.lib ld_flags = $(LDFLAGS) $(ldflags-y) · line 199

Quoted 7 lines
scripts/Makefile.lib +6 -0
+	$(call cmd,shipped)
+
+$(obj)/lex.%.c: $(src)/lex.%.c_shipped
+	$(call cmd,shipped)
+
+$(obj)/%.hash.c: $(src)/%.hash.c_shipped
 	$(call cmd,shipped)

Please don't change this rule, there are other uses of _shipped files in the tree than just bison/lex/gperf generated files.

#16 lore raw

Re: [RFC 1/9] genksyms: rename parser files

In reply to a message not in the archive
Quoted 1 line · Arnaud Lacombe

Rename parser's files to make them follow the same convention as `kconfig'.

This mail didn't reach the mailing list, probably for size reasons. I suggest you create the patch with the -M option, it will be a bit harder to apply, but people will be able to see it.

Quoted 7 lines
---
 scripts/genksyms/genksyms.gperf          |   56 +
 scripts/genksyms/genksyms.hash.c_shipped |  220 +++
 scripts/genksyms/genksyms.l              |  409 +++++
 scripts/genksyms/genksyms.tab.c_shipped  | 2353 ++++++++++++++++++++++++++
 scripts/genksyms/genksyms.tab.h_shipped  |  139 ++
 scripts/genksyms/genksyms.y              |  473 ++++++
Quoted 8 lines
 scripts/genksyms/keywords.c_shipped      |  220 ---
 scripts/genksyms/keywords.gperf          |   56 -
 scripts/genksyms/lex.c_shipped           | 2709 ------------------------------
 scripts/genksyms/lex.genksyms.c_shipped  | 2709 ++++++++++++++++++++++++++++++
 scripts/genksyms/lex.l                   |  409 -----
 scripts/genksyms/parse.c_shipped         | 2353 --------------------------
 scripts/genksyms/parse.h_shipped         |  139 --
 scripts/genksyms/parse.y                 |  473 ------

Renaming lex.l is a good idea, lex.lex.c would look silly. But I would leave parse.y and keywords.gperf and only rename the _shipped files to match what the new rules do. The names are local to the directory, so there is no urgent need to change them (and the history is easier to view if there are fewer renames).

Michal

#3 lore raw

Re: [RFC 2/9] genksyms: finalize rename

In reply to Arnaud Lacombe
Quoted 34 lines · Arnaud Lacombe
---
 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(-)
scripts/genksyms/.gitignore +3 -3
index be5cadb..0983577 100644
@@ -1,4 +1,4 @@
-keywords.c
-lex.c
-parse.[ch]
 genksyms
+genksyms.tab.c
+lex.genksyms.c
+genksyms.hash.c
scripts/genksyms/Makefile +1 -1
index e420fe4..82bb25f 100644
@@ -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)
 

scripts/genksyms/Makefile line 13

Quoted 10 lines
scripts/genksyms/Makefile +1 -6
-# 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

#12 lore raw

Re: [RFC 7/9] kbuild: merge parser generation rules

In reply to Michal Marek

Hi,

Quoted 11 lines · Michal Marek

Hi Arnaud,

nice cleanup, I only have a few random comments to this and other patches.

Quoted 6 lines · Arnaud Lacombe

 # Shipped files
 # ===========================================================================

 quiet_cmd_shipped = SHIPPED $@
 cmd_shipped = cat $< > $@

Quoted 13 lines
Quoted 9 lines

-$(obj)/%:: $(src)/%_shipped
+$(obj)/%.tab.c: $(src)/%.tab.c_shipped
+     $(call cmd,shipped)

scripts/Makefile.lib +5 -0
+
+$(obj)/lex.%.c: $(src)/lex.%.c_shipped
+     $(call cmd,shipped)
+
+$(obj)/%.hash.c: $(src)/%.hash.c_shipped

      $(call cmd,shipped)

Please don't change this rule, there are other uses of _shipped files in the tree than just bison/lex/gperf generated files.

I could not make the other implicit target work without changing this one. Ie:

$(src)/%.tab.c_shipped: $(src)/%.y

       $(call cmd,bison)

was not working with the _shipped rules left intact, but hardcoding stem value, eg.:

$(src)/zconf.tab.c_shipped: $(src)/zconf.y

       $(call cmd,bison)

was working, at least to link the different implicit target, but that's breaking other part. I'll try to re-investigate tonight.

- Arnaud

#17 lore raw

Re: [RFC 1/9] genksyms: rename parser files

In reply to Michal Marek

Hi,

Quoted 7 lines · Michal Marek
Quoted 1 line · Arnaud Lacombe

Rename parser's files to make them follow the same convention as `kconfig'.

This mail didn't reach the mailing list, probably for size reasons. I suggest you create the patch with the -M option, it will be a bit harder to apply, but people will be able to see it.

yup, will do.

Quoted 7 lines
Quoted 6 lines

 scripts/genksyms/lex.c_shipped           | 2709 ------------------------------ scripts/genksyms/lex.genksyms.c_shipped  | 2709 ++++++++++++++++++++++++++++++ scripts/genksyms/lex.l                   |  409 ----- scripts/genksyms/parse.c_shipped         | 2353 -------------------------- scripts/genksyms/parse.h_shipped         |  139 -- scripts/genksyms/parse.y                 |  473 ------

Quoted 6 lines

Renaming lex.l is a good idea, lex.lex.c would look silly. But I would leave parse.y and keywords.gperf and only rename the _shipped files to match what the new rules do. The names are local to the directory, so there is no urgent need to change them
(and the history is easier to view if there are fewer renames).

@$!# ... git-blame and git-log do not behave the same on renamed
file... That is, when ran on a renamed file, git-blame will show the
old blame, totally unaffected, while git-log will only display the
history of the new name. Of course, I only checked git-blame :)

- Arnaud

#4 lore raw

Re: [RFC 2/9] genksyms: finalize rename

In reply to Michal Marek

Hi,

Quoted 41 lines · Michal Marek
Quoted 40 lines · Arnaud Lacombe

---
 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(-)
scripts/genksyms/.gitignore +0 -3
index be5cadb..0983577 100644
@@ -1,4 +1,4 @@
-keywords.c
-lex.c
-parse.[ch]

 genksyms

scripts/genksyms/.gitignore +3 -0
+genksyms.tab.c
+lex.genksyms.c
+genksyms.hash.c
scripts/genksyms/Makefile +0 -0
index e420fe4..82bb25f 100644
@@ -2,52 +2,35 @@

 hostprogs-y  := genksyms
 always               := $(hostprogs-y)

scripts/genksyms/Makefile +1 -1
-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)

scripts/genksyms/Makefile +0 -3
-# 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)

Quoted 10 lines

scripts/genksyms/Makefile line 13

Quoted 4 lines
scripts/genksyms/Makefile +1 -3
-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

#5 lore raw

Re: [RFC 2/9] genksyms: finalize rename

Hi,

Quoted 54 lines · Arnaud Lacombe

Hi,

Quoted 41 lines · Michal Marek
Quoted 40 lines · Arnaud Lacombe

---
 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(-)
scripts/genksyms/.gitignore +0 -3
index be5cadb..0983577 100644
@@ -1,4 +1,4 @@
-keywords.c
-lex.c
-parse.[ch]

 genksyms

scripts/genksyms/.gitignore +3 -0
+genksyms.tab.c
+lex.genksyms.c
+genksyms.hash.c
scripts/genksyms/Makefile +0 -0
index e420fe4..82bb25f 100644
@@ -2,52 +2,35 @@

 hostprogs-y  := genksyms
 always               := $(hostprogs-y)

scripts/genksyms/Makefile +1 -1
-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)

scripts/genksyms/Makefile +0 -3
-# 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)

Quoted 10 lines

scripts/genksyms/Makefile line 13

Quoted 4 lines
scripts/genksyms/Makefile +1 -3
-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.

Quoted 2 lines

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

#18 lore raw

Re: [RFC 1/9] genksyms: rename parser files

In reply to Arnaud Lacombe

Hi,

Quoted 25 lines · Arnaud Lacombe

Hi,

Quoted 7 lines · Michal Marek
Quoted 1 line · Arnaud Lacombe

Rename parser's files to make them follow the same convention as `kconfig'.

This mail didn't reach the mailing list, probably for size reasons. I suggest you create the patch with the -M option, it will be a bit harder to apply, but people will be able to see it.

yup, will do.

Quoted 13 lines
Quoted 6 lines

 scripts/genksyms/lex.c_shipped           | 2709 ------------------------------ scripts/genksyms/lex.genksyms.c_shipped  | 2709 ++++++++++++++++++++++++++++++ scripts/genksyms/lex.l                   |  409 ----- scripts/genksyms/parse.c_shipped         | 2353 -------------------------- scripts/genksyms/parse.h_shipped         |  139 -- scripts/genksyms/parse.y                 |  473 ------

Renaming lex.l is a good idea, lex.lex.c would look silly. But I would leave parse.y and keywords.gperf and only rename the _shipped files to match what the new rules do. The names are local to the directory, so there is no urgent need to change them
(and the history is easier to view if there are fewer renames).

actually, renaming both the parser and the lexer would have been needed if we want to keep using the -p option for bison and -P option for flex, ie. using zconfparse() instead of yyparse(). The rationale being that the rules use the filename to derive the prefix. Without rename, we end up with very silly function name ala "lexlex()" or "parseparse()". For now, I will just drop those two options, kconfig will need to be fix to reflect this.

Unfortunately, there do not seem to be a less non-intrusive solution. If renaming, kconfig is fine, genksyms needs fixes; if not renaming, kconfig needs fixes, genksyms is fine...

- Arnaud