lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BANLkTimfbi_QOVP_Wm7yD=grz1BBOFbEKg@mail.gmail.com>
Date:	Fri, 13 May 2011 14:18:50 -0400
From:	Arnaud Lacombe <lacombar@...il.com>
To:	Jean-Christophe PLAGNIOL-VILLARD <plagnioj@...osoft.com>
Cc:	linux-kernel@...r.kernel.org, linux-kbuild@...r.kernel.org
Subject: Re: [PATCH v2] kconfig: autogenerated config_is_xxx macro

Hi,

On Fri, May 6, 2011 at 1:03 AM, Jean-Christophe PLAGNIOL-VILLARD
<plagnioj@...osoft.com> wrote:
> this will allow to use to use
>
>        if(config_is_xxx())
>        if(config_is_xxx_module())
>
> in the code instead of
>
>        #ifdef CONFIG_xxx
>        #ifdef CONFIG_xxx_MODULE
>
> and now let the compiler remove the non usefull code and not the
> pre-processor
>
For the record, there is at least one report of dead code elimination
regression in GCC 4.4.x:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42494

 - Arnaud

> as done in the mach-types for arm as exmaple
>
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@...osoft.com>
> ---
> v2:
>
>        use config_is
>
>        add support of config_is_xxxx_module
>
> Best Regards,
> J.
>  scripts/kconfig/confdata.c |   29 +++++++++++++++++++++++++++++
>  1 files changed, 29 insertions(+), 0 deletions(-)
>
> diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
> index 61c35bf..11b8b31 100644
> --- a/scripts/kconfig/confdata.c
> +++ b/scripts/kconfig/confdata.c
> @@ -778,6 +778,29 @@ out:
>        return res;
>  }
>
> +static void conf_write_function_autoconf(FILE *out, char* conf, char* name,
> +                                        int val)
> +{
> +       char c;
> +       char *tmp, *d;
> +
> +       d = strdup(conf);
> +       tmp = d;
> +       while ((c = *conf++))
> +               *d++ = tolower(c);
> +
> +       fprintf(out, "#define %sis_", tmp);
> +       free(tmp);
> +
> +       d = strdup(name);
> +       tmp = d;
> +       while ((c = *name++))
> +               *d++ = tolower(c);
> +       fprintf(out, "%s%s() %d\n", tmp, (val > 1) ? "_module" : "",
> +                     val ? 1 : 0);
> +       free(tmp);
> +}
> +
>  int conf_write_autoconf(void)
>  {
>        struct symbol *sym;
> @@ -786,6 +809,7 @@ int conf_write_autoconf(void)
>        FILE *out, *tristate, *out_h;
>        time_t now;
>        int i;
> +       int fct_val;
>
>        sym_clear_all_valid();
>
> @@ -829,6 +853,7 @@ int conf_write_autoconf(void)
>                       rootmenu.prompt->text, ctime(&now));
>
>        for_all_symbols(i, sym) {
> +               fct_val = 1;
>                sym_calc_value(sym);
>                if (!(sym->flags & SYMBOL_WRITE) || !sym->name)
>                        continue;
> @@ -842,12 +867,14 @@ int conf_write_autoconf(void)
>                case S_TRISTATE:
>                        switch (sym_get_tristate_value(sym)) {
>                        case no:
> +                               fct_val = 0;
>                                break;
>                        case mod:
>                                fprintf(tristate, "%s%s=M\n",
>                                    CONFIG_, sym->name);
>                                fprintf(out_h, "#define %s%s_MODULE 1\n",
>                                    CONFIG_, sym->name);
> +                               fct_val = 2;
>                                break;
>                        case yes:
>                                if (sym->type == S_TRISTATE)
> @@ -874,8 +901,10 @@ int conf_write_autoconf(void)
>                            CONFIG_, sym->name, str);
>                        break;
>                default:
> +                       fct_val = 0;
>                        break;
>                }
> +               conf_write_function_autoconf(out_h, CONFIG_, sym->name, fct_val);
>        }
>        fclose(out);
>        fclose(tristate);
> --
> 1.7.4.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ