All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kconfig: fix missing "0x" prefix from S_HEX symbol in autoconf.h
@ 2011-07-14 19:31 Arnaud Lacombe
  2011-07-14 23:20 ` Mauro Carvalho Chehab
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Arnaud Lacombe @ 2011-07-14 19:31 UTC (permalink / raw)
  To: linux-kbuild, Michal Marek
  Cc: Arnaud Lacombe, Randy Dunlap, Mauro Carvalho Chehab

The specialized printer for headers (espectially autoconf.h) is missing fixup
code for S_HEX symbol's "0x" prefix. As long as kconfig does not warn for such
missing prefix, this code is needed. Fix this.

In the same time, fix some nits in `header_print_symbol()'.

Cc: Randy Dunlap <rdunlap@xenotime.net>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>

Broken-by: Arnaud Lacombe <lacombar@gmail.com>
(Somehow-)Reported-by: Randy Dunlap <rdunlap@xenotime.net>
Reported-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>

---
 scripts/kconfig/confdata.c |   26 +++++++++++++++++++++-----
 1 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index be6952c..df629ec 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -487,27 +487,43 @@ static struct conf_printer kconfig_printer_cb =
 static void
 header_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg)
 {
-	const char *suffix = "";
 
 	switch (sym->type) {
 	case S_BOOLEAN:
-	case S_TRISTATE:
+	case S_TRISTATE: {
+		const char *suffix = "";
+
 		switch (*value) {
 		case 'n':
 			return;
 		case 'm':
 			suffix = "_MODULE";
-			/* FALLTHROUGH */
+			/* fall through */
 		default:
 			value = "1";
 		}
+		fprintf(fp, "#define %s%s%s %s\n",
+		    CONFIG_, sym->name, suffix, value);
+		break;
+	}
+	case S_HEX: {
+		const char *prefix = "";
+
+		if (value[0] != '0' || (value[1] != 'x' && value[1] != 'X'))
+			prefix = "0x";
+		fprintf(fp, "#define %s%s %s%s\n",
+		    CONFIG_, sym->name, prefix, value);
+		break;
+	}
+	case S_STRING:
+	case S_INT:
+		fprintf(fp, "#define %s%s %s\n",
+		    CONFIG_, sym->name, value);
 		break;
 	default:
 		break;
 	}
 
-	fprintf(fp, "#define %s%s%s %s\n",
-	    CONFIG_, sym->name, suffix, value);
 }
 
 static void
-- 
1.7.3.4.574.g608b.dirty


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] kconfig: fix missing "0x" prefix from S_HEX symbol in autoconf.h
  2011-07-14 19:31 [PATCH] kconfig: fix missing "0x" prefix from S_HEX symbol in autoconf.h Arnaud Lacombe
@ 2011-07-14 23:20 ` Mauro Carvalho Chehab
  2011-07-15 15:43 ` Randy Dunlap
  2011-07-18 14:29 ` Michal Marek
  2 siblings, 0 replies; 5+ messages in thread
From: Mauro Carvalho Chehab @ 2011-07-14 23:20 UTC (permalink / raw)
  To: Arnaud Lacombe; +Cc: linux-kbuild, Michal Marek, Randy Dunlap

Em 14-07-2011 16:31, Arnaud Lacombe escreveu:
> The specialized printer for headers (espectially autoconf.h) is missing fixup
> code for S_HEX symbol's "0x" prefix. As long as kconfig does not warn for such
> missing prefix, this code is needed. Fix this.
> 
> In the same time, fix some nits in `header_print_symbol()'.
> 
> Cc: Randy Dunlap <rdunlap@xenotime.net>
> Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
> 
> Broken-by: Arnaud Lacombe <lacombar@gmail.com>
> (Somehow-)Reported-by: Randy Dunlap <rdunlap@xenotime.net>
> Reported-by: Mauro Carvalho Chehab <mchehab@infradead.org>
> Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>

Patch looks good for me.

Feel free to add my ack, if you want.

Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
> 
> ---
>  scripts/kconfig/confdata.c |   26 +++++++++++++++++++++-----
>  1 files changed, 21 insertions(+), 5 deletions(-)
> 
> diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
> index be6952c..df629ec 100644
> --- a/scripts/kconfig/confdata.c
> +++ b/scripts/kconfig/confdata.c
> @@ -487,27 +487,43 @@ static struct conf_printer kconfig_printer_cb =
>  static void
>  header_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg)
>  {
> -	const char *suffix = "";
>  
>  	switch (sym->type) {
>  	case S_BOOLEAN:
> -	case S_TRISTATE:
> +	case S_TRISTATE: {
> +		const char *suffix = "";
> +
>  		switch (*value) {
>  		case 'n':
>  			return;
>  		case 'm':
>  			suffix = "_MODULE";
> -			/* FALLTHROUGH */
> +			/* fall through */
>  		default:
>  			value = "1";
>  		}
> +		fprintf(fp, "#define %s%s%s %s\n",
> +		    CONFIG_, sym->name, suffix, value);
> +		break;
> +	}
> +	case S_HEX: {
> +		const char *prefix = "";
> +
> +		if (value[0] != '0' || (value[1] != 'x' && value[1] != 'X'))
> +			prefix = "0x";
> +		fprintf(fp, "#define %s%s %s%s\n",
> +		    CONFIG_, sym->name, prefix, value);
> +		break;
> +	}
> +	case S_STRING:
> +	case S_INT:
> +		fprintf(fp, "#define %s%s %s\n",
> +		    CONFIG_, sym->name, value);
>  		break;
>  	default:
>  		break;
>  	}
>  
> -	fprintf(fp, "#define %s%s%s %s\n",
> -	    CONFIG_, sym->name, suffix, value);
>  }
>  
>  static void


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] kconfig: fix missing "0x" prefix from S_HEX symbol in autoconf.h
  2011-07-14 19:31 [PATCH] kconfig: fix missing "0x" prefix from S_HEX symbol in autoconf.h Arnaud Lacombe
  2011-07-14 23:20 ` Mauro Carvalho Chehab
@ 2011-07-15 15:43 ` Randy Dunlap
  2011-07-18 14:29 ` Michal Marek
  2 siblings, 0 replies; 5+ messages in thread
From: Randy Dunlap @ 2011-07-15 15:43 UTC (permalink / raw)
  To: Arnaud Lacombe; +Cc: linux-kbuild, Michal Marek, Mauro Carvalho Chehab

On Thu, 14 Jul 2011 15:31:07 -0400 Arnaud Lacombe wrote:

> The specialized printer for headers (espectially autoconf.h) is missing fixup
> code for S_HEX symbol's "0x" prefix. As long as kconfig does not warn for such
> missing prefix, this code is needed. Fix this.
> 
> In the same time, fix some nits in `header_print_symbol()'.
> 
> Cc: Randy Dunlap <rdunlap@xenotime.net>
> Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
> 
> Broken-by: Arnaud Lacombe <lacombar@gmail.com>
> (Somehow-)Reported-by: Randy Dunlap <rdunlap@xenotime.net>

http://marc.info/?l=linux-next&m=130981163121463&w=2

Acked-by: Randy Dunlap <rdunlap@xenotime.net>

Thanks.

> Reported-by: Mauro Carvalho Chehab <mchehab@infradead.org>
> Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>
> 
> ---
>  scripts/kconfig/confdata.c |   26 +++++++++++++++++++++-----
>  1 files changed, 21 insertions(+), 5 deletions(-)
> 
> diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
> index be6952c..df629ec 100644
> --- a/scripts/kconfig/confdata.c
> +++ b/scripts/kconfig/confdata.c
> @@ -487,27 +487,43 @@ static struct conf_printer kconfig_printer_cb =
>  static void
>  header_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg)
>  {
> -	const char *suffix = "";
>  
>  	switch (sym->type) {
>  	case S_BOOLEAN:
> -	case S_TRISTATE:
> +	case S_TRISTATE: {
> +		const char *suffix = "";
> +
>  		switch (*value) {
>  		case 'n':
>  			return;
>  		case 'm':
>  			suffix = "_MODULE";
> -			/* FALLTHROUGH */
> +			/* fall through */
>  		default:
>  			value = "1";
>  		}
> +		fprintf(fp, "#define %s%s%s %s\n",
> +		    CONFIG_, sym->name, suffix, value);
> +		break;
> +	}
> +	case S_HEX: {
> +		const char *prefix = "";
> +
> +		if (value[0] != '0' || (value[1] != 'x' && value[1] != 'X'))
> +			prefix = "0x";
> +		fprintf(fp, "#define %s%s %s%s\n",
> +		    CONFIG_, sym->name, prefix, value);
> +		break;
> +	}
> +	case S_STRING:
> +	case S_INT:
> +		fprintf(fp, "#define %s%s %s\n",
> +		    CONFIG_, sym->name, value);
>  		break;
>  	default:
>  		break;
>  	}
>  
> -	fprintf(fp, "#define %s%s%s %s\n",
> -	    CONFIG_, sym->name, suffix, value);
>  }
>  
>  static void
> -- 
> 1.7.3.4.574.g608b.dirty
> 


---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] kconfig: fix missing "0x" prefix from S_HEX symbol in autoconf.h
  2011-07-14 19:31 [PATCH] kconfig: fix missing "0x" prefix from S_HEX symbol in autoconf.h Arnaud Lacombe
  2011-07-14 23:20 ` Mauro Carvalho Chehab
  2011-07-15 15:43 ` Randy Dunlap
@ 2011-07-18 14:29 ` Michal Marek
  2011-07-18 15:26   ` Arnaud Lacombe
  2 siblings, 1 reply; 5+ messages in thread
From: Michal Marek @ 2011-07-18 14:29 UTC (permalink / raw)
  To: Arnaud Lacombe; +Cc: linux-kbuild, Randy Dunlap, Mauro Carvalho Chehab

On Thu, Jul 14, 2011 at 03:31:07PM -0400, Arnaud Lacombe wrote:
> The specialized printer for headers (espectially autoconf.h) is missing fixup
> code for S_HEX symbol's "0x" prefix. As long as kconfig does not warn for such
> missing prefix, this code is needed. Fix this.
> 
> In the same time, fix some nits in `header_print_symbol()'.
> 
> Cc: Randy Dunlap <rdunlap@xenotime.net>
> Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
> 
> Broken-by: Arnaud Lacombe <lacombar@gmail.com>
> (Somehow-)Reported-by: Randy Dunlap <rdunlap@xenotime.net>
> Reported-by: Mauro Carvalho Chehab <mchehab@infradead.org>
> Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>

Thanks, applied kbuild-2.6.git#kconfig. It did actually compare the
kconfig generated files after your previous patch, but I only compared
defconfig and it didn't trigger this bug.

Michal

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] kconfig: fix missing "0x" prefix from S_HEX symbol in autoconf.h
  2011-07-18 14:29 ` Michal Marek
@ 2011-07-18 15:26   ` Arnaud Lacombe
  0 siblings, 0 replies; 5+ messages in thread
From: Arnaud Lacombe @ 2011-07-18 15:26 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kbuild, Randy Dunlap, Mauro Carvalho Chehab

Hi,

On Mon, Jul 18, 2011 at 10:29 AM, Michal Marek <mmarek@suse.cz> wrote:
> On Thu, Jul 14, 2011 at 03:31:07PM -0400, Arnaud Lacombe wrote:
>> The specialized printer for headers (espectially autoconf.h) is missing fixup
>> code for S_HEX symbol's "0x" prefix. As long as kconfig does not warn for such
>> missing prefix, this code is needed. Fix this.
>>
>> In the same time, fix some nits in `header_print_symbol()'.
>>
>> Cc: Randy Dunlap <rdunlap@xenotime.net>
>> Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
>>
>> Broken-by: Arnaud Lacombe <lacombar@gmail.com>
>> (Somehow-)Reported-by: Randy Dunlap <rdunlap@xenotime.net>
>> Reported-by: Mauro Carvalho Chehab <mchehab@infradead.org>
>> Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>
>
> Thanks, applied kbuild-2.6.git#kconfig. It did actually compare the
> kconfig generated files after your previous patch, but I only compared
> defconfig and it didn't trigger this bug.
>
this is why kconfig _needs_ a regression testsuite, not to rely on any
existing configuration or syntax which may only be used in the corners
of dark architecture.  :-)

I'm more or less working on that.

 - Arnaud

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-07-18 15:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-14 19:31 [PATCH] kconfig: fix missing "0x" prefix from S_HEX symbol in autoconf.h Arnaud Lacombe
2011-07-14 23:20 ` Mauro Carvalho Chehab
2011-07-15 15:43 ` Randy Dunlap
2011-07-18 14:29 ` Michal Marek
2011-07-18 15:26   ` Arnaud Lacombe

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.