Skip to contentSkip to conversation

GCC47: Fix warning in cmd_nand.c

PATCH New Marek Vasut 3 participants 7 messages Apr 28, 2012 – Apr 29, 2012 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 GCC47: Fix warning in cmd_nand.c

cmd_nand.c: In function ?arg_off_size?:
cmd_nand.c:216:5: warning: ?maxsize? may be used uninitialized in this function [-Wmaybe-uninitialized]

Cc Scott Wood <[email protected]>
Cc Wolfgang Denk <[email protected]>
---
 common/cmd_nand.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

NOTE: Why does this emit these blahs about UTF8? I just noticed git started behaving weird on me, anyone can give me a hint how to disable these?

common/cmd_nand.c +1 -1
index bae630d..0fd3a6c 100644
@@ -191,7 +191,7 @@ static int arg_off_size(int argc, char *const argv[], int *idx,
 			loff_t *off, loff_t *size)
 {
 	int ret;
-	loff_t maxsize;
+	loff_t maxsize = 0;
 
 	if (argc == 0) {
 		*off = 0;
Signature · 1 line
1.7.10
#1 lore raw

PATCH 2/2 GCC47: Fix warning in md5.c

md5.c: In function ?MD5Final?:
md5.c:156:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] md5.c:157:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

---
 include/u-boot/md5.h |    5 ++++-
 lib/md5.c            |    4 ++--
 2 files changed, 6 insertions(+), 3 deletions(-)
include/u-boot/md5.h +4 -1
index 08924cc..e09c16a 100644
@@ -11,7 +11,10 @@
 struct MD5Context {
 	__u32 buf[4];
 	__u32 bits[2];
-	unsigned char in[64];
+	union {
+		unsigned char in[64];
+		__u32 in32[16];
+	};
 };
 
 /*
lib/md5.c +2 -2
index 81a09e3..2ae4a06 100644
@@ -153,8 +153,8 @@ MD5Final(unsigned char digest[16], struct MD5Context *ctx)
 	byteReverse(ctx->in, 14);
 
 	/* Append length in bits and transform */
-	((__u32 *) ctx->in)[14] = ctx->bits[0];
-	((__u32 *) ctx->in)[15] = ctx->bits[1];
+	ctx->in32[14] = ctx->bits[0];
+	ctx->in32[15] = ctx->bits[1];
 
 	MD5Transform(ctx->buf, (__u32 *) ctx->in);
 	byteReverse((unsigned char *) ctx->buf, 4);
Signature · 1 line
1.7.10
#2 lore raw

PATCH 2/2 GCC47: Fix warning in md5.c

Quoted 15 lines · On Saturday 28 April 2012 18:28:40 Marek Vasut wrote:
include/u-boot/md5.h +4 -1
@@ -11,7 +11,10 @@
 struct MD5Context {
 	__u32 buf[4];
 	__u32 bits[2];
-	unsigned char in[64];
+	union {
+		unsigned char in[64];
+		__u32 in32[16];
+	};
 };
 

lib/md5.c MD5Final(unsigned char digest[16], struct MD5Context *ctx) · line 157

Quoted 6 lines
lib/md5.c +2 -2
 
 	/* Append length in bits and transform */
-	((__u32 *) ctx->in)[14] = ctx->bits[0];
-	((__u32 *) ctx->in)[15] = ctx->bits[1];
+	ctx->in32[14] = ctx->bits[0];
+	ctx->in32[15] = ctx->bits[1];

nice

-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120428/9fbfbce6/attachment.pgp>

#3 lore raw

PATCH 1/2 GCC47: Fix warning in cmd_nand.c

In reply to Marek Vasut

Dear Marek Vasut,

Quoted 9 lines · In message <[email protected]> you wrote:

cmd_nand.c: In function ?arg_off_size?:
cmd_nand.c:216:5: warning: ?maxsize? may be used uninitialized in this function [-Wmaybe-uninitialized]

Cc Scott Wood <[email protected]>
Cc Wolfgang Denk <[email protected]>
---
 common/cmd_nand.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

Quoted 2 lines

NOTE: Why does this emit these blahs about UTF8? I just noticed git started behaving weird on me, anyone can give me a hint how to disable these?

Yes, I think I can: don't use funny characters like these quotes around "arg_off_size" and "maxsize" in the commit messages. You will also notice that patchwork has problems with these, like here:

Traceback (most recent call last):
File "/home/wd/bin/pwclient", line 466, in <module>

    main()

File "/home/wd/bin/pwclient", line 449, in main
action_apply(rpc, patch_id)
File "/home/wd/bin/pwclient", line 264, in action_apply
proc.communicate(s)
File "/usr/lib64/python2.7/subprocess.py", line 737, in communicate
self.stdin.write(input)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2018' in position 450: ordinal not in range(128)

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Anarchy may not be the best form of government, but it's better  than
no government at all.
#4 lore raw

PATCH 1/2 GCC47: Fix warning in cmd_nand.c

Dear Wolfgang Denk,

Quoted 15 lines

Dear Marek Vasut,

Quoted 11 lines · In message <[email protected]> you wrote:

cmd_nand.c: In function ?arg_off_size?:
cmd_nand.c:216:5: warning: ?maxsize? may be used uninitialized in this function [-Wmaybe-uninitialized]

Cc Scott Wood <[email protected]>
Cc Wolfgang Denk <[email protected]>

---

 common/cmd_nand.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 8 lines

Applied, thanks.

Quoted 3 lines

NOTE: Why does this emit these blahs about UTF8? I just noticed git started behaving weird on me, anyone can give me a hint how to disable these?

Yes, I think I can: don't use funny characters like these quotes around "arg_off_size" and "maxsize" in the commit messages.

Looking closer at it, it's not standard "'" quote character, what the heck. But $LANG (and $LANGUAGE) is set to en_US.UTF8 . Damned, I'll try to find the root cause, but I feel like overcomplicated KDE4 combined with who-knows-what will win this battle :-/

Quoted 17 lines

You will
also notice that patchwork has problems with these, like here:

Traceback (most recent call last):
File "/home/wd/bin/pwclient", line 466, in <module>

    main()

File "/home/wd/bin/pwclient", line 449, in main
action_apply(rpc, patch_id)
File "/home/wd/bin/pwclient", line 264, in action_apply
proc.communicate(s)
File "/usr/lib64/python2.7/subprocess.py", line 737, in communicate
self.stdin.write(input)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2018' in position 450: ordinal not in range(128)

Quoted 3 lines

Best regards,

Wolfgang Denk

Best regards,
Marek Vasut

#5 lore raw

PATCH 1/2 GCC47: Fix warning in cmd_nand.c

Dear Marek Vasut,

Quoted 8 lines · In message <[email protected]> you wrote:
Quoted 3 lines

Yes, I think I can: don't use funny characters like these quotes around "arg_off_size" and "maxsize" in the commit messages.

Looking closer at it, it's not standard "'" quote character, what the heck. But $LANG (and $LANGUAGE) is set to en_US.UTF8 . Damned, I'll try to find the root cause, but I feel like overcomplicated KDE4 combined with who-knows-what will win this battle :-/

I don't know either how to set LC_MESSAGES or even LC_ALL or anything else to prevent gcc from issuing such characters; so I guess we have to maually filter/convert any such messages instead of just copy & paste error messages ...

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
All I ask is a chance to prove that money can't make me happy.
#6 lore raw

PATCH 1/2 GCC47: Fix warning in cmd_nand.c

Dear Wolfgang Denk,

Quoted 11 lines

Dear Marek Vasut,

Quoted 7 lines · In message <[email protected]> you wrote:
Quoted 2 lines

Yes, I think I can: don't use funny characters like these quotes around "arg_off_size" and "maxsize" in the commit messages.

Looking closer at it, it's not standard "'" quote character, what the heck. But $LANG (and $LANGUAGE) is set to en_US.UTF8 . Damned, I'll try to find the root cause, but I feel like overcomplicated KDE4 combined with who-knows-what will win this battle :-/

Quoted 4 lines

I don't know either how to set LC_MESSAGES or even LC_ALL or anything else to prevent gcc from issuing such characters; so I guess we have to maually filter/convert any such messages instead of just copy & paste error messages ...

Yes, I agree ... I'll keep my eyes peeled.

Quoted 3 lines

Best regards,

Wolfgang Denk

Best regards,
Marek Vasut