This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
[patch] misc. warning fixes
- From: Ralf Corsepius <ralf dot corsepius at rtems dot org>
- To: "newlib at sourceware dot org" <newlib at sourceware dot org>
- Date: Sat, 20 Aug 2011 06:38:24 +0200
- Subject: [patch] misc. warning fixes
Hi,
I'd like to apply the patch below.
It addresses misc. warnings gcc issues when building newlib.
Ralf
2011-08-20 Ralf Corsépius <ralf.corsepius@rtems.org>
* libc/posix/regexec.c: Define "nope" only #ifndef NDEBUG.
* libc/stdio/vfscanf.c: Define "state" only #ifdef _MB_CAPABLE.
* libc/string/wcwidth.c: Include <wctypes.h> for "iswprint" and
"iswcntrl".
Index: libc/posix/regexec.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/posix/regexec.c,v
retrieving revision 1.1
diff -u -r1.1 regexec.c
--- libc/posix/regexec.c 31 Oct 2008 21:03:41 -0000 1.1
+++ libc/posix/regexec.c 20 Aug 2011 04:34:55 -0000
@@ -58,7 +58,9 @@
#include "utils.h"
#include "regex2.h"
+#ifndef NDEBUG
static int nope = 0; /* for use in asserts; shuts lint up */
+#endif
/* macros for manipulating states, small version */
#define states long
Index: libc/stdio/vfscanf.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/vfscanf.c,v
retrieving revision 1.50
diff -u -r1.50 vfscanf.c
--- libc/stdio/vfscanf.c 28 Jan 2011 10:49:11 -0000 1.50
+++ libc/stdio/vfscanf.c 20 Aug 2011 04:34:56 -0000
@@ -453,7 +453,9 @@
wchar_t wc; /* wchar to use to read format string */
wchar_t *wcp; /* handy wide character pointer */
size_t mbslen; /* length of converted multibyte sequence */
+#ifdef _MB_CAPABLE
mbstate_t state; /* value to keep track of multibyte state */
+#endif
#define CCFN_PARAMS _PARAMS((struct _reent *, const char *, char **, int))
u_long (*ccfn)CCFN_PARAMS=0; /* conversion function (strtol/strtoul) */
Index: libc/string/wcwidth.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/string/wcwidth.c,v
retrieving revision 1.4
diff -u -r1.4 wcwidth.c
--- libc/string/wcwidth.c 3 Jun 2009 19:28:22 -0000 1.4
+++ libc/string/wcwidth.c 20 Aug 2011 04:34:56 -0000
@@ -94,6 +94,9 @@
#include <_ansi.h>
#include <wchar.h>
+#ifndef _MB_CAPABLE
+#include <wctype.h> /* iswprint, iswcntrl */
+#endif
#include "local.h"
#ifdef _MB_CAPABLE