mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: kstrto*: converting strings to integers done (hopefully) right
       [not found] <201103230200.p2N20nBv011302@hera.kernel.org>
@ 2011-03-23 20:31 ` Geert Uytterhoeven
  2011-03-24 18:51   ` [PATCH] kstrtox: fix compile warnings in test Alexey Dobriyan
  0 siblings, 1 reply; 3+ messages in thread
From: Geert Uytterhoeven @ 2011-03-23 20:31 UTC (permalink / raw)
  To: Alexey Dobriyan; +Cc: Linux Kernel Mailing List

On Wed, Mar 23, 2011 at 03:00, Linux Kernel Mailing List
<linux-kernel@vger.kernel.org> wrote:
> --- /dev/null
> +++ b/lib/test-kstrtox.c

On 32-bit m68k:

lib/test-kstrtox.c: In function ‘test_kstrtou64_ok’:
lib/test-kstrtox.c:318: warning: this decimal constant is unsigned
only in ISO C90
lib/test-kstrtox.c:319: warning: this decimal constant is unsigned
only in ISO C90
lib/test-kstrtox.c:320: warning: this decimal constant is unsigned
only in ISO C90
lib/test-kstrtox.c:321: warning: this decimal constant is unsigned
only in ISO C90
lib/test-kstrtox.c:322: warning: integer constant is too large for ‘long’ type
lib/test-kstrtox.c:323: warning: integer constant is too large for ‘long’ type
lib/test-kstrtox.c: In function ‘test_kstrtos64_ok’:
lib/test-kstrtox.c:372: warning: this decimal constant is unsigned
only in ISO C90
lib/test-kstrtox.c:373: warning: this decimal constant is unsigned
only in ISO C90
lib/test-kstrtox.c:374: warning: this decimal constant is unsigned
only in ISO C90
lib/test-kstrtox.c:375: warning: this decimal constant is unsigned
only in ISO C90
lib/test-kstrtox.c:376: warning: integer constant is too large for ‘long’ type
lib/test-kstrtox.c:377: warning: integer constant is too large for ‘long’ type
lib/test-kstrtox.c: In function ‘test_kstrtou32_ok’:
lib/test-kstrtox.c:421: warning: this decimal constant is unsigned
only in ISO C90
lib/test-kstrtox.c:422: warning: this decimal constant is unsigned
only in ISO C90
lib/test-kstrtox.c:423: warning: this decimal constant is unsigned
only in ISO C90
lib/test-kstrtox.c:424: warning: this decimal constant is unsigned
only in ISO C90

Probably you need a few more U/ULL suffixes.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* [PATCH] kstrtox: fix compile warnings in test
  2011-03-23 20:31 ` kstrto*: converting strings to integers done (hopefully) right Geert Uytterhoeven
@ 2011-03-24 18:51   ` Alexey Dobriyan
  2011-03-26 17:25     ` Geert Uytterhoeven
  0 siblings, 1 reply; 3+ messages in thread
From: Alexey Dobriyan @ 2011-03-24 18:51 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, geert

Fix the following warnings:

  CC [M]  lib/test-kstrtox.o
lib/test-kstrtox.c: In function 'test_kstrtou64_ok':
lib/test-kstrtox.c:318: warning: this decimal constant is unsigned only in ISO C90
	...

Noticed by Geert Uytterhoeven <geert@linux-m68k.org>

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 lib/test-kstrtox.c |   32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

--- a/lib/test-kstrtox.c
+++ b/lib/test-kstrtox.c
@@ -315,12 +315,12 @@ static void __init test_kstrtou64_ok(void)
 		{"65537",	10,	65537},
 		{"2147483646",	10,	2147483646},
 		{"2147483647",	10,	2147483647},
-		{"2147483648",	10,	2147483648},
-		{"2147483649",	10,	2147483649},
-		{"4294967294",	10,	4294967294},
-		{"4294967295",	10,	4294967295},
-		{"4294967296",	10,	4294967296},
-		{"4294967297",	10,	4294967297},
+		{"2147483648",	10,	2147483648ULL},
+		{"2147483649",	10,	2147483649ULL},
+		{"4294967294",	10,	4294967294ULL},
+		{"4294967295",	10,	4294967295ULL},
+		{"4294967296",	10,	4294967296ULL},
+		{"4294967297",	10,	4294967297ULL},
 		{"9223372036854775806",	10,	9223372036854775806ULL},
 		{"9223372036854775807",	10,	9223372036854775807ULL},
 		{"9223372036854775808",	10,	9223372036854775808ULL},
@@ -369,12 +369,12 @@ static void __init test_kstrtos64_ok(void)
 		{"65537",	10,	65537},
 		{"2147483646",	10,	2147483646},
 		{"2147483647",	10,	2147483647},
-		{"2147483648",	10,	2147483648},
-		{"2147483649",	10,	2147483649},
-		{"4294967294",	10,	4294967294},
-		{"4294967295",	10,	4294967295},
-		{"4294967296",	10,	4294967296},
-		{"4294967297",	10,	4294967297},
+		{"2147483648",	10,	2147483648LL},
+		{"2147483649",	10,	2147483649LL},
+		{"4294967294",	10,	4294967294LL},
+		{"4294967295",	10,	4294967295LL},
+		{"4294967296",	10,	4294967296LL},
+		{"4294967297",	10,	4294967297LL},
 		{"9223372036854775806",	10,	9223372036854775806LL},
 		{"9223372036854775807",	10,	9223372036854775807LL},
 	};
@@ -418,10 +418,10 @@ static void __init test_kstrtou32_ok(void)
 		{"65537",	10,	65537},
 		{"2147483646",	10,	2147483646},
 		{"2147483647",	10,	2147483647},
-		{"2147483648",	10,	2147483648},
-		{"2147483649",	10,	2147483649},
-		{"4294967294",	10,	4294967294},
-		{"4294967295",	10,	4294967295},
+		{"2147483648",	10,	2147483648U},
+		{"2147483649",	10,	2147483649U},
+		{"4294967294",	10,	4294967294U},
+		{"4294967295",	10,	4294967295U},
 	};
 	TEST_OK(kstrtou32, u32, "%u", test_u32_ok);
 }

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

* Re: [PATCH] kstrtox: fix compile warnings in test
  2011-03-24 18:51   ` [PATCH] kstrtox: fix compile warnings in test Alexey Dobriyan
@ 2011-03-26 17:25     ` Geert Uytterhoeven
  0 siblings, 0 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2011-03-26 17:25 UTC (permalink / raw)
  To: Alexey Dobriyan; +Cc: akpm, linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=UTF-8, Size: 4583 bytes --]

On Thu, Mar 24, 2011 at 19:51, Alexey Dobriyan <adobriyan@gmail.com> wrote:
> Fix the following warnings:
>
>  CC [M]  lib/test-kstrtox.o
> lib/test-kstrtox.c: In function 'test_kstrtou64_ok':
> lib/test-kstrtox.c:318: warning: this decimal constant is unsigned only in ISO C90
>        ...
>
> Noticed by Geert Uytterhoeven <geert@linux-m68k.org>
>
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>

Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>

> ---
>
>  lib/test-kstrtox.c |   32 ++++++++++++++++----------------
>  1 file changed, 16 insertions(+), 16 deletions(-)
>
> --- a/lib/test-kstrtox.c
> +++ b/lib/test-kstrtox.c
> @@ -315,12 +315,12 @@ static void __init test_kstrtou64_ok(void)
>                {"65537",       10,     65537},
>                {"2147483646",  10,     2147483646},
>                {"2147483647",  10,     2147483647},
> -               {"2147483648",  10,     2147483648},
> -               {"2147483649",  10,     2147483649},
> -               {"4294967294",  10,     4294967294},
> -               {"4294967295",  10,     4294967295},
> -               {"4294967296",  10,     4294967296},
> -               {"4294967297",  10,     4294967297},
> +               {"2147483648",  10,     2147483648ULL},
> +               {"2147483649",  10,     2147483649ULL},
> +               {"4294967294",  10,     4294967294ULL},
> +               {"4294967295",  10,     4294967295ULL},
> +               {"4294967296",  10,     4294967296ULL},
> +               {"4294967297",  10,     4294967297ULL},
>                {"9223372036854775806", 10,     9223372036854775806ULL},
>                {"9223372036854775807", 10,     9223372036854775807ULL},
>                {"9223372036854775808", 10,     9223372036854775808ULL},
> @@ -369,12 +369,12 @@ static void __init test_kstrtos64_ok(void)
>                {"65537",       10,     65537},
>                {"2147483646",  10,     2147483646},
>                {"2147483647",  10,     2147483647},
> -               {"2147483648",  10,     2147483648},
> -               {"2147483649",  10,     2147483649},
> -               {"4294967294",  10,     4294967294},
> -               {"4294967295",  10,     4294967295},
> -               {"4294967296",  10,     4294967296},
> -               {"4294967297",  10,     4294967297},
> +               {"2147483648",  10,     2147483648LL},
> +               {"2147483649",  10,     2147483649LL},
> +               {"4294967294",  10,     4294967294LL},
> +               {"4294967295",  10,     4294967295LL},
> +               {"4294967296",  10,     4294967296LL},
> +               {"4294967297",  10,     4294967297LL},
>                {"9223372036854775806", 10,     9223372036854775806LL},
>                {"9223372036854775807", 10,     9223372036854775807LL},
>        };
> @@ -418,10 +418,10 @@ static void __init test_kstrtou32_ok(void)
>                {"65537",       10,     65537},
>                {"2147483646",  10,     2147483646},
>                {"2147483647",  10,     2147483647},
> -               {"2147483648",  10,     2147483648},
> -               {"2147483649",  10,     2147483649},
> -               {"4294967294",  10,     4294967294},
> -               {"4294967295",  10,     4294967295},
> +               {"2147483648",  10,     2147483648U},
> +               {"2147483649",  10,     2147483649U},
> +               {"4294967294",  10,     4294967294U},
> +               {"4294967295",  10,     4294967295U},
>        };
>        TEST_OK(kstrtou32, u32, "%u", test_u32_ok);
>  }

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

end of thread, other threads:[~2011-03-26 17:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <201103230200.p2N20nBv011302@hera.kernel.org>
2011-03-23 20:31 ` kstrto*: converting strings to integers done (hopefully) right Geert Uytterhoeven
2011-03-24 18:51   ` [PATCH] kstrtox: fix compile warnings in test Alexey Dobriyan
2011-03-26 17:25     ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®