Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2012-08-08 15:04:18 +0400
committerCorinna Vinschen <corinna@vinschen.de>2012-08-08 15:04:18 +0400
commit1f232abc8938cc1fe821a6a8504b3845bad89522 (patch)
tree17abe0c1228139fdf4e2ffff34e7f86cfc55d982 /newlib/libc/stdio
parent34a4d873ad02e1be335d4cd57db3e60196e24137 (diff)
Throughout, run newlib with -Wall -Werror option and fix bugs and
compiler warnings found this way. * libc/stdio/freopen.c (_freopen_r): Fix bug setting _flags. * libc/include/stdio.h (_rename): Define when building newlib. * libc/include/sys/signal.h (_kill): Ditto. * libc/include/sys/stat.h (_mkdir): Ditto. * libc/include/sys/time.h (_gettimeofday): Ditto. * libc/include/sys/times.h (_times): Ditto. * libc/include/sys/wait.h (_wait): Ditto. * libc/locale/lmessages.c (empty): Don't define for Cygwin. * libc/locale/lmonetary.c (cnv): Ditto. * libc/locale/nl_langinfo.c (nl_langinfo): Ditto for variable s. * libc/posix/collate.c: Throughout cast to avoid compiler warning. * libc/posix/engine.c (matcher): Initialize dp to avoid compiler warning. * libc/posix/glob.c: Disable on Cygwin. Explain why. * libc/posix/regcomp.c: Fix "uninitialized" compiler warnings. (dissect): Deliberately silence gcc compiler warning. Add comment to explain why. * libc/posix/wordexp.c (wordexp): Remove num_bytes variable since result is never used. * libc/posix/popen.c (popen): Ditto for variable last. * libc/reent/mkdirr.c: Include sys/stat.h. * libc/reent/renamer.c: Include stdio.h. * libc/search/hash.c: Throughout use underscored variants of the stat function family. (init_hash): Add missing definition for the __USE_INTERNAL_STAT64 case. * libc/search/hash_bigkey.c (__big_insert): Add parenthesis to avoid compiler warning. * libc/search/hash_page.c (overflow_page): Initalize freep to NULL to avoid compiler warning. * libc/stdio/asiprintf.c (_asiprintf_r): Cast unsigned char * to char * to avoid compiler warning. (asiprintf): Ditto. * libc/stdio/asprintf.c (_asprintf_r): Ditto. (asprintf): Ditto. * libc/stdio/vasiprintf.c (_vasiprintf_r): Ditto. * libc/stdio/vasprintf.c (_vasprintf_r): Ditto. * libc/stdio/mktemp.c (_gettemp): Cast to unsigned char in call to isdigit to avoid compiler warning. * libc/stdio/vfprintf.c (_VFPRINTF_R): Initialize variables used for grouping to avoid compiler warning. Only define and set nseps and nrepeats if they are really used. * libc/stdio/vfwprintf.c (_VFWPRINTF_R): Ditto. Only define state if it is really used. * libc/stdio/vfscanf.c (u_char): Revert to be defined as unsigned char. (__SVFSCANF_R): Cast fmt in call to __mbtowc. * libc/stdlib/mbtowc_r.c (JIS_state_table): Disable when building Cygwin. (JIS_action_table): Ditto. * libc/stdlib/wctomb_r.c (__utf8_wctomb): Add parenthesis to avoid compiler warning. * libc/string/strcasestr.c: Deliberately silence gcc compiler warning. Add comment to explain why. * libc/time/strptime.c (strptime): Cast to unsigned char in calls to isspace to avoid compiler warning. * libm/math/e_atan2.c (__ieee754_atan2): Add parenthesis to avoid compiler warning. * libm/math/e_exp.c (__ieee754_exp): Initialize k to 0 to avoid compiler warning. Drop setting it to 0 later. * libm/math/ef_exp.c (__ieee754_expf): Ditto. * libm/math/e_pow.c (__ieee754_pow): Add braces to avoid compiler warning. * libm/math/ef_pow.c (__ieee754_powf): Ditto. * libm/math/er_lgamma.c (__ieee754_lgamma_r): Initialize nadj to 0 to avoid compiler warning. * libm/math/erf_lgamma.c (__ieee754_lgammaf_r): Ditto. * libm/math/e_rem_pio2.c (__ieee754_rem_pio2): Ditto for variable z. * libm/common/sf_round.c (roundf): Remove signbit variable since result is never used.
Diffstat (limited to 'newlib/libc/stdio')
-rw-r--r--newlib/libc/stdio/asiprintf.c4
-rw-r--r--newlib/libc/stdio/asprintf.c4
-rw-r--r--newlib/libc/stdio/freopen.c2
-rw-r--r--newlib/libc/stdio/mktemp.c2
-rw-r--r--newlib/libc/stdio/vasiprintf.c2
-rw-r--r--newlib/libc/stdio/vasprintf.c2
-rw-r--r--newlib/libc/stdio/vfprintf.c10
-rw-r--r--newlib/libc/stdio/vfscanf.c7
-rw-r--r--newlib/libc/stdio/vfwprintf.c11
9 files changed, 21 insertions, 23 deletions
diff --git a/newlib/libc/stdio/asiprintf.c b/newlib/libc/stdio/asiprintf.c
index 97474fd1a..0c363d5ea 100644
--- a/newlib/libc/stdio/asiprintf.c
+++ b/newlib/libc/stdio/asiprintf.c
@@ -45,7 +45,7 @@ _DEFUN(_asiprintf_r, (ptr, strp, fmt),
if (ret >= 0)
{
*f._p = 0;
- *strp = f._bf._base;
+ *strp = (char *) f._bf._base;
}
return (ret);
}
@@ -72,7 +72,7 @@ _DEFUN(asiprintf, (strp, fmt),
if (ret >= 0)
{
*f._p = 0;
- *strp = f._bf._base;
+ *strp = (char *) f._bf._base;
}
return (ret);
}
diff --git a/newlib/libc/stdio/asprintf.c b/newlib/libc/stdio/asprintf.c
index 59a08c808..7b26d9f29 100644
--- a/newlib/libc/stdio/asprintf.c
+++ b/newlib/libc/stdio/asprintf.c
@@ -45,7 +45,7 @@ _DEFUN(_asprintf_r, (ptr, strp, fmt),
if (ret >= 0)
{
*f._p = 0;
- *strp = f._bf._base;
+ *strp = (char *) f._bf._base;
}
return (ret);
}
@@ -72,7 +72,7 @@ _DEFUN(asprintf, (strp, fmt),
if (ret >= 0)
{
*f._p = 0;
- *strp = f._bf._base;
+ *strp = (char *) f._bf._base;
}
return (ret);
}
diff --git a/newlib/libc/stdio/freopen.c b/newlib/libc/stdio/freopen.c
index 6483655bf..b33eb1e22 100644
--- a/newlib/libc/stdio/freopen.c
+++ b/newlib/libc/stdio/freopen.c
@@ -208,7 +208,7 @@ _DEFUN(_freopen_r, (ptr, file, mode, fp),
if (HASLB (fp))
FREELB (ptr, fp);
fp->_lb._size = 0;
- fp->_flags & ~__SORD;
+ fp->_flags &= ~__SORD;
fp->_flags2 = 0;
memset (&fp->_mbstate, 0, sizeof (_mbstate_t));
diff --git a/newlib/libc/stdio/mktemp.c b/newlib/libc/stdio/mktemp.c
index 1c5d76db4..ecbc7afea 100644
--- a/newlib/libc/stdio/mktemp.c
+++ b/newlib/libc/stdio/mktemp.c
@@ -247,7 +247,7 @@ _DEFUN(_gettemp, (ptr, path, doopen, domkdir, suffixlen, flags),
else
{
/* Safe, since it only encounters 7-bit characters. */
- if (isdigit (*trv))
+ if (isdigit ((unsigned char) *trv))
*trv = 'a';
else
++ * trv;
diff --git a/newlib/libc/stdio/vasiprintf.c b/newlib/libc/stdio/vasiprintf.c
index 15310cce9..f96de0d79 100644
--- a/newlib/libc/stdio/vasiprintf.c
+++ b/newlib/libc/stdio/vasiprintf.c
@@ -59,7 +59,7 @@ _DEFUN(_vasiprintf_r, (ptr, strp, fmt, ap),
if (ret >= 0)
{
*f._p = 0;
- *strp = f._bf._base;
+ *strp = (char *) f._bf._base;
}
return ret;
}
diff --git a/newlib/libc/stdio/vasprintf.c b/newlib/libc/stdio/vasprintf.c
index b89f4dbd7..fbb54cbe8 100644
--- a/newlib/libc/stdio/vasprintf.c
+++ b/newlib/libc/stdio/vasprintf.c
@@ -59,7 +59,7 @@ _DEFUN(_vasprintf_r, (ptr, strp, fmt, ap),
if (ret >= 0)
{
*f._p = 0;
- *strp = f._bf._base;
+ *strp = (char *) f._bf._base;
}
return ret;
}
diff --git a/newlib/libc/stdio/vfprintf.c b/newlib/libc/stdio/vfprintf.c
index 559899107..4b165e021 100644
--- a/newlib/libc/stdio/vfprintf.c
+++ b/newlib/libc/stdio/vfprintf.c
@@ -567,9 +567,9 @@ _DEFUN(_VFPRINTF_R, (data, fp, fmt0, ap),
char sign; /* sign prefix (' ', '+', '-', or \0) */
#ifdef _WANT_IO_C99_FORMATS
/* locale specific numeric grouping */
- char *thousands_sep;
- size_t thsnd_len;
- const char *grouping;
+ char *thousands_sep = NULL;
+ size_t thsnd_len = 0;
+ const char *grouping = NULL;
#endif
#ifdef FLOATING_POINT
char *decimal_point = _localeconv_r (data)->decimal_point;
@@ -585,7 +585,7 @@ _DEFUN(_VFPRINTF_R, (data, fp, fmt0, ap),
#if defined (FLOATING_POINT) || defined (_WANT_IO_C99_FORMATS)
int ndig = 0; /* actual number of digits returned by cvt */
#endif
-#ifdef _WANT_IO_C99_FORMATS
+#if defined (FLOATING_POINT) && defined (_WANT_IO_C99_FORMATS)
int nseps; /* number of group separators with ' */
int nrepeats; /* number of repeats of the last group */
#endif
@@ -793,10 +793,10 @@ _DEFUN(_VFPRINTF_R, (data, fp, fmt0, ap),
sign = '\0';
#ifdef FLOATING_POINT
lead = 0;
-#endif
#ifdef _WANT_IO_C99_FORMATS
nseps = nrepeats = 0;
#endif
+#endif
#ifndef _NO_POS_ARGS
N = arg_index;
is_pos_arg = 0;
diff --git a/newlib/libc/stdio/vfscanf.c b/newlib/libc/stdio/vfscanf.c
index e05082db7..e967719b7 100644
--- a/newlib/libc/stdio/vfscanf.c
+++ b/newlib/libc/stdio/vfscanf.c
@@ -243,10 +243,7 @@ static void * get_arg (int, va_list *, int *, void **);
#define CT_INT 3 /* integer, i.e., strtol or strtoul */
#define CT_FLOAT 4 /* floating, i.e., strtod */
-#if 0
#define u_char unsigned char
-#endif
-#define u_char char
#define u_long unsigned long
#ifndef _NO_LONGLONG
@@ -513,8 +510,8 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
#ifndef _MB_CAPABLE
wc = *fmt;
#else
- nbytes = __mbtowc (rptr, &wc, fmt, MB_CUR_MAX, __locale_charset (),
- &state);
+ nbytes = __mbtowc (rptr, &wc, (char *) fmt, MB_CUR_MAX,
+ __locale_charset (), &state);
if (nbytes < 0) {
wc = 0xFFFD; /* Unicode replacement character */
nbytes = 1;
diff --git a/newlib/libc/stdio/vfwprintf.c b/newlib/libc/stdio/vfwprintf.c
index 029f1d08c..7d38ecf82 100644
--- a/newlib/libc/stdio/vfwprintf.c
+++ b/newlib/libc/stdio/vfwprintf.c
@@ -396,10 +396,11 @@ _DEFUN(_VFWPRINTF_R, (data, fp, fmt0, ap),
wchar_t sign; /* sign prefix (' ', '+', '-', or \0) */
#ifdef _WANT_IO_C99_FORMATS
/* locale specific numeric grouping */
- wchar_t thousands_sep;
- const char *grouping;
+ wchar_t thousands_sep = L'\0';
+ const char *grouping = NULL;
#endif
-#ifdef _MB_CAPABLE
+#if defined (FLOATING_POINT) && defined (_MB_CAPABLE) \
+ && !defined (__HAVE_LOCALE_INFO_EXTENDED__)
mbstate_t state; /* mbtowc calls from library must not change state */
#endif
#ifdef FLOATING_POINT
@@ -415,7 +416,7 @@ _DEFUN(_VFWPRINTF_R, (data, fp, fmt0, ap),
#if defined (FLOATING_POINT) || defined (_WANT_IO_C99_FORMATS)
int ndig = 0; /* actual number of digits returned by cvt */
#endif
-#ifdef _WANT_IO_C99_FORMATS
+#if defined (FLOATING_POINT) && defined (_WANT_IO_C99_FORMATS)
int nseps; /* number of group separators with ' */
int nrepeats; /* number of repeats of the last group */
#endif
@@ -619,10 +620,10 @@ _DEFUN(_VFWPRINTF_R, (data, fp, fmt0, ap),
sign = L'\0';
#ifdef FLOATING_POINT
lead = 0;
-#endif
#ifdef _WANT_IO_C99_FORMATS
nseps = nrepeats = 0;
#endif
+#endif
#ifndef _NO_POS_ARGS
N = arg_index;
is_pos_arg = 0;