|
From: <sv...@va...> - 2012-11-18 00:36:33
|
florian 2012-11-18 00:36:15 +0000 (Sun, 18 Nov 2012)
New Revision: 13125
Log:
Final patch for Char/HChar mixups.
Remove -Wno-pointer-sign from configure.in.
Fixes 273227.
Modified files:
trunk/callgrind/bbcc.c
trunk/configure.in
trunk/coregrind/m_libcproc.c
trunk/exp-sgcheck/h_intercepts.c
trunk/helgrind/hg_intercepts.c
trunk/memcheck/mc_replace_strmem.c
trunk/memcheck/tests/amd64/bt_everything.c
trunk/memcheck/tests/buflen_check.c
trunk/memcheck/tests/unit_libcbase.c
trunk/none/tests/fdleak_cmsg.c
trunk/none/tests/sha1_test.c
trunk/perf/Makefile.am
Modified: trunk/none/tests/fdleak_cmsg.c (+1 -1)
===================================================================
--- trunk/none/tests/fdleak_cmsg.c 2012-11-16 19:41:21 +00:00 (rev 13124)
+++ trunk/none/tests/fdleak_cmsg.c 2012-11-18 00:36:15 +00:00 (rev 13125)
@@ -52,7 +52,7 @@
{
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;
Modified: trunk/perf/Makefile.am (+1 -1)
===================================================================
--- trunk/perf/Makefile.am 2012-11-16 19:41:21 +00:00 (rev 13124)
+++ trunk/perf/Makefile.am 2012-11-18 00:36:15 +00:00 (rev 13125)
@@ -30,4 +30,4 @@
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
Modified: trunk/memcheck/tests/amd64/bt_everything.c (+1 -1)
===================================================================
--- trunk/memcheck/tests/amd64/bt_everything.c 2012-11-16 19:41:21 +00:00 (rev 13124)
+++ trunk/memcheck/tests/amd64/bt_everything.c 2012-11-18 00:36:15 +00:00 (rev 13125)
@@ -406,7 +406,7 @@
{
UInt n, op;
ULong carrydep, c, res;
- UChar* block;
+ char* block;
ULong reg;
Word bitoff;
Modified: trunk/exp-sgcheck/h_intercepts.c (+37 -37)
===================================================================
--- trunk/exp-sgcheck/h_intercepts.c 2012-11-16 19:41:21 +00:00 (rev 13124)
+++ trunk/exp-sgcheck/h_intercepts.c 2012-11-18 00:36:15 +00:00 (rev 13125)
@@ -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 @@
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 @@
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 @@
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 @@
/* 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 @@
#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 @@
} \
/* assert(i >= 0 && i <= nlen); */ \
if (i == nlen) \
- return h; \
+ return (HChar *)h; \
\
h++; \
} \
@@ -385,13 +385,13 @@
#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 @@
/* 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++; \
} \
Modified: trunk/configure.in (+0 -22)
===================================================================
--- trunk/configure.in 2012-11-16 19:41:21 +00:00 (rev 13124)
+++ trunk/configure.in 2012-11-18 00:36:15 +00:00 (rev 13125)
@@ -1397,28 +1397,6 @@
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])
Modified: trunk/callgrind/bbcc.c (+2 -1)
===================================================================
--- trunk/callgrind/bbcc.c 2012-11-16 19:41:21 +00:00 (rev 13124)
+++ trunk/callgrind/bbcc.c 2012-11-18 00:36:15 +00:00 (rev 13125)
@@ -484,7 +484,8 @@
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");
Modified: trunk/memcheck/tests/buflen_check.c (+1 -1)
===================================================================
--- trunk/memcheck/tests/buflen_check.c 2012-11-16 19:41:21 +00:00 (rev 13124)
+++ trunk/memcheck/tests/buflen_check.c 2012-11-18 00:36:15 +00:00 (rev 13125)
@@ -6,7 +6,7 @@
{
struct sockaddr name;
int res1, res2, res3;
- int len = 10;
+ unsigned len = 10;
res1 = socket(PF_UNIX, SOCK_STREAM, 0);
if (res1 == 0) {
Modified: trunk/none/tests/sha1_test.c (+2 -1)
===================================================================
--- trunk/none/tests/sha1_test.c 2012-11-16 19:41:21 +00:00 (rev 13124)
+++ trunk/none/tests/sha1_test.c 2012-11-18 00:36:15 +00:00 (rev 13125)
@@ -249,9 +249,10 @@
{
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;
}
Modified: trunk/coregrind/m_libcproc.c (+2 -2)
===================================================================
--- trunk/coregrind/m_libcproc.c 2012-11-16 19:41:21 +00:00 (rev 13124)
+++ trunk/coregrind/m_libcproc.c 2012-11-18 00:36:15 +00:00 (rev 13125)
@@ -354,9 +354,9 @@
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 */
Modified: trunk/memcheck/tests/unit_libcbase.c (+3 -3)
===================================================================
--- trunk/memcheck/tests/unit_libcbase.c 2012-11-16 19:41:21 +00:00 (rev 13124)
+++ trunk/memcheck/tests/unit_libcbase.c 2012-11-18 00:36:15 +00:00 (rev 13125)
@@ -302,9 +302,9 @@
{
// 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)()
Modified: trunk/memcheck/mc_replace_strmem.c (+110 -110)
===================================================================
--- trunk/memcheck/mc_replace_strmem.c 2012-11-16 19:41:21 +00:00 (rev 13124)
+++ trunk/memcheck/mc_replace_strmem.c 2012-11-18 00:36:15 +00:00 (rev 13125)
@@ -167,12 +167,12 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
( 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 @@
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 @@
( 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 @@
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 @@
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 @@
( 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 @@
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 @@
(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 @@
(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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
/*---------------------- 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 @@
} \
/* assert(i >= 0 && i <= nlen); */ \
if (i == nlen) \
- return h; \
+ return (HChar *)h; \
\
h++; \
} \
@@ -1369,13 +1369,13 @@
/*---------------------- 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 @@
/* 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 @@
#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 @@
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 @@
#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 @@
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 @@
/*---------------------- 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 @@
} \
/* assert(i >= 0 && i <= nlen); */ \
if (i == nlen) \
- return h; \
+ return (HChar *)h; \
\
h++; \
} \
@@ -1588,7 +1588,7 @@
{
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 @@
{
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 @@
{
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. */
Modified: trunk/helgrind/hg_intercepts.c (+13 -13)
===================================================================
--- trunk/helgrind/hg_intercepts.c 2012-11-16 19:41:21 +00:00 (rev 13124)
+++ trunk/helgrind/hg_intercepts.c 2012-11-18 00:36:15 +00:00 (rev 13125)
@@ -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 @@
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 @@
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 @@
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; \
}
|