On Mon, Oct 22, 2007 at 01:04:33PM -0400, Robert P. J. Day wrote:
> 
>   based on a recent posting, here's a first phase of adding actual,
> official maturity levels to Kconfig entries.  all the following patch
> does is add that *functionality* to the entries -- it makes no attempt
> to process that information in terms of displaying it or selecting
> based on it (yet).  i've tested it to the extent that it will accept
> either of the official maturity levels of DEPRECATED or OBSOLETE, and
> will complain about anything else.
> 
>   again, all i'm looking to do with this patch is add that (optional)
> information to a Kconfig entry -- i don't want to include anything in
> this patch that, in any way, tries to go any further than that in
> terms of actual processing or display.  that comes later.
> 
>   thoughts on this patch?

>From your patch it looks like the maturity marker can be used in two places:

config foo
        maturity OBSOLETE

menu "This is a menu"
        maturity DEPRECATED

Correct?

You failed to document the additional two shift/reduce conflicts.
We know it works with teh current 26 but where come the additional
2 shift/reduce conflicts from?

For a real submission you will update Documentaion/kbuild/kconfig*
I assume.

I see from the code that you apply the maturity level to a symbol.
But what about the following:

menu "first menu"

config FOO
        bool "Bla bla"
        depends on FOOBAR
        maturity OBSOLETE

endmenu


menu "second menu"

config FOO
        bool "more bla bla"
        depends on BAZBAR
        maturity DEPRECATED

endmenu

Here we have different maturity level for the same symbol in
two different contexts.

Please use menu_warn (or add menu_error) to get proper format of the 
errormessage.

        Sam

> @@ -251,7 +251,7 @@ $(obj)/lkc_defs.h: $(src)/lkc_proto.h
>  # 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
> +LKC_GENPARSER := 1
> 
>  ifdef LKC_GENPARSER
> 
> diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
> index a195986..17eed64 100644
> --- a/scripts/kconfig/expr.h
> +++ b/scripts/kconfig/expr.h
> @@ -60,7 +60,11 @@ struct symbol_value {
>  };
> 
>  enum symbol_type {
> -     S_UNKNOWN, S_BOOLEAN, S_TRISTATE, S_INT, S_HEX, S_STRING, S_OTHER
> +     S_UNKNOWN, S_BOOLEAN, S_TRISTATE, S_INT, S_HEX, S_STRING, S_MATURITY, 
> S_OTHER
> +};
> +
> +enum maturity_level {
> +     M_NONE, M_DEPRECATED, M_OBSOLETE
>  };
> 
>  enum {
> @@ -71,6 +75,7 @@ enum {
>  struct symbol {
>       struct symbol *next;
>       char *name;
> +     enum maturity_level maturity;
>       enum symbol_type type;
>       struct symbol_value curr;
>       struct symbol_value def[4];
> diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
> index 8a07ee4..9add1cd 100644
> --- a/scripts/kconfig/lkc.h
> +++ b/scripts/kconfig/lkc.h
> @@ -79,6 +79,7 @@ void menu_end_menu(void);
>  void menu_add_entry(struct symbol *sym);
>  void menu_end_entry(void);
>  void menu_add_dep(struct expr *dep);
> +void menu_set_maturity(struct symbol *sym);
>  struct property *menu_add_prop(enum prop_type type, char *prompt, struct 
> expr *expr, struct expr *dep);
>  struct property *menu_add_prompt(enum prop_type type, char *prompt, struct 
> expr *dep);
>  void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep);
> diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
> index f9d0d91..16b2f31 100644
> --- a/scripts/kconfig/menu.c
> +++ b/scripts/kconfig/menu.c
> @@ -104,6 +104,15 @@ void menu_add_dep(struct expr *dep)
>       current_entry->dep = expr_alloc_and(current_entry->dep, 
> menu_check_dep(dep));
>  }
> 
> +void menu_set_maturity(struct symbol *sym)
> +{
> +     if (sym->type != S_MATURITY) {
> +             zconf_error("'%s' is an invalid maturity level", sym->name);
> +     } else {
> +             current_entry->sym->maturity = sym->maturity;
> +     }
> +}
> +
>  void menu_set_type(int type)
>  {
>       struct symbol *sym = current_entry->sym;
> diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
> index c35dcc5..8a3cc02 100644
> --- a/scripts/kconfig/symbol.c
> +++ b/scripts/kconfig/symbol.c
> @@ -72,6 +72,14 @@ void sym_init(void)
>       sym->type = S_STRING;
>       sym->flags |= SYMBOL_AUTO;
>       sym_add_default(sym, uts.release);
> +
> +     sym = sym_lookup("DEPRECATED", 0);
> +     sym->type = S_MATURITY;
> +     sym->maturity = M_DEPRECATED;
> +
> +     sym = sym_lookup("OBSOLETE", 0);
> +     sym->type = S_MATURITY;
> +     sym->maturity = M_OBSOLETE;
>  }
> 
>  enum symbol_type sym_get_type(struct symbol *sym)
> @@ -100,6 +108,8 @@ const char *sym_type_name(enum symbol_type type)
>               return "hex";
>       case S_STRING:
>               return "string";
> +     case S_MATURITY:
> +             return "maturity";
>       case S_UNKNOWN:
>               return "unknown";
>       case S_OTHER:
> @@ -679,6 +689,7 @@ struct symbol *sym_lookup(const char *name, int isconst)
>       memset(symbol, 0, sizeof(*symbol));
>       symbol->name = new_name;
>       symbol->type = S_UNKNOWN;
> +     symbol->maturity = M_NONE;
>       if (isconst)
>               symbol->flags |= SYMBOL_CONST;
> 
> diff --git a/scripts/kconfig/zconf.gperf b/scripts/kconfig/zconf.gperf
> index 93538e5..d8f6d7c 100644
> --- a/scripts/kconfig/zconf.gperf
> +++ b/scripts/kconfig/zconf.gperf
> @@ -24,6 +24,7 @@ if,         T_IF,           TF_COMMAND|TF_PARAM
>  endif,               T_ENDIF,        TF_COMMAND
>  depends,     T_DEPENDS,      TF_COMMAND
>  optional,    T_OPTIONAL,     TF_COMMAND
> +maturity,    T_MATURITY,     TF_COMMAND,
>  default,     T_DEFAULT,      TF_COMMAND, S_UNKNOWN
>  prompt,              T_PROMPT,       TF_COMMAND
>  tristate,    T_TYPE,         TF_COMMAND, S_TRISTATE
> diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y
> index d9b96ba..ed42f00 100644
> --- a/scripts/kconfig/zconf.y
> +++ b/scripts/kconfig/zconf.y
> @@ -38,7 +38,7 @@ static struct menu *current_menu, *current_entry;
>  #define YYERROR_VERBOSE
>  #endif
>  %}
> -%expect 26
> +%expect 28
> 
>  %union
>  {
> @@ -65,6 +65,7 @@ static struct menu *current_menu, *current_entry;
>  %token <id>T_ENDIF
>  %token <id>T_DEPENDS
>  %token <id>T_OPTIONAL
> +%token <id>T_MATURITY
>  %token <id>T_PROMPT
>  %token <id>T_TYPE
>  %token <id>T_DEFAULT
> @@ -119,7 +120,7 @@ stmt_list:
>  ;
> 
>  option_name:
> -     T_DEPENDS | T_PROMPT | T_TYPE | T_SELECT | T_OPTIONAL | T_RANGE | 
> T_DEFAULT
> +     T_DEPENDS | T_MATURITY | T_PROMPT | T_TYPE | T_SELECT | T_OPTIONAL | 
> T_RANGE | T_DEFAULT
>  ;
> 
>  common_stmt:
> @@ -176,6 +177,7 @@ config_option_list:
>       | config_option_list config_option
>       | config_option_list symbol_option
>       | config_option_list depends
> +     | config_option_list maturity
>       | config_option_list help
>       | config_option_list option_error
>       | config_option_list T_EOL
> @@ -268,6 +270,7 @@ choice_option_list:
>         /* empty */
>       | choice_option_list choice_option
>       | choice_option_list depends
> +     | choice_option_list maturity
>       | choice_option_list help
>       | choice_option_list T_EOL
>       | choice_option_list option_error
> @@ -348,7 +351,7 @@ menu: T_MENU prompt T_EOL
>       printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
>  };
> 
> -menu_entry: menu depends_list
> +menu_entry: menu maturity_set_opt depends_list
>  {
>       $$ = menu_add_menu();
>  };
> @@ -419,6 +422,19 @@ depends: T_DEPENDS T_ON expr T_EOL
>       printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), 
> zconf_lineno());
>  };
> 
> +/* maturity setting */
> +
> +maturity_set_opt:
> +       /* empty */
> +     | maturity
> +;
> +
> +maturity: T_MATURITY symbol T_EOL
> +{
> +     menu_set_maturity($2);
> +     printd(DEBUG_PARSE, "%s:%d:maturity\n", zconf_curname(), 
> zconf_lineno());
> +};
> +
>  /* prompt statement */
> 
>  prompt_stmt_opt:
> @@ -508,6 +524,7 @@ const char *zconf_tokenname(int token)
>       case T_IF:              return "if";
>       case T_ENDIF:           return "endif";
>       case T_DEPENDS:         return "depends";
> +     case T_MATURITY:        return "maturity";
>       }
>       return "<token>";
>  }
> @@ -604,6 +621,9 @@ void print_symbol(FILE *out, struct menu *menu)
>       case S_HEX:
>               fputs("  hex\n", out);
>               break;
> +     case S_MATURITY:
> +             fputs("  maturity\n", out);
> +             break;
>       default:
>               fputs("  ???\n", out);
>               break;
> 
> -- 
> ========================================================================
> Robert P. J. Day
> Linux Consulting, Training and Annoying Kernel Pedantry
> Waterloo, Ontario, CANADA
> 
> http://crashcourse.ca
> ========================================================================
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
> the body of a message to [EMAIL PROTECTED]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
-
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to