Silence gcc 4.4.1 compiler warnings

svn: r16411
This commit is contained in:
Kevin Tew 2009-10-22 17:17:32 +00:00
parent aa7a99112e
commit 2955ff1b0e
6 changed files with 61 additions and 25 deletions

View File

@ -10,6 +10,7 @@
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
/* The config string after : is replaced with ! followed by a sequence
of little-endian 4-byte ints:
@ -95,9 +96,9 @@ static int is_x_flag(char *s)
return 0;
}
static void write_str(int fd, char *s)
static int write_str(int fd, char *s)
{
write(fd, s, strlen(s));
return write(fd, s, strlen(s));
}
#if 0
@ -330,7 +331,13 @@ int main(int argc, char **argv)
fd = open(me, O_RDONLY, 0);
lseek(fd, prog_end, SEEK_SET);
read(fd, data, end - prog_end);
{
int expected_length = end - prog_end;
if (expected_length != read(fd, data, expected_length)) {
printf("read failed to read all %i bytes from file %s\n", expected_length, me);
abort();
}
}
close(fd);
exe_path = data;

View File

@ -5836,7 +5836,8 @@ void scheme_gmp_tls_snapshot(long *s, long *save)
void scheme_gmp_tls_restore_snapshot(long *s, void *data, long *save, int do_free)
{
long other[6];
/* silence gcc "may be used uninitialized in this function" warnings */
long other[6] = {0,0,0,0,0,0};
void *other_data;
if (do_free == 2) {

View File

@ -1676,23 +1676,41 @@ static Scheme_Object *bytes_to_integer (int argc, Scheme_Object *argv[])
switch(slen) {
case 2:
if (sgned)
return scheme_make_integer(((short *)str)[0]);
else
return scheme_make_integer(((unsigned short *)str)[0]);
if (sgned) {
short val;
memcpy(&val, str, sizeof(short));
return scheme_make_integer(val);
}
else {
unsigned short val;
memcpy(&val, str, sizeof(unsigned short));
return scheme_make_integer(val);
}
break;
case 4:
if (sgned)
return scheme_make_integer_value(((int *)str)[0]);
else
return scheme_make_integer_value_from_unsigned(((unsigned int *)str)[0]);
if (sgned) {
int val;
memcpy(&val, str, sizeof(int));
return scheme_make_integer_value(val);
}
else {
unsigned int val;
memcpy(&val, str, sizeof(unsigned int));
return scheme_make_integer_value_from_unsigned(val);
}
break;
default:
#ifdef SIXTY_FOUR_BIT_INTEGERS
if (sgned)
return scheme_make_integer_value(((long *)str)[0]);
else
return scheme_make_integer_value_from_unsigned(((unsigned long *)str)[0]);
if (sgned) {
long val;
memcpy(&val, str, sizeof(long));
return scheme_make_integer_value(val);
}
else {
unsigned long val;
memcpy(&val, str, sizeof(unsigned long));
return scheme_make_integer_value_from_unsigned(val);
}
break;
#else
# ifndef NO_LONG_LONG_TYPE
@ -1875,19 +1893,21 @@ static Scheme_Object *integer_to_bytes(int argc, Scheme_Object *argv[])
case 2:
{
if (sgned) {
*(unsigned short *)str = (unsigned short)(val);
unsigned short value = val;
memcpy(str, &value, sizeof(unsigned short));
} else {
*(short *)str = (short)(val);
short value = val;
memcpy(str, &value, sizeof(short));
}
}
break;
case 4:
if (sgned) {
unsigned int sv = val;
*(unsigned int *)str = sv;
unsigned int value = val;
memcpy(str, &value, sizeof(unsigned int));
} else {
int sv = val;
*(int *)str = sv;
int value = val;
memcpy(str, &value, sizeof(int));
}
break;
default:

View File

@ -8350,8 +8350,11 @@ static void default_sleep(float v, void *fds)
#if defined(FILES_HAVE_FDS)
/* Clear external event flag */
if (external_event_fd) {
int rc;
char buf[10];
read(external_event_fd, buf, 10);
do {
rc = read(external_event_fd, buf, 10);
} while ((rc == -1) && errno == EINTR);
}
#endif
}

View File

@ -362,6 +362,11 @@ XFORM_NONGCING static void WRAP_POS_SET_FIRST(Wrap_Pos *w)
w->a = a;
}
}
/* silence gcc "may be used uninitialized in this function" warnings */
else {
w->a = NULL;
w->is_limb = 0;
}
}
XFORM_NONGCING static MZ_INLINE void DO_WRAP_POS_INC(Wrap_Pos *w)

View File

@ -215,10 +215,10 @@ do { \
# define dprintf(format...)
#endif
static ALWAYS_INLINE void
static ALWAYS_INLINE int
print_error (const char *string)
{
write (2, string, strlen (string));
return write (2, string, strlen (string));
}
#define mi_init UNWI_ARCH_OBJ(mi_init)