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.
This commit is contained in:
Corinna Vinschen 2012-08-08 11:04:18 +00:00
parent 34a4d873ad
commit 1f232abc89
43 changed files with 187 additions and 74 deletions

View File

@ -1,3 +1,78 @@
2012-08-08 Corinna Vinschen <vinschen@redhat.com>
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.
2012-08-07 Corinna Vinschen <vinschen@redhat.com>
* libc/stdlib/mprec.h (Storeinc): Add parenthesis to avoid compiler

View File

@ -227,6 +227,9 @@ int _EXFUN(sprintf, (char *, const char *, ...)
_ATTRIBUTE ((__format__ (__printf__, 2, 3))));
int _EXFUN(remove, (const char *));
int _EXFUN(rename, (const char *, const char *));
#ifdef _COMPILING_NEWLIB
int _EXFUN(_rename, (const char *, const char *));
#endif
#endif
#if !defined(__STRICT_ANSI__) || defined(__USE_XOPEN2K)
#ifdef _COMPILING_NEWLIB

View File

@ -143,6 +143,9 @@ int _EXFUN(pthread_sigmask, (int how, const sigset_t *set, sigset_t *oset));
#undef sigfillset
#undef sigismember
#ifdef _COMPILING_NEWLIB
int _EXFUN(_kill, (pid_t, int));
#endif
int _EXFUN(kill, (pid_t, int));
int _EXFUN(killpg, (pid_t, int));
int _EXFUN(sigaction, (int, const struct sigaction *, struct sigaction *));

View File

@ -170,8 +170,10 @@ int _EXFUN(futimens, (int, const struct timespec *));
#ifdef _COMPILING_NEWLIB
int _EXFUN(_fstat,( int __fd, struct stat *__sbuf ));
int _EXFUN(_stat,( const char *__path, struct stat *__sbuf ));
int _EXFUN(_mkdir,( const char *_path, mode_t __mode ));
#ifdef __LARGE64_FILES
struct stat64;
int _EXFUN(_stat64,( const char *__path, struct stat64 *__sbuf ));
int _EXFUN(_fstat64,( int __fd, struct stat64 *__sbuf ));
#endif
#endif

View File

@ -71,6 +71,10 @@ struct itimerval {
} while (0)
#endif /* defined (__rtems__) || defined (__CYGWIN__) */
#ifdef _COMPILING_NEWLIB
int _EXFUN(_gettimeofday, (struct timeval *__p, void *__tz));
#endif
int _EXFUN(gettimeofday, (struct timeval *__p, void *__tz));
int _EXFUN(settimeofday, (const struct timeval *, const struct timezone *));
int _EXFUN(utimes, (const char *__path, const struct timeval *__tvp));

View File

@ -21,6 +21,9 @@ struct tms {
};
clock_t _EXFUN(times,(struct tms *));
#ifdef _COMPILING_NEWLIB
clock_t _EXFUN(_times,(struct tms *));
#endif
#ifdef __cplusplus
}

View File

@ -29,6 +29,10 @@ extern "C" {
pid_t wait (int *);
pid_t waitpid (pid_t, int *, int);
#ifdef _COMPILING_NEWLIB
pid_t _wait (int *);
#endif
/* Provide prototypes for most of the _<systemcall> names that are
provided in newlib for some compilers. */
pid_t _wait (int *);

View File

@ -35,7 +35,9 @@
#define LCMESSAGES_SIZE_MIN \
(offsetof(struct lc_messages_T, yesstr) / sizeof(char *))
#ifndef __CYGWIN__
static char empty[] = "";
#endif
static const struct lc_messages_T _C_messages_locale = {
"^[yY]" , /* yesexpr */

View File

@ -79,6 +79,7 @@ static struct lc_monetary_T _monetary_locale;
static int _monetary_using_locale;
static char *_monetary_locale_buf;
#ifndef __CYGWIN__
static char
cnv(const char *str) {
int i = strtol(str, NULL, 10);
@ -86,6 +87,7 @@ cnv(const char *str) {
i = CHAR_MAX;
return (char)i;
}
#endif
int
__monetary_load_locale(const char *name , void *f_wctomb, const char *charset)

View File

@ -182,7 +182,10 @@ char *
_DEFUN(nl_langinfo, (item),
nl_item item) {
char *ret, *s, *cs;
char *ret, *cs;
#ifndef __CYGWIN__
char *s;
#endif
static char *csym = NULL;
#ifdef TRANSITION_PERIOD_HACK
static char *cset = NULL;

View File

@ -117,24 +117,26 @@ __collate_substitute(s)
const u_char *s;
{
int dest_len, len, nlen;
int delta = strlen(s);
int delta = strlen((const char *) s);
u_char *dest_str = NULL;
if(s == NULL || *s == '\0')
return __collate_strdup("");
return __collate_strdup((u_char *) "");
delta += delta / 8;
dest_str = malloc(dest_len = delta);
dest_str = (u_char *) malloc(dest_len = delta);
if(dest_str == NULL)
__collate_err(EX_OSERR, __FUNCTION__);
len = 0;
while(*s) {
nlen = len + strlen(__collate_substitute_table[*s]);
nlen = len + strlen((const char *)
__collate_substitute_table[*s]);
if (dest_len <= nlen) {
dest_str = reallocf(dest_str, dest_len = nlen + delta);
if(dest_str == NULL)
__collate_err(EX_OSERR, __FUNCTION__);
}
strcpy(dest_str + len, __collate_substitute_table[*s++]);
strcpy((char *) dest_str + len,
(const char *) __collate_substitute_table[*s++]);
len = nlen;
}
return dest_str;
@ -150,8 +152,9 @@ __collate_lookup(t, len, prim, sec)
*len = 1;
*prim = *sec = 0;
for(p2 = __collate_chain_pri_table; p2->str[0]; p2++) {
if(strncmp(t, p2->str, strlen(p2->str)) == 0) {
*len = strlen(p2->str);
if(strncmp((const char *) t, (const char *) p2->str,
strlen((const char *) p2->str)) == 0) {
*len = strlen((const char *) p2->str);
*prim = p2->prim;
*sec = p2->sec;
return;
@ -165,7 +168,7 @@ u_char *
__collate_strdup(s)
u_char *s;
{
u_char *t = strdup(s);
u_char *t = (u_char *) strdup((const char *) s);
if (t == NULL)
__collate_err(EX_OSERR, __FUNCTION__);

View File

@ -145,7 +145,7 @@ int eflags;
int i;
struct match mv;
struct match *m = &mv;
char *dp;
char *dp = NULL;
const sopno gf = g->firststate+1; /* +1 for OEND */
const sopno gl = g->laststate;
char *start;
@ -181,8 +181,8 @@ int eflags;
pp = mustlast;
for (dp = start+g->mlen-1; dp < stop;) {
/* Fast skip non-matches */
while (dp < stop && charjump[*dp])
dp += charjump[*dp];
while (dp < stop && charjump[(unsigned char) *dp])
dp += charjump[(unsigned char) *dp];
if (dp >= stop)
break;
@ -198,7 +198,7 @@ int eflags;
/* Jump to next possible match */
mj = matchjump[pp - mustfirst];
cj = charjump[*dp];
cj = charjump[(unsigned char) *dp];
dp += (cj < mj ? mj : cj);
pp = mustlast;
}
@ -364,6 +364,9 @@ sopno stopst;
char *ssp; /* start of string matched by subsubRE */
char *sep; /* end of string matched by subsubRE */
char *oldssp; /* previous ssp */
/* dp is only used for assertion testing which, for some reason, is not
recognized as usage. */
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
char *dp;
AT("diss", start, stop, startst, stopst);

View File

@ -30,6 +30,10 @@
* SUCH DAMAGE.
*/
#ifdef __CYGWIN__
#define _NO_GLOB /* Cygwin provides its own glob. */
#endif
#ifndef _NO_GLOB
#if defined(LIBC_SCCS) && !defined(lint)

View File

@ -113,7 +113,7 @@ _DEFUN(popen, (program, type),
const char *program _AND
const char *type)
{
struct pid *cur, *last;
struct pid *cur;
FILE *iop;
int pdes[2], pid;
@ -159,8 +159,7 @@ _DEFUN(popen, (program, type),
(void)close(pdes[1]);
}
/* Close all fd's created by prior popen. */
for (last = NULL, cur = pidlist; cur;
last = cur, cur = cur->next)
for (cur = pidlist; cur; cur = cur->next)
(void)close (fileno (cur->fp));
execl(_PATH_BSHELL, "sh", "-c", program, NULL);
_exit(127);

View File

@ -103,8 +103,8 @@ static void freeset(struct parse *p, cset *cs);
static int freezeset(struct parse *p, cset *cs);
static int firstch(struct parse *p, cset *cs);
static int nch(struct parse *p, cset *cs);
static void mcadd(struct parse *p, cset *cs, char *cp);
#if used
static void mcadd(struct parse *p, cset *cs, char *cp);
static void mcsub(cset *cs, char *cp);
static int mcin(cset *cs, char *cp);
static char *mcfind(cset *cs, char *cp);
@ -308,8 +308,8 @@ struct parse *p;
int stop; /* character this ERE should end at */
{
char c;
sopno prevback;
sopno prevfwd;
sopno prevback = 0;
sopno prevfwd = 0;
sopno conc;
int first = 1; /* is this the first alternative? */
@ -1333,6 +1333,7 @@ cset *cs;
return(n);
}
#if used
/*
- mcadd - add a collating element to a cset
== static void mcadd(struct parse *p, cset *cs, \
@ -1360,7 +1361,6 @@ char *cp;
cs->multis[cs->smultis - 1] = '\0';
}
#if used
/*
- mcsub - subtract a collating element from a cset
== static void mcsub(cset *cs, char *cp);
@ -1688,8 +1688,8 @@ struct parse *p;
struct re_guts *g;
{
sop *scan;
sop *start;
sop *newstart;
sop *start = NULL;
sop *newstart = NULL;
sopno newlen;
sop s;
char *cp;
@ -1961,7 +1961,7 @@ struct re_guts *g;
* is the first one that would be matched).
*/
for (mindex = 0; mindex < g->mlen; mindex++)
g->charjump[g->must[mindex]] = g->mlen - mindex - 1;
g->charjump[(unsigned char) g->must[mindex]] = g->mlen - mindex - 1;
}
/*

View File

@ -37,7 +37,6 @@ wordexp(const char *words, wordexp_t *pwordexp, int flags)
char *iter;
pid_t pid;
int num_words = 0;
int num_bytes = 0;
int fd[2];
int fd_err[2];
int err = 0;
@ -129,8 +128,6 @@ wordexp(const char *words, wordexp_t *pwordexp, int flags)
if((iter = strchr(tmp, '\n')))
*iter = '\0';
num_bytes = atoi(tmp) + pwordexp->we_wordc;
/* Get each expansion from the shell output, and store each in
pwordexp's we_wordv vector. */
for(i = 0; i < num_words; i++)

View File

@ -44,6 +44,8 @@ DESCRIPTION
<<errno>>.
*/
#include <sys/stat.h>
int
_DEFUN (_mkdir_r, (ptr, path, mode),
struct _reent *ptr _AND

View File

@ -1,6 +1,7 @@
/* Reentrant version of rename system call. */
#include <reent.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/stat.h>
#include <_syslist.h>

View File

@ -141,9 +141,9 @@ _DEFUN(__hash_open, (file, flags, mode, info, dflags),
new_table = 0;
if (!file || (flags & O_TRUNC) ||
#ifdef __USE_INTERNAL_STAT64
(stat64(file, &statbuf) && (errno == ENOENT))) {
(_stat64(file, &statbuf) && (errno == ENOENT))) {
#else
(stat(file, &statbuf) && (errno == ENOENT))) {
(_stat(file, &statbuf) && (errno == ENOENT))) {
#endif
if (errno == ENOENT)
errno = 0; /* Just in case someone looks at errno */
@ -157,9 +157,9 @@ _DEFUN(__hash_open, (file, flags, mode, info, dflags),
a new .db file, then reinitialize the database */
if ((flags & O_CREAT) &&
#ifdef __USE_INTERNAL_STAT64
fstat64(hashp->fp, &statbuf) == 0 && statbuf.st_size == 0)
_fstat64(hashp->fp, &statbuf) == 0 && statbuf.st_size == 0)
#else
fstat(hashp->fp, &statbuf) == 0 && statbuf.st_size == 0)
_fstat(hashp->fp, &statbuf) == 0 && statbuf.st_size == 0)
#endif
new_table = 1;
@ -316,7 +316,11 @@ init_hash(hashp, file, info)
const char *file;
const HASHINFO *info;
{
#ifdef __USE_INTERNAL_STAT64
struct stat64 statbuf;
#else
struct stat statbuf;
#endif
int nelem;
nelem = 1;
@ -335,9 +339,9 @@ init_hash(hashp, file, info)
/* Fix bucket size to be optimal for file system */
if (file != NULL) {
#ifdef __USE_INTERNAL_STAT64
if (stat64(file, &statbuf))
if (_stat64(file, &statbuf))
#else
if (stat(file, &statbuf))
if (_stat(file, &statbuf))
#endif
return (NULL);
hashp->BSIZE = statbuf.st_blksize;

View File

@ -123,7 +123,7 @@ __big_insert(hashp, bufp, key, val)
if (!bufp)
return (-1);
n = p[0];
if (!key_size)
if (!key_size) {
if (FREESPACE(p)) {
move_bytes = MIN(FREESPACE(p), val_size);
off = OFFSET(p) - move_bytes;
@ -136,6 +136,7 @@ __big_insert(hashp, bufp, key, val)
OFFSET(p) = off;
} else
p[n - 2] = FULL_KEY;
}
p = (__uint16_t *)bufp->page;
cp = bufp->page;
bufp->flags |= BUF_MOD;

View File

@ -667,7 +667,7 @@ static __uint16_t
overflow_page(hashp)
HTAB *hashp;
{
__uint32_t *freep;
__uint32_t *freep = NULL;
int max_free, offset, splitnum;
__uint16_t addr;
int bit, first_page, free_bit, free_page, i, in_use_bits, j;

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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));

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -78,6 +78,7 @@ typedef enum { COPY_A, COPY_J1, COPY_J2, MAKE_A, NOOP, EMPTY, ERROR } JIS_ACTION
* is 2 (switch to JIS) + 2 (JIS characters) + 2 (switch back to ASCII) = 6.
*************************************************************************************/
#ifndef __CYGWIN__
static JIS_STATE JIS_state_table[JIS_S_NUM][JIS_C_NUM] = {
/* ESCAPE DOLLAR BRACKET AT B J NUL JIS_CHAR OTHER */
/* ASCII */ { A_ESC, ASCII, ASCII, ASCII, ASCII, ASCII, ASCII, ASCII, ASCII },
@ -99,6 +100,7 @@ static JIS_ACTION JIS_action_table[JIS_S_NUM][JIS_C_NUM] = {
/* J_ESC */ { ERROR, ERROR, NOOP, ERROR, ERROR, ERROR, ERROR, ERROR, ERROR },
/* J_ESC_BR */{ ERROR, ERROR, ERROR, ERROR, MAKE_A, MAKE_A, ERROR, ERROR, ERROR },
};
#endif /* !__CYGWIN__ */
/* we override the mbstate_t __count field for more complex encodings and use it store a state value */
#define __state __count

View File

@ -81,7 +81,7 @@ _DEFUN (__utf8_wctomb, (r, s, wchar, charset, state),
to return extra 3 bytes. */
wchar_t tmp;
tmp = (state->__value.__wchb[0] << 16 | state->__value.__wchb[1] << 8)
- 0x10000 >> 10 | 0xd80d;
- (0x10000 >> 10 | 0xd80d);
*s++ = 0xe0 | ((tmp & 0xf000) >> 12);
*s++ = 0x80 | ((tmp & 0xfc0) >> 6);
*s++ = 0x80 | (tmp & 0x3f);

View File

@ -84,6 +84,8 @@ QUICKREF
(!memchr ((h) + (h_l), '\0', (j) + (n_l) - (h_l)) \
&& ((h_l) = (j) + (n_l)))
# define CANON_ELEMENT(c) tolower (c)
/* strncasecmp uses signed char, CMP_FUNC is expected to use unsigned char. */
#pragma GCC diagnostic ignored "-Wpointer-sign"
# define CMP_FUNC strncasecmp
# include "str-two-way.h"
#endif

View File

@ -165,8 +165,8 @@ _DEFUN (strptime, (buf, format, timeptr),
char *s;
int ret;
if (isspace (c)) {
while (isspace (*buf))
if (isspace ((unsigned char) c)) {
while (isspace ((unsigned char) *buf))
++buf;
} else if (c == '%' && format[1] != '\0') {
c = *++format;

View File

@ -18,16 +18,12 @@
float x;
#endif
{
int signbit;
__uint32_t w;
/* Most significant word, least significant word. */
int exponent_less_127;
GET_FLOAT_WORD(w, x);
/* Extract sign bit. */
signbit = w & 0x80000000;
/* Extract exponent field. */
exponent_less_127 = (int)((w & 0x7f800000) >> 23) - 127;

View File

@ -73,7 +73,7 @@ pi_lo = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */
if(((ix|((lx|-lx)>>31))>0x7ff00000)||
((iy|((ly|-ly)>>31))>0x7ff00000)) /* x or y is NaN */
return x+y;
if((hx-0x3ff00000|lx)==0) return atan(y); /* x=1.0 */
if(((hx-0x3ff00000)|lx)==0) return atan(y); /* x=1.0 */
m = ((hy>>31)&1)|((hx>>30)&2); /* 2*sign(x)+sign(y) */
/* when y = 0 */

View File

@ -109,7 +109,7 @@ P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */
#endif
{
double y,hi,lo,c,t;
__int32_t k,xsb;
__int32_t k = 0,xsb;
__uint32_t hx;
GET_HIGH_WORD(hx,x);
@ -144,7 +144,6 @@ P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */
else if(hx < 0x3e300000) { /* when |x|<2**-28 */
if(huge+x>one) return one+x;/* trigger inexact */
}
else k = 0;
/* x is now in primary range */
t = x*x;

View File

@ -120,9 +120,10 @@ ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/
/* x|y==NaN return NaN unless x==1 then return 1 */
if(ix > 0x7ff00000 || ((ix==0x7ff00000)&&(lx!=0)) ||
iy > 0x7ff00000 || ((iy==0x7ff00000)&&(ly!=0)))
iy > 0x7ff00000 || ((iy==0x7ff00000)&&(ly!=0))) {
if(((ix-0x3ff00000)|lx)==0) return one;
else return nan("");
}
/* determine if y is an odd int when x < 0
* yisint = 0 ... y is not an integer

View File

@ -89,7 +89,7 @@ pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */
double x,y[];
#endif
{
double z,w,t,r,fn;
double z = 0.0,w,t,r,fn;
double tx[3];
__int32_t i,j,n,ix,hx;
int e0,nx;

View File

@ -47,7 +47,7 @@ P5 = 4.1381369442e-08; /* 0x3331bb4c */
#endif
{
float y,hi,lo,c,t;
__int32_t k,xsb,sx;
__int32_t k = 0,xsb,sx;
__uint32_t hx;
GET_FLOAT_WORD(sx,x);
@ -79,7 +79,6 @@ P5 = 4.1381369442e-08; /* 0x3331bb4c */
else if(hx < 0x31800000) { /* when |x|<2**-28 */
if(huge+x>one) return one+x;/* trigger inexact */
}
else k = 0;
/* x is now in primary range */
t = x*x;

View File

@ -77,9 +77,10 @@ ivln2_l = 7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/
/* x|y==NaN return NaN unless x==1 then return 1 */
if(FLT_UWORD_IS_NAN(ix) ||
FLT_UWORD_IS_NAN(iy))
FLT_UWORD_IS_NAN(iy)) {
if(ix==0x3f800000) return one;
else return nanf("");
}
/* determine if y is an odd int when x < 0
* yisint = 0 ... y is not an integer

View File

@ -216,7 +216,7 @@ static double zero= 0.00000000000000000000e+00;
double x; int *signgamp;
#endif
{
double t,y,z,nadj,p,p1,p2,p3,q,r,w;
double t,y,z,nadj = 0.0,p,p1,p2,p3,q,r,w;
__int32_t i,hx,lx,ix;
EXTRACT_WORDS(hx,lx,x);

View File

@ -151,7 +151,7 @@ static float zero= 0.0000000000e+00;
float x; int *signgamp;
#endif
{
float t,y,z,nadj,p,p1,p2,p3,q,r,w;
float t,y,z,nadj = 0.0,p,p1,p2,p3,q,r,w;
__int32_t i,hx,ix;
GET_FLOAT_WORD(hx,x);