public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* Patches for various warnings in string/...
@ 2014-09-15 17:37 Freddie Chopin
  2014-10-09 12:15 ` Corinna Vinschen
  0 siblings, 1 reply; 2+ messages in thread
From: Freddie Chopin @ 2014-09-15 17:37 UTC (permalink / raw)
  To: newlib

[-- Attachment #1: Type: text/plain, Size: 205 bytes --]

Hello!

I attach 4 patches with a single ChangeLog entry for various warnings 
detected in string/ subfolder of newlib's libc. The changes are pretty 
trivial and self-explaining - I hope (;

Regards,
FCh

[-- Attachment #2: ChangeLog.txt --]
[-- Type: text/plain, Size: 631 bytes --]

2014-09-15  Freddie Chopin  <freddie_chopin@op.pl>

	* libc/string/memccpy.c (memccpy): Fix warning about signed-unsigned
	comparison
	* libc/string/memchr.c (memchr): Ditto.
	* libc/string/memrchr.c (memrchr): Ditto.
	* libc/string/memset.c: (memset): Ditto.
	* libc/string/rawmemchr.c (rawmemchr): Ditto.
	* libc/string/local.h (__locale_cjk_lang): Fix "function declaration
	isn't a prototype" warning.
	* libc/string/strcasestr.c (strcasestr): Ditto.
	* libc/string/u_strerr.c (_user_strerror): Fix "unused parameter"
	warnings.
	* libc/string/rawmemchr.c (rawmemchr): Fix comment type
	"// ..." -> "/* ... */".

[-- Attachment #3: 0001-libc-string-memccpy.c-memccpy-Fix-warning-about-sign.patch --]
[-- Type: text/plain, Size: 2857 bytes --]

From f1eed1d6e0bca402567b0bbcec648221c2da0ce4 Mon Sep 17 00:00:00 2001
From: Freddie Chopin <freddie.chopin@gmail.com>
Date: Sat, 13 Sep 2014 10:15:50 +0200
Subject: [PATCH 1/4] libc/string/memccpy.c (memccpy): Fix warning about
 signed-unsigned comparison

libc/string/memchr.c (memchr): Ditto.
libc/string/memrchr.c (memrchr): Ditto.
libc/string/memset.c: (memset): Ditto.
libc/string/rawmemchr.c (rawmemchr): Ditto.
---
 newlib/libc/string/memccpy.c   | 2 +-
 newlib/libc/string/memchr.c    | 2 +-
 newlib/libc/string/memrchr.c   | 2 +-
 newlib/libc/string/memset.c    | 2 +-
 newlib/libc/string/rawmemchr.c | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/newlib/libc/string/memccpy.c b/newlib/libc/string/memccpy.c
index dded857..332ed46 100644
--- a/newlib/libc/string/memccpy.c
+++ b/newlib/libc/string/memccpy.c
@@ -98,7 +98,7 @@ _DEFUN (memccpy, (dst0, src0, endchar, len0),
      then punt into the byte copy loop.  This should be rare.  */
   if (!TOO_SMALL(len0) && !UNALIGNED (src, dst))
     {
-      int i;
+      unsigned int i;
       unsigned long mask = 0;
 
       aligned_dst = (long*)dst;
diff --git a/newlib/libc/string/memchr.c b/newlib/libc/string/memchr.c
index 13ed881..db0af7c 100644
--- a/newlib/libc/string/memchr.c
+++ b/newlib/libc/string/memchr.c
@@ -80,7 +80,7 @@ _DEFUN (memchr, (src_void, c, length),
 #if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__)
   unsigned long *asrc;
   unsigned long  mask;
-  int i;
+  unsigned int i;
 
   while (UNALIGNED (src))
     {
diff --git a/newlib/libc/string/memrchr.c b/newlib/libc/string/memrchr.c
index 42d9d14..60dee42 100644
--- a/newlib/libc/string/memrchr.c
+++ b/newlib/libc/string/memrchr.c
@@ -80,7 +80,7 @@ _DEFUN (memrchr, (src_void, c, length),
 #if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__)
   unsigned long *asrc;
   unsigned long  mask;
-  int i;
+  unsigned int i;
 
   while (UNALIGNED (src))
     {
diff --git a/newlib/libc/string/memset.c b/newlib/libc/string/memset.c
index ee91b05..b84e155 100644
--- a/newlib/libc/string/memset.c
+++ b/newlib/libc/string/memset.c
@@ -50,7 +50,7 @@ _DEFUN (memset, (m, c, n),
   char *s = (char *) m;
 
 #if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__)
-  int i;
+  unsigned int i;
   unsigned long buffer;
   unsigned long *aligned_addr;
   unsigned int d = c & 0xff;	/* To avoid sign extension, copy C to an
diff --git a/newlib/libc/string/rawmemchr.c b/newlib/libc/string/rawmemchr.c
index a9e2acd..9b711c4 100644
--- a/newlib/libc/string/rawmemchr.c
+++ b/newlib/libc/string/rawmemchr.c
@@ -77,7 +77,7 @@ _DEFUN (rawmemchr, (src_void, c),
 #if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__)
   unsigned long *asrc;
   unsigned long  mask;
-  int i;
+  unsigned int i;
 
   while (UNALIGNED (src))
     {
-- 
1.8.1.msysgit.1


[-- Attachment #4: 0002-libc-string-local.h-__locale_cjk_lang-Fix-function-d.patch --]
[-- Type: text/plain, Size: 1382 bytes --]

From d0b41b24b965838e9d571369d7e770d4e184b9d5 Mon Sep 17 00:00:00 2001
From: Freddie Chopin <freddie.chopin@gmail.com>
Date: Sat, 13 Sep 2014 10:17:28 +0200
Subject: [PATCH 2/4] libc/string/local.h (__locale_cjk_lang): Fix "function
 declaration isn't a prototype" warning. libc/string/strcasestr.c
 (strcasestr): Ditto.

---
 newlib/libc/string/local.h      | 2 +-
 newlib/libc/string/strcasestr.c | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/newlib/libc/string/local.h b/newlib/libc/string/local.h
index dfe01d7..babaad0 100644
--- a/newlib/libc/string/local.h
+++ b/newlib/libc/string/local.h
@@ -6,7 +6,7 @@ int _EXFUN (__wcwidth, (wint_t));
 
 /* Defined in locale/locale.c.  Returns a value != 0 if the current
    language is assumed to use CJK fonts. */
-int __locale_cjk_lang ();
+int _EXFUN (__locale_cjk_lang, (void));
 
 /*
    Taken from glibc:
diff --git a/newlib/libc/string/strcasestr.c b/newlib/libc/string/strcasestr.c
index 1bde1cd..8fff00b 100644
--- a/newlib/libc/string/strcasestr.c
+++ b/newlib/libc/string/strcasestr.c
@@ -96,8 +96,9 @@ QUICKREF
  * Find the first occurrence of find in s, ignore case.
  */
 char *
-strcasestr(s, find)
-	const char *s, *find;
+_DEFUN (strcasestr, (s, find),
+	_CONST char *s _AND
+	_CONST char *find)
 {
 #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)
 
-- 
1.8.1.msysgit.1


[-- Attachment #5: 0003-libc-string-u_strerr.c-_user_strerror-Fix-unused-par.patch --]
[-- Type: text/plain, Size: 784 bytes --]

From 6bc841fa5c6e7358c7818366d65582b90dd2ce3f Mon Sep 17 00:00:00 2001
From: Freddie Chopin <freddie.chopin@gmail.com>
Date: Sat, 13 Sep 2014 10:18:12 +0200
Subject: [PATCH 3/4] libc/string/u_strerr.c (_user_strerror): Fix "unused
 parameter" warnings.

---
 newlib/libc/string/u_strerr.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/newlib/libc/string/u_strerr.c b/newlib/libc/string/u_strerr.c
index 7d902fe..2978df0 100644
--- a/newlib/libc/string/u_strerr.c
+++ b/newlib/libc/string/u_strerr.c
@@ -6,5 +6,10 @@ _DEFUN(_user_strerror, (errnum, internal, errptr),
        int internal _AND
        int *errptr)
 {
+  /* prevent warning about unused parameters */
+  _CAST_VOID errnum;
+  _CAST_VOID internal;
+  _CAST_VOID errptr;
+
   return 0;
 }
-- 
1.8.1.msysgit.1


[-- Attachment #6: 0004-libc-string-rawmemchr.c-rawmemchr-Fix-comment-type.patch --]
[-- Type: text/plain, Size: 782 bytes --]

From ccb79eeba1244aa4d44082adaed2dc075d6af4a6 Mon Sep 17 00:00:00 2001
From: Freddie Chopin <freddie.chopin@gmail.com>
Date: Sat, 13 Sep 2014 10:27:13 +0200
Subject: [PATCH 4/4] libc/string/rawmemchr.c (rawmemchr): Fix comment type "//
 ..." -> "/* ... */".

---
 newlib/libc/string/rawmemchr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/newlib/libc/string/rawmemchr.c b/newlib/libc/string/rawmemchr.c
index 9b711c4..4b5a4cd 100644
--- a/newlib/libc/string/rawmemchr.c
+++ b/newlib/libc/string/rawmemchr.c
@@ -110,7 +110,7 @@ _DEFUN (rawmemchr, (src_void, c),
 
   src = (unsigned char *) asrc;
 
-#endif // !PREFER_SIZE_OVER_SPEED && !__OPTIMIZE_SIZE__
+#endif /* !PREFER_SIZE_OVER_SPEED && !__OPTIMIZE_SIZE__ */
 
   while (1)
     {
-- 
1.8.1.msysgit.1


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

* Re: Patches for various warnings in string/...
  2014-09-15 17:37 Patches for various warnings in string/ Freddie Chopin
@ 2014-10-09 12:15 ` Corinna Vinschen
  0 siblings, 0 replies; 2+ messages in thread
From: Corinna Vinschen @ 2014-10-09 12:15 UTC (permalink / raw)
  To: newlib

[-- Attachment #1: Type: text/plain, Size: 1008 bytes --]

On Sep 15 19:37, Freddie Chopin wrote:
> Hello!
> 
> I attach 4 patches with a single ChangeLog entry for various warnings
> detected in string/ subfolder of newlib's libc. The changes are pretty
> trivial and self-explaining - I hope (;
> 
> Regards,
> FCh

> 2014-09-15  Freddie Chopin  <...>
> 
> 	* libc/string/memccpy.c (memccpy): Fix warning about signed-unsigned
> 	comparison
> 	* libc/string/memchr.c (memchr): Ditto.
> 	* libc/string/memrchr.c (memrchr): Ditto.
> 	* libc/string/memset.c: (memset): Ditto.
> 	* libc/string/rawmemchr.c (rawmemchr): Ditto.
> 	* libc/string/local.h (__locale_cjk_lang): Fix "function declaration
> 	isn't a prototype" warning.
> 	* libc/string/strcasestr.c (strcasestr): Ditto.
> 	* libc/string/u_strerr.c (_user_strerror): Fix "unused parameter"
> 	warnings.
> 	* libc/string/rawmemchr.c (rawmemchr): Fix comment type
> 	"// ..." -> "/* ... */".

Patches applied.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2014-10-09 12:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-15 17:37 Patches for various warnings in string/ Freddie Chopin
2014-10-09 12:15 ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).