Re: [U-Boot] [PATCH 3/5] tools: fix define2mk.sed to not add quotes around negative integers

2016-06-12 Thread Heiko Schocher

Hello Masahiro,

Am 10.06.2016 um 17:20 schrieb Masahiro Yamada:

The sed script, tools/scripts/define2mk.sed, converts config defines
from C headers into include/autoconf.mk for the use in Makefiles.

I found the tool adds quotes around negative integer values.

For example, at the point of the v2016.07-rc1 tag,
include/configs/microblaze-generic.h defines
   #define CONFIG_BOOTDELAY -1 /* -1 disables auto-boot */

Because it is an integer option, it should be converted to:
   CONFIG_BOOTDELAY=-1

But, the script actually converts it to:
   CONFIG_BOOTDELAY="-1"

This is a fatal problem for the tools/moveconfig.py because it parses
include/autoconf.mk for the config defines from the board headers.
CONFIG_BOOTDELAY="-1" is considered as a string type option and it
is dropped due to the type mismatch from the entry in Kconfig.

Before commit bb597c0eeb7e ("common: bootdelay: move CONFIG_BOOTDELAY
into a Kconfig option"), several boards defined CONFIG_BOOTDELAY as -1
but they are all gone now.

I will fix the mis-converted options right away, but first I need to
fix the script so that tools/moveconfig.py can convert integer config
options with a negative value correctly.

Signed-off-by: Masahiro Yamada 
---

  tools/scripts/define2mk.sed | 2 ++
  1 file changed, 2 insertions(+)


Uff.. many thanks for the fix!

Reviewed-by: Heiko Schocher 

bye,
Heiko


diff --git a/tools/scripts/define2mk.sed b/tools/scripts/define2mk.sed
index c641edf..0f00285 100644
--- a/tools/scripts/define2mk.sed
+++ b/tools/scripts/define2mk.sed
@@ -22,6 +22,8 @@
s/=\(..*\)/="\1"/;
# but remove again from decimal numbers
s/="\([0-9][0-9]*\)"/=\1/;
+   # ... and from negative decimal numbers
+   s/="\(-[1-9][0-9]*\)"/=\1/;
# ... and from hex numbers
s/="\(0[Xx][0-9a-fA-F][0-9a-fA-F]*\)"/=\1/;
# ... and from configs defined from other configs



--
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 3/5] tools: fix define2mk.sed to not add quotes around negative integers

2016-06-10 Thread Masahiro Yamada
The sed script, tools/scripts/define2mk.sed, converts config defines
from C headers into include/autoconf.mk for the use in Makefiles.

I found the tool adds quotes around negative integer values.

For example, at the point of the v2016.07-rc1 tag,
include/configs/microblaze-generic.h defines
  #define CONFIG_BOOTDELAY -1 /* -1 disables auto-boot */

Because it is an integer option, it should be converted to:
  CONFIG_BOOTDELAY=-1

But, the script actually converts it to:
  CONFIG_BOOTDELAY="-1"

This is a fatal problem for the tools/moveconfig.py because it parses
include/autoconf.mk for the config defines from the board headers.
CONFIG_BOOTDELAY="-1" is considered as a string type option and it
is dropped due to the type mismatch from the entry in Kconfig.

Before commit bb597c0eeb7e ("common: bootdelay: move CONFIG_BOOTDELAY
into a Kconfig option"), several boards defined CONFIG_BOOTDELAY as -1
but they are all gone now.

I will fix the mis-converted options right away, but first I need to
fix the script so that tools/moveconfig.py can convert integer config
options with a negative value correctly.

Signed-off-by: Masahiro Yamada 
---

 tools/scripts/define2mk.sed | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/scripts/define2mk.sed b/tools/scripts/define2mk.sed
index c641edf..0f00285 100644
--- a/tools/scripts/define2mk.sed
+++ b/tools/scripts/define2mk.sed
@@ -22,6 +22,8 @@
s/=\(..*\)/="\1"/;
# but remove again from decimal numbers
s/="\([0-9][0-9]*\)"/=\1/;
+   # ... and from negative decimal numbers
+   s/="\(-[1-9][0-9]*\)"/=\1/;
# ... and from hex numbers
s/="\(0[Xx][0-9a-fA-F][0-9a-fA-F]*\)"/=\1/;
# ... and from configs defined from other configs
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot