Final patch for Char/HChar mixups.

Remove -Wno-pointer-sign from configure.in.
Fixes 273227.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13125
This commit is contained in:
Florian Krohm 2012-11-18 00:36:15 +00:00
parent 59fc40a7f3
commit b87aa67392
12 changed files with 173 additions and 193 deletions

View File

@ -484,7 +484,8 @@ static void handleUnderflow(BB* bb)
BB* source_bb;
Bool seen_before;
fn_node* caller;
int fn_number, *pactive;
int fn_number;
unsigned *pactive;
call_entry* call_entry_up;
CLG_DEBUG(1," Callstack underflow !\n");

View File

@ -1397,28 +1397,6 @@ CFLAGS=$safe_CFLAGS
AC_SUBST(PREFERRED_STACK_BOUNDARY)
# does this compiler support -Wno-pointer-sign ?
AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign])
safe_CFLAGS=$CFLAGS
CFLAGS="-Wno-pointer-sign"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
return 0;
]])], [
no_pointer_sign=yes
AC_MSG_RESULT([yes])
], [
no_pointer_sign=no
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS
if test x$no_pointer_sign = xyes; then
CFLAGS="$CFLAGS -Wno-pointer-sign"
fi
# does this compiler support -Wno-empty-body ?
AC_MSG_CHECKING([if gcc accepts -Wno-empty-body])

View File

@ -354,9 +354,9 @@ Int VG_(system) ( const HChar* cmd )
if (pid == 0) {
/* child */
const HChar* argv[4] = { "/bin/sh", "-c", cmd, 0 };
VG_(execv)(argv[0], argv);
VG_(execv)(argv[0], (HChar **)argv);
/* If we're still alive here, execve failed. */
/* If we're still alive here, execv failed. */
VG_(exit)(1);
} else {
/* parent */

View File

@ -49,12 +49,12 @@
char* VG_REPLACE_FUNCTION_ZU(soname,fnname)( const char* s, int c ); \
char* VG_REPLACE_FUNCTION_ZU(soname,fnname)( const char* s, int c ) \
{ \
UChar ch = (UChar)((UInt)c); \
UChar* p = (UChar*)s; \
UChar* last = NULL; \
HChar ch = (HChar)c; \
const HChar* p = s; \
const HChar* last = NULL; \
while (True) { \
if (*p == ch) last = p; \
if (*p == 0) return last; \
if (*p == 0) return (HChar *)last; \
p++; \
} \
}
@ -75,10 +75,10 @@ STRRCHR(VG_Z_DYLD, rindex)
char* VG_REPLACE_FUNCTION_ZU(soname,fnname) ( const char* s, int c ); \
char* VG_REPLACE_FUNCTION_ZU(soname,fnname) ( const char* s, int c ) \
{ \
UChar ch = (UChar)((UInt)c); \
UChar* p = (UChar*)s; \
HChar ch = (HChar)c ; \
const HChar* p = s; \
while (True) { \
if (*p == ch) return p; \
if (*p == ch) return (HChar *)p; \
if (*p == 0) return NULL; \
p++; \
} \
@ -137,7 +137,7 @@ STRLEN(VG_Z_LD_SO_1, strlen)
char* VG_REPLACE_FUNCTION_ZU(soname, fnname) ( char* dst, const char* src ); \
char* VG_REPLACE_FUNCTION_ZU(soname, fnname) ( char* dst, const char* src ) \
{ \
Char* dst_orig = dst; \
HChar* dst_orig = dst; \
\
while (*src) *dst++ = *src++; \
*dst = 0; \
@ -187,17 +187,17 @@ STRNCMP(VG_Z_DYLD, strncmp)
int VG_REPLACE_FUNCTION_ZU(soname,fnname) \
( const char* s1, const char* s2 ) \
{ \
register unsigned char c1; \
register unsigned char c2; \
register UChar c1; \
register UChar c2; \
while (True) { \
c1 = *(unsigned char *)s1; \
c2 = *(unsigned char *)s2; \
c1 = *(UChar *)s1; \
c2 = *(UChar *)s2; \
if (c1 != c2) break; \
if (c1 == 0) break; \
s1++; s2++; \
} \
if ((unsigned char)c1 < (unsigned char)c2) return -1; \
if ((unsigned char)c1 > (unsigned char)c2) return 1; \
if ((UChar)c1 < (UChar)c2) return -1; \
if ((UChar)c1 > (UChar)c2) return 1; \
return 0; \
}
@ -325,13 +325,13 @@ STPCPY(VG_Z_LD_LINUX_X86_64_SO_2, stpcpy)
/* Find the first occurrence of C in S. */
#define GLIBC232_RAWMEMCHR(soname, fnname) \
char* VG_REPLACE_FUNCTION_ZU(soname,fnname) (const char* s, int c_in); \
char* VG_REPLACE_FUNCTION_ZU(soname,fnname) (const char* s, int c_in) \
void* VG_REPLACE_FUNCTION_ZU(soname,fnname) (const void* s, int c_in); \
void* VG_REPLACE_FUNCTION_ZU(soname,fnname) (const void* s, int c_in) \
{ \
unsigned char c = (unsigned char) c_in; \
unsigned char* char_ptr = (unsigned char *)s; \
UChar c = (UChar)c_in; \
const UChar* char_ptr = s; \
while (1) { \
if (*char_ptr == c) return char_ptr; \
if (*char_ptr == c) return (void *)char_ptr; \
char_ptr++; \
} \
}
@ -343,26 +343,26 @@ GLIBC232_RAWMEMCHR(VG_Z_LIBC_SONAME, __GI___rawmemchr)
#define STRSTR(soname, fnname) \
void* VG_REPLACE_FUNCTION_ZU(soname,fnname) \
(void* haystack, void* needle); \
void* VG_REPLACE_FUNCTION_ZU(soname,fnname) \
(void* haystack, void* needle) \
char* VG_REPLACE_FUNCTION_ZU(soname,fnname) \
(const char* haystack, const char* needle); \
char* VG_REPLACE_FUNCTION_ZU(soname,fnname) \
(const char* haystack, const char* needle) \
{ \
UChar* h = (UChar*)haystack; \
UChar* n = (UChar*)needle; \
const HChar* h = haystack; \
const HChar* n = needle; \
\
/* find the length of n, not including terminating zero */ \
UWord nlen = 0; \
while (n[nlen]) nlen++; \
\
/* if n is the empty string, match immediately. */ \
if (nlen == 0) return h; \
if (nlen == 0) return (HChar *)h; \
\
/* assert(nlen >= 1); */ \
UChar n0 = n[0]; \
HChar n0 = n[0]; \
\
while (1) { \
UChar hh = *h; \
const HChar hh = *h; \
if (hh == 0) return NULL; \
if (hh != n0) { h++; continue; } \
\
@ -373,7 +373,7 @@ GLIBC232_RAWMEMCHR(VG_Z_LIBC_SONAME, __GI___rawmemchr)
} \
/* assert(i >= 0 && i <= nlen); */ \
if (i == nlen) \
return h; \
return (HChar *)h; \
\
h++; \
} \
@ -385,13 +385,13 @@ STRSTR(VG_Z_LIBC_SONAME, strstr)
#define STRPBRK(soname, fnname) \
void* VG_REPLACE_FUNCTION_ZU(soname,fnname) \
(void* sV, void* acceptV); \
void* VG_REPLACE_FUNCTION_ZU(soname,fnname) \
(void* sV, void* acceptV) \
char* VG_REPLACE_FUNCTION_ZU(soname,fnname) \
(const char* sV, const char* acceptV); \
char* VG_REPLACE_FUNCTION_ZU(soname,fnname) \
(const char* sV, const char* acceptV) \
{ \
UChar* s = (UChar*)sV; \
UChar* accept = (UChar*)acceptV; \
const HChar* s = sV; \
const HChar* accept = acceptV; \
\
/* find the length of 'accept', not including terminating zero */ \
UWord nacc = 0; \
@ -403,12 +403,12 @@ STRSTR(VG_Z_LIBC_SONAME, strstr)
/* assert(nacc >= 1); */ \
while (1) { \
UWord i; \
UChar sc = *s; \
HChar sc = *s; \
if (sc == 0) \
break; \
for (i = 0; i < nacc; i++) { \
if (sc == accept[i]) \
return s; \
return (HChar *)s; \
} \
s++; \
} \

View File

@ -137,7 +137,7 @@
do { \
char* _fnname = (char*)(_fnnameF); \
long _err = (long)(int)(_errF); \
char* _errstr = lame_strerror(_err); \
const char* _errstr = lame_strerror(_err); \
DO_CREQ_v_WWW(_VG_USERREQ__HG_PTH_API_ERROR, \
char*,_fnname, \
long,_err, char*,_errstr); \
@ -159,7 +159,7 @@
strerror_r, since using the latter just generates endless more
threading errors (glibc goes off and does tons of crap w.r.t.
locales etc) */
static char* lame_strerror ( long err )
static const HChar* lame_strerror ( long err )
{ switch (err) {
case EPERM: return "EPERM: Operation not permitted";
case ENOENT: return "ENOENT: No such file or directory";
@ -2302,10 +2302,10 @@ QT4_FUNC(void*, _ZN6QMutexD2Ev, void* mutex)
char* VG_REPLACE_FUNCTION_ZU(soname,fnname) ( const char* s, int c ); \
char* VG_REPLACE_FUNCTION_ZU(soname,fnname) ( const char* s, int c ) \
{ \
UChar ch = (UChar)((UInt)c); \
UChar* p = (UChar*)s; \
HChar ch = (HChar)c ; \
const HChar* p = s; \
while (True) { \
if (*p == ch) return p; \
if (*p == ch) return (HChar *)p; \
if (*p == 0) return NULL; \
p++; \
} \
@ -2351,12 +2351,12 @@ QT4_FUNC(void*, _ZN6QMutexD2Ev, void* mutex)
char* VG_REPLACE_FUNCTION_ZU(soname, fnname) ( char* dst, const char* src ); \
char* VG_REPLACE_FUNCTION_ZU(soname, fnname) ( char* dst, const char* src ) \
{ \
const Char* dst_orig = dst; \
HChar* dst_orig = dst; \
\
while (*src) *dst++ = *src++; \
*dst = 0; \
\
return (char*)dst_orig; \
return dst_orig; \
}
#if defined(VGO_linux)
@ -2372,17 +2372,17 @@ QT4_FUNC(void*, _ZN6QMutexD2Ev, void* mutex)
int VG_REPLACE_FUNCTION_ZU(soname,fnname) \
( const char* s1, const char* s2 ) \
{ \
register unsigned char c1; \
register unsigned char c2; \
register UChar c1; \
register UChar c2; \
while (True) { \
c1 = *(unsigned char *)s1; \
c2 = *(unsigned char *)s2; \
c1 = *(UChar *)s1; \
c2 = *(UChar *)s2; \
if (c1 != c2) break; \
if (c1 == 0) break; \
s1++; s2++; \
} \
if ((unsigned char)c1 < (unsigned char)c2) return -1; \
if ((unsigned char)c1 > (unsigned char)c2) return 1; \
if ((UChar)c1 < (UChar)c2) return -1; \
if ((UChar)c1 > (UChar)c2) return 1; \
return 0; \
}

View File

@ -167,12 +167,12 @@ static inline void my_exit ( int x )
char* VG_REPLACE_FUNCTION_EZU(20010,soname,fnname)( const char* s, int c ); \
char* VG_REPLACE_FUNCTION_EZU(20010,soname,fnname)( const char* s, int c ) \
{ \
UChar ch = (UChar)((UInt)c); \
UChar* p = (UChar*)s; \
UChar* last = NULL; \
HChar ch = (HChar)c; \
const HChar* p = s; \
const HChar* last = NULL; \
while (True) { \
if (*p == ch) last = p; \
if (*p == 0) return last; \
if (*p == 0) return (HChar *)last; \
p++; \
} \
}
@ -203,10 +203,10 @@ static inline void my_exit ( int x )
char* VG_REPLACE_FUNCTION_EZU(20020,soname,fnname) ( const char* s, int c ); \
char* VG_REPLACE_FUNCTION_EZU(20020,soname,fnname) ( const char* s, int c ) \
{ \
UChar ch = (UChar)((UInt)c); \
UChar* p = (UChar*)s; \
HChar ch = (HChar)c ; \
const HChar* p = s; \
while (True) { \
if (*p == ch) return p; \
if (*p == ch) return (HChar *)p; \
if (*p == 0) return NULL; \
p++; \
} \
@ -242,8 +242,8 @@ static inline void my_exit ( int x )
char* VG_REPLACE_FUNCTION_EZU(20030,soname,fnname) \
( char* dst, const char* src ) \
{ \
const Char* src_orig = src; \
Char* dst_orig = dst; \
const HChar* src_orig = src; \
HChar* dst_orig = dst; \
while (*dst) dst++; \
while (*src) *dst++ = *src++; \
*dst = 0; \
@ -277,8 +277,8 @@ static inline void my_exit ( int x )
char* VG_REPLACE_FUNCTION_EZU(20040,soname,fnname) \
( char* dst, const char* src, SizeT n ) \
{ \
const Char* src_orig = src; \
Char* dst_orig = dst; \
const HChar* src_orig = src; \
HChar* dst_orig = dst; \
SizeT m = 0; \
\
while (*dst) dst++; \
@ -319,8 +319,8 @@ static inline void my_exit ( int x )
SizeT VG_REPLACE_FUNCTION_EZU(20050,soname,fnname) \
( char* dst, const char* src, SizeT n ) \
{ \
const Char* src_orig = src; \
Char* dst_orig = dst; \
const HChar* src_orig = src; \
HChar* dst_orig = dst; \
SizeT m = 0; \
\
while (m < n && *dst) { m++; dst++; } \
@ -417,8 +417,8 @@ static inline void my_exit ( int x )
char* VG_REPLACE_FUNCTION_EZU(20080,soname,fnname) \
( char* dst, const char* src ) \
{ \
const Char* src_orig = src; \
Char* dst_orig = dst; \
const HChar* src_orig = src; \
HChar* dst_orig = dst; \
\
while (*src) *dst++ = *src++; \
*dst = 0; \
@ -454,8 +454,8 @@ static inline void my_exit ( int x )
char* VG_REPLACE_FUNCTION_EZU(20090,soname,fnname) \
( char* dst, const char* src, SizeT n ) \
{ \
const Char* src_orig = src; \
Char* dst_orig = dst; \
const HChar* src_orig = src; \
HChar* dst_orig = dst; \
SizeT m = 0; \
\
while (m < n && *src) { m++; *dst++ = *src++; } \
@ -490,8 +490,8 @@ static inline void my_exit ( int x )
SizeT VG_REPLACE_FUNCTION_EZU(20100,soname,fnname) \
( char* dst, const char* src, SizeT n ) \
{ \
const char* src_orig = src; \
char* dst_orig = dst; \
const HChar* src_orig = src; \
HChar* dst_orig = dst; \
SizeT m = 0; \
\
while (m < n-1 && *src) { m++; *dst++ = *src++; } \
@ -536,8 +536,8 @@ static inline void my_exit ( int x )
if (*s1 == 0) return -1; \
if (*s2 == 0) return 1; \
\
if (*(unsigned char*)s1 < *(unsigned char*)s2) return -1; \
if (*(unsigned char*)s1 > *(unsigned char*)s2) return 1; \
if (*(UChar*)s1 < *(UChar*)s2) return -1; \
if (*(UChar*)s1 > *(UChar*)s2) return 1; \
\
s1++; s2++; n++; \
} \
@ -564,17 +564,17 @@ static inline void my_exit ( int x )
( const char* s1, const char* s2 ) \
{ \
extern int tolower(int); \
register unsigned char c1; \
register unsigned char c2; \
register UChar c1; \
register UChar c2; \
while (True) { \
c1 = tolower(*(unsigned char *)s1); \
c2 = tolower(*(unsigned char *)s2); \
c1 = tolower(*(UChar *)s1); \
c2 = tolower(*(UChar *)s2); \
if (c1 != c2) break; \
if (c1 == 0) break; \
s1++; s2++; \
} \
if ((unsigned char)c1 < (unsigned char)c2) return -1; \
if ((unsigned char)c1 > (unsigned char)c2) return 1; \
if ((UChar)c1 < (UChar)c2) return -1; \
if ((UChar)c1 > (UChar)c2) return 1; \
return 0; \
}
@ -606,10 +606,10 @@ static inline void my_exit ( int x )
if (*s1 == 0) return -1; \
if (*s2 == 0) return 1; \
\
if (tolower(*(unsigned char*)s1) \
< tolower(*(unsigned char*)s2)) return -1; \
if (tolower(*(unsigned char*)s1) \
> tolower(*(unsigned char*)s2)) return 1; \
if (tolower(*(UChar *)s1) \
< tolower(*(UChar*)s2)) return -1; \
if (tolower(*(UChar *)s1) \
> tolower(*(UChar *)s2)) return 1; \
\
s1++; s2++; n++; \
} \
@ -637,17 +637,17 @@ static inline void my_exit ( int x )
( const char* s1, const char* s2, void* locale ) \
{ \
extern int tolower_l(int, void*) __attribute__((weak)); \
register unsigned char c1; \
register unsigned char c2; \
register UChar c1; \
register UChar c2; \
while (True) { \
c1 = tolower_l(*(unsigned char *)s1, locale); \
c2 = tolower_l(*(unsigned char *)s2, locale); \
c1 = tolower_l(*(UChar *)s1, locale); \
c2 = tolower_l(*(UChar *)s2, locale); \
if (c1 != c2) break; \
if (c1 == 0) break; \
s1++; s2++; \
} \
if ((unsigned char)c1 < (unsigned char)c2) return -1; \
if ((unsigned char)c1 > (unsigned char)c2) return 1; \
if ((UChar)c1 < (UChar)c2) return -1; \
if ((UChar)c1 > (UChar)c2) return 1; \
return 0; \
}
@ -678,10 +678,10 @@ static inline void my_exit ( int x )
if (*s1 == 0) return -1; \
if (*s2 == 0) return 1; \
\
if (tolower_l(*(unsigned char*)s1, locale) \
< tolower_l(*(unsigned char*)s2, locale)) return -1; \
if (tolower_l(*(unsigned char*)s1, locale) \
> tolower_l(*(unsigned char*)s2, locale)) return 1; \
if (tolower_l(*(UChar *)s1, locale) \
< tolower_l(*(UChar *)s2, locale)) return -1; \
if (tolower_l(*(UChar *)s1, locale) \
> tolower_l(*(UChar *)s2, locale)) return 1; \
\
s1++; s2++; n++; \
} \
@ -707,17 +707,17 @@ static inline void my_exit ( int x )
int VG_REPLACE_FUNCTION_EZU(20160,soname,fnname) \
( const char* s1, const char* s2 ) \
{ \
register unsigned char c1; \
register unsigned char c2; \
register UChar c1; \
register UChar c2; \
while (True) { \
c1 = *(unsigned char *)s1; \
c2 = *(unsigned char *)s2; \
c1 = *(UChar *)s1; \
c2 = *(UChar *)s2; \
if (c1 != c2) break; \
if (c1 == 0) break; \
s1++; s2++; \
} \
if ((unsigned char)c1 < (unsigned char)c2) return -1; \
if ((unsigned char)c1 > (unsigned char)c2) return 1; \
if ((UChar)c1 < (UChar)c2) return -1; \
if ((UChar)c1 > (UChar)c2) return 1; \
return 0; \
}
@ -907,10 +907,10 @@ static inline void my_exit ( int x )
( const void *s1V, const void *s2V, SizeT n ) \
{ \
int res; \
unsigned char a0; \
unsigned char b0; \
unsigned char* s1 = (unsigned char*)s1V; \
unsigned char* s2 = (unsigned char*)s2V; \
UChar a0; \
UChar b0; \
UChar* s1 = (UChar*)s1V; \
UChar* s2 = (UChar*)s2V; \
\
while (n != 0) { \
a0 = s1[0]; \
@ -949,8 +949,8 @@ static inline void my_exit ( int x )
char* VG_REPLACE_FUNCTION_EZU(20200,soname,fnname) \
( char* dst, const char* src ) \
{ \
const Char* src_orig = src; \
Char* dst_orig = dst; \
const HChar* src_orig = src; \
HChar* dst_orig = dst; \
\
while (*src) *dst++ = *src++; \
*dst = 0; \
@ -1041,8 +1041,8 @@ static inline void my_exit ( int x )
(const void *srcV, void *dstV, SizeT n) \
{ \
SizeT i; \
Char* dst = (Char*)dstV; \
Char* src = (Char*)srcV; \
HChar* dst = dstV; \
const HChar* src = srcV; \
if (dst < src) { \
for (i = 0; i < n; i++) \
dst[i] = src[i]; \
@ -1074,8 +1074,8 @@ static inline void my_exit ( int x )
(void *dstV, const void *srcV, SizeT n, SizeT destlen) \
{ \
SizeT i; \
Char* dst = (Char*)dstV; \
Char* src = (Char*)srcV; \
HChar* dst = dstV; \
const HChar* src = srcV; \
if (destlen < n) \
goto badness; \
if (dst < src) { \
@ -1114,11 +1114,11 @@ static inline void my_exit ( int x )
char* VG_REPLACE_FUNCTION_EZU(20250,soname,fnname) \
(const char* s, int c_in) \
{ \
unsigned char c = (unsigned char) c_in; \
unsigned char* char_ptr = (unsigned char *)s; \
UChar c = (UChar) c_in; \
UChar* char_ptr = (UChar *)s; \
while (1) { \
if (*char_ptr == 0) return char_ptr; \
if (*char_ptr == c) return char_ptr; \
if (*char_ptr == 0) return (HChar *)char_ptr; \
if (*char_ptr == c) return (HChar *)char_ptr; \
char_ptr++; \
} \
}
@ -1140,10 +1140,10 @@ static inline void my_exit ( int x )
char* VG_REPLACE_FUNCTION_EZU(20260,soname,fnname) \
(const char* s, int c_in) \
{ \
unsigned char c = (unsigned char) c_in; \
unsigned char* char_ptr = (unsigned char *)s; \
UChar c = (UChar) c_in; \
UChar* char_ptr = (UChar *)s; \
while (1) { \
if (*char_ptr == c) return char_ptr; \
if (*char_ptr == c) return (HChar *)char_ptr; \
char_ptr++; \
} \
}
@ -1167,7 +1167,7 @@ static inline void my_exit ( int x )
char* VG_REPLACE_FUNCTION_EZU(20270,soname,fnname) \
(char* dst, const char* src, SizeT len) \
{ \
char* ret = dst; \
HChar* ret = dst; \
if (! len) \
goto badness; \
while ((*dst++ = *src++) != '\0') \
@ -1233,8 +1233,8 @@ static inline void my_exit ( int x )
void* VG_REPLACE_FUNCTION_EZU(20290,soname,fnname) \
( void *dst, const void *src, SizeT len ) \
{ \
register char *d; \
register char *s; \
register HChar *d; \
register HChar *s; \
SizeT len_saved = len; \
\
if (len == 0) \
@ -1277,8 +1277,8 @@ static inline void my_exit ( int x )
void* VG_REPLACE_FUNCTION_EZU(20300,soname,fnname) \
(void* dst, const void* src, SizeT len, SizeT dstlen ) \
{ \
register char *d; \
register char *s; \
register HChar *d; \
register const HChar *s; \
\
if (dstlen < len) goto badness; \
\
@ -1289,14 +1289,14 @@ static inline void my_exit ( int x )
RECORD_OVERLAP_ERROR("memcpy_chk", dst, src, len); \
\
if ( dst > src ) { \
d = (char *)dst + len - 1; \
s = (char *)src + len - 1; \
d = (HChar *)dst + len - 1; \
s = (const HChar *)src + len - 1; \
while ( len-- ) { \
*d-- = *s--; \
} \
} else if ( dst < src ) { \
d = (char *)dst; \
s = (char *)src; \
d = (HChar *)dst; \
s = (const HChar *)src; \
while ( len-- ) { \
*d++ = *s++; \
} \
@ -1322,26 +1322,26 @@ static inline void my_exit ( int x )
/*---------------------- strstr ----------------------*/
#define STRSTR(soname, fnname) \
void* VG_REPLACE_FUNCTION_EZU(20310,soname,fnname) \
(void* haystack, void* needle); \
void* VG_REPLACE_FUNCTION_EZU(20310,soname,fnname) \
(void* haystack, void* needle) \
char* VG_REPLACE_FUNCTION_EZU(20310,soname,fnname) \
(const char* haystack, const char* needle); \
char* VG_REPLACE_FUNCTION_EZU(20310,soname,fnname) \
(const char* haystack, const char* needle) \
{ \
UChar* h = (UChar*)haystack; \
UChar* n = (UChar*)needle; \
const HChar* h = haystack; \
const HChar* n = needle; \
\
/* find the length of n, not including terminating zero */ \
UWord nlen = 0; \
while (n[nlen]) nlen++; \
\
/* if n is the empty string, match immediately. */ \
if (nlen == 0) return h; \
if (nlen == 0) return (HChar *)h; \
\
/* assert(nlen >= 1); */ \
UChar n0 = n[0]; \
HChar n0 = n[0]; \
\
while (1) { \
UChar hh = *h; \
const HChar hh = *h; \
if (hh == 0) return NULL; \
if (hh != n0) { h++; continue; } \
\
@ -1352,7 +1352,7 @@ static inline void my_exit ( int x )
} \
/* assert(i >= 0 && i <= nlen); */ \
if (i == nlen) \
return h; \
return (HChar *)h; \
\
h++; \
} \
@ -1369,13 +1369,13 @@ static inline void my_exit ( int x )
/*---------------------- strpbrk ----------------------*/
#define STRPBRK(soname, fnname) \
void* VG_REPLACE_FUNCTION_EZU(20320,soname,fnname) \
(void* sV, void* acceptV); \
void* VG_REPLACE_FUNCTION_EZU(20320,soname,fnname) \
(void* sV, void* acceptV) \
char* VG_REPLACE_FUNCTION_EZU(20320,soname,fnname) \
(const char* sV, const char* acceptV); \
char* VG_REPLACE_FUNCTION_EZU(20320,soname,fnname) \
(const char* sV, const char* acceptV) \
{ \
UChar* s = (UChar*)sV; \
UChar* accept = (UChar*)acceptV; \
const HChar* s = sV; \
const HChar* accept = acceptV; \
\
/* find the length of 'accept', not including terminating zero */ \
UWord nacc = 0; \
@ -1387,12 +1387,12 @@ static inline void my_exit ( int x )
/* assert(nacc >= 1); */ \
while (1) { \
UWord i; \
UChar sc = *s; \
HChar sc = *s; \
if (sc == 0) \
break; \
for (i = 0; i < nacc; i++) { \
if (sc == accept[i]) \
return s; \
return (HChar *)s; \
} \
s++; \
} \
@ -1412,12 +1412,12 @@ static inline void my_exit ( int x )
#define STRCSPN(soname, fnname) \
SizeT VG_REPLACE_FUNCTION_EZU(20330,soname,fnname) \
(void* sV, void* rejectV); \
(const char* sV, const char* rejectV); \
SizeT VG_REPLACE_FUNCTION_EZU(20330,soname,fnname) \
(void* sV, void* rejectV) \
(const char* sV, const char* rejectV) \
{ \
UChar* s = (UChar*)sV; \
UChar* reject = (UChar*)rejectV; \
const HChar* s = sV; \
const HChar* reject = rejectV; \
\
/* find the length of 'reject', not including terminating zero */ \
UWord nrej = 0; \
@ -1426,7 +1426,7 @@ static inline void my_exit ( int x )
UWord len = 0; \
while (1) { \
UWord i; \
UChar sc = *s; \
HChar sc = *s; \
if (sc == 0) \
break; \
for (i = 0; i < nrej; i++) { \
@ -1455,9 +1455,9 @@ static inline void my_exit ( int x )
#define STRSPN(soname, fnname) \
SizeT VG_REPLACE_FUNCTION_EZU(20340,soname,fnname) \
(void* sV, void* acceptV); \
(const char* sV, const char* acceptV); \
SizeT VG_REPLACE_FUNCTION_EZU(20340,soname,fnname) \
(void* sV, void* acceptV) \
(const char* sV, const char* acceptV) \
{ \
UChar* s = (UChar*)sV; \
UChar* accept = (UChar*)acceptV; \
@ -1470,7 +1470,7 @@ static inline void my_exit ( int x )
UWord len = 0; \
while (1) { \
UWord i; \
UChar sc = *s; \
HChar sc = *s; \
if (sc == 0) \
break; \
for (i = 0; i < nacc; i++) { \
@ -1498,21 +1498,21 @@ static inline void my_exit ( int x )
/*---------------------- strcasestr ----------------------*/
#define STRCASESTR(soname, fnname) \
void* VG_REPLACE_FUNCTION_EZU(20350,soname,fnname) \
(void* haystack, void* needle); \
void* VG_REPLACE_FUNCTION_EZU(20350,soname,fnname) \
(void* haystack, void* needle) \
char* VG_REPLACE_FUNCTION_EZU(20350,soname,fnname) \
(const char* haystack, const char* needle); \
char* VG_REPLACE_FUNCTION_EZU(20350,soname,fnname) \
(const char* haystack, const char* needle) \
{ \
extern int tolower(int); \
UChar* h = (UChar*)haystack; \
UChar* n = (UChar*)needle; \
const HChar* h = haystack; \
const HChar* n = needle; \
\
/* find the length of n, not including terminating zero */ \
UWord nlen = 0; \
while (n[nlen]) nlen++; \
\
/* if n is the empty string, match immediately. */ \
if (nlen == 0) return h; \
if (nlen == 0) return (HChar *)h; \
\
/* assert(nlen >= 1); */ \
UChar n0 = tolower(n[0]); \
@ -1529,7 +1529,7 @@ static inline void my_exit ( int x )
} \
/* assert(i >= 0 && i <= nlen); */ \
if (i == nlen) \
return h; \
return (HChar *)h; \
\
h++; \
} \
@ -1588,7 +1588,7 @@ int VG_WRAP_FUNCTION_ZU(VG_Z_LIBC_SONAME, putenv) (char* string)
{
OrigFn fn;
Word result;
const char* p = string;
const HChar* p = string;
VALGRIND_GET_ORIG_FN(fn);
/* Now by walking over the string we magically produce
traces when hitting undefined memory. */
@ -1607,7 +1607,7 @@ int VG_WRAP_FUNCTION_ZU(VG_Z_LIBC_SONAME, unsetenv) (const char* name)
{
OrigFn fn;
Word result;
const char* p = name;
const HChar* p = name;
VALGRIND_GET_ORIG_FN(fn);
/* Now by walking over the string we magically produce
traces when hitting undefined memory. */
@ -1629,7 +1629,7 @@ int VG_WRAP_FUNCTION_ZU(VG_Z_LIBC_SONAME, setenv)
{
OrigFn fn;
Word result;
const char* p;
const HChar* p;
VALGRIND_GET_ORIG_FN(fn);
/* Now by walking over the string we magically produce
traces when hitting undefined memory. */

View File

@ -406,7 +406,7 @@ int main ( void )
{
UInt n, op;
ULong carrydep, c, res;
UChar* block;
char* block;
ULong reg;
Word bitoff;

View File

@ -6,7 +6,7 @@ int main(void)
{
struct sockaddr name;
int res1, res2, res3;
int len = 10;
unsigned len = 10;
res1 = socket(PF_UNIX, SOCK_STREAM, 0);
if (res1 == 0) {

View File

@ -302,9 +302,9 @@ void test_strtoll_and_strtod(void)
{
// For VG_(strtoll*)()
typedef struct {
Char* str; // The string to convert.
Long res; // The result.
Char endptr_val; // The char one past the end of the converted text.
HChar* str; // The string to convert.
Long res; // The result.
HChar endptr_val; // The char one past the end of the converted text.
} StrtollInputs;
// VG_(strtoll10)()

View File

@ -52,7 +52,7 @@ void server (void)
{
int x;
int baddrsize = 0;
unsigned baddrsize = 0;
struct sockaddr_un baddr;
struct msghdr msg = {NULL, 0, NULL, 0, 0, 0, 0};
struct cmsghdr *cmsg;

View File

@ -249,9 +249,10 @@ main(int argc, char **argv)
{
SHA1_CTX ctx;
unsigned char hash[20];
unsigned char abc[] = "abc";
SHA1Init(&ctx);
SHA1Update(&ctx, "abc", 3);
SHA1Update(&ctx, abc, 3);
SHA1Final(hash, &ctx);
return 0;
}

View File

@ -30,4 +30,4 @@ bz2_CFLAGS = $(AM_CFLAGS) -Wno-inline
fbench_CFLAGS = $(AM_CFLAGS) -O2
ffbench_LDADD = -lm
tinycc_CFLAGS = $(AM_CFLAGS) -Wno-shadow -Wno-inline
tinycc_CFLAGS = $(AM_CFLAGS) -Wno-shadow -Wno-inline -Wno-pointer-sign