]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
More typechecker police. Hopefully this doesn't break anything.
authorJulian Seward <jseward@acm.org>
Mon, 7 Feb 2005 03:11:17 +0000 (03:11 +0000)
committerJulian Seward <jseward@acm.org>
Mon, 7 Feb 2005 03:11:17 +0000 (03:11 +0000)
git-svn-id: svn://svn.valgrind.org/vex/trunk@861

16 files changed:
VEX/priv/guest-amd64/gdefs.h
VEX/priv/guest-amd64/ghelpers.c
VEX/priv/guest-arm/gdefs.h
VEX/priv/guest-arm/ghelpers.c
VEX/priv/guest-ppc32/gdefs.h
VEX/priv/guest-ppc32/ghelpers.c
VEX/priv/guest-x86/gdefs.h
VEX/priv/guest-x86/ghelpers.c
VEX/priv/host-generic/h_generic_regs.h
VEX/priv/main/vex_globals.c
VEX/priv/main/vex_globals.h
VEX/priv/main/vex_util.c
VEX/priv/main/vex_util.h
VEX/pub/libvex.h
VEX/pub/libvex_basictypes.h
VEX/test_main.c

index 568444fd3ae6ec04d8ef41ceae38dd40c65ba109..4763aa0dfa293c66448d01ad68669746d2cacf8c 100644 (file)
@@ -54,7 +54,7 @@ IRBB* bbToIR_AMD64 ( UChar*           amd64code,
 
 /* Used by the optimiser to specialise calls to helpers. */
 extern
-IRExpr* guest_amd64_spechelper ( Char* function_name,
+IRExpr* guest_amd64_spechelper ( HChar* function_name,
                                  IRExpr** args );
 
 /* Describes to the optimiser which part of the guest state require
index 1c15a3e474a903ccbdaa921d5c1e38a3a04c9ab2..7ea8c013b7d7426168bbd23511bde759b358b8f2 100644 (file)
@@ -73,7 +73,7 @@ ULong amd64g_calculate_condition (
 }
 
 
-IRExpr* guest_amd64_spechelper ( Char* function_name,
+IRExpr* guest_amd64_spechelper ( HChar* function_name,
                                  IRExpr** args )
 {
   return NULL;
index 7377fcf8279b75e721d739138117f395aa6e1c22..101e69eb0604ae5d25384673bcf4c62e5da0d494 100644 (file)
@@ -55,7 +55,7 @@ IRBB* bbToIR_ARM ( UChar*           armCode,
 
 /* Used by the optimiser to specialise calls to helpers. */
 extern
-IRExpr* guest_arm_spechelper ( Char* function_name,
+IRExpr* guest_arm_spechelper ( HChar* function_name,
                                IRExpr** args );
 
 /* Describes to the optimser which part of the guest state require
index 9c5ea4ce562313aa66b99bff644b0a7d770f606c..de19f2d90517c289c5571ed7be8c561efd63a661 100644 (file)
@@ -296,7 +296,7 @@ static Bool isU32 ( IRExpr* e, UInt n )
           && e->Iex.Const.con->Ico.U32 == n;
 }
 #endif
-IRExpr* guest_arm_spechelper ( Char* function_name,
+IRExpr* guest_arm_spechelper ( HChar* function_name,
                                IRExpr** args )
 {
    return NULL;
index 5f4887e644fbe2a8c757c24407d11b947085d3e5..188ee4c9cb2b0fba57436971212b44524772c245 100644 (file)
@@ -55,8 +55,8 @@ IRBB* bbToIR_PPC32 ( UChar*           ppc32code,
 
 /* Used by the optimiser to specialise calls to helpers. */
 extern
-IRExpr* guest_ppc32_spechelper ( Char* function_name,
-                               IRExpr** args );
+IRExpr* guest_ppc32_spechelper ( HChar* function_name,
+                                 IRExpr** args );
 
 /* Describes to the optimser which part of the guest state require
    precise memory exceptions.  This is logically part of the guest
index b30f117a45a4a2fc35965c86cb274ae95007124b..efc8f2d26826200314722005c8509ec7cfd322bb 100644 (file)
@@ -187,8 +187,8 @@ static Bool isU32 ( IRExpr* e, UInt n )
           && e->Iex.Const.con->Ico.U32 == n;
 }
 #endif
-IRExpr* guest_ppc32_spechelper ( Char* function_name,
-                               IRExpr** args )
+IRExpr* guest_ppc32_spechelper ( HChar* function_name,
+                                 IRExpr** args )
 {
    return NULL;
 }
index 413881c0cd274986d254de3a89876b0be8fc976a..c69835328310b73f92a65ea6c2316d8c1f4d44bf 100644 (file)
@@ -57,7 +57,7 @@ IRBB* bbToIR_X86 ( UChar*           x86code,
 
 /* Used by the optimiser to specialise calls to helpers. */
 extern
-IRExpr* guest_x86_spechelper ( Char* function_name,
+IRExpr* guest_x86_spechelper ( HChar* function_name,
                                IRExpr** args );
 
 /* Describes to the optimser which part of the guest state require
index 3cb86bfabe831c162da35f0828ca3c85f74506a5..c3ba8ea7e2da9d3bbc27fc47eae7976145a4c43b 100644 (file)
@@ -730,7 +730,7 @@ static Bool isU32 ( IRExpr* e, UInt n )
           && e->Iex.Const.con->Ico.U32 == n;
 }
 
-IRExpr* guest_x86_spechelper ( Char* function_name,
+IRExpr* guest_x86_spechelper ( HChar* function_name,
                                IRExpr** args )
 {
 #  define unop(_op,_a1) IRExpr_Unop((_op),(_a1))
index e41c9c4306906eb5c236982635593e30539cce0e..fb92bbb1eda81e742d2dbd10a42bf73a83c800d1 100644 (file)
@@ -122,7 +122,7 @@ static inline UInt hregNumber ( HReg r ) {
 }
 
 static inline Bool hregIsVirtual ( HReg r ) {
-   return (((UInt)r) & (1<<24)) ? True : False;
+   return toBool(((UInt)r) & (1<<24));
 }
 
 
index a5141aa2ca43382219f35a39e1217517cf414625..4cd1a75fb32333771f7edc8d9cfd96cb5346e105 100644 (file)
@@ -50,7 +50,7 @@ __attribute__ ((noreturn))
 void (*vex_failure_exit) ( void ) = NULL;
 
 /* logging output function */
-void (*vex_log_bytes) ( Char*, Int nbytes ) = NULL;
+void (*vex_log_bytes) ( HChar*, Int nbytes ) = NULL;
 
 /* debug paranoia level */
 Int vex_debuglevel = 0;
index 50c211239fe7df2c851648b348f834d6a2b076e9..a31a29655a1c1da88e5d84c395c28ea3f4931832 100644 (file)
@@ -51,7 +51,7 @@ __attribute__ ((noreturn))
 extern void (*vex_failure_exit) ( void );
 
 /* logging output function */
-extern void (*vex_log_bytes) ( Char*, Int nbytes );
+extern void (*vex_log_bytes) ( HChar*, Int nbytes );
 
 /* debug paranoia level */
 extern Int vex_debuglevel;
index 3cac891ad22e3c5bff286d7cba9a4ccc93177d8e..70f3386962457677db85873fbe6bffb7489787e2 100644 (file)
@@ -92,7 +92,7 @@ void* LibVEX_Alloc ( Int nbytes )
    vassert(vex_initdone);
    vassert(nbytes >= 0);
    if (vex_valgrind_support) {
-      /* ugly hack */
+      /* ugly hack -- do not remove */
       extern void* malloc ( int );
       return malloc(nbytes);
    } else {
@@ -144,8 +144,8 @@ void LibVEX_ShowAllocStats ( void )
 /*---------------------------------------------------------*/
 
 __attribute__ ((noreturn))
-void vex_assert_fail ( const Char* expr,
-                       const Char* file, Int line, const Char* fn )
+void vex_assert_fail ( const HChar* expr,
+                       const HChar* file, Int line, const HChar* fn )
 {
    vex_printf( "\nvex: %s:%d (%s): Assertion `%s' failed.\n",
                file, line, fn, expr );
@@ -180,22 +180,22 @@ void vpanic ( HChar* str )
    (Checker itself was GPL'd.)
    ------------------------------------------------------------------ */
 
-static Char vex_toupper ( Char c )
+static HChar vex_toupper ( HChar c )
 {
    if (c >= 'a' && c <= 'z')
-      return c + ('A' - 'a');
+      return toHChar(c + ('A' - 'a'));
    else
       return c;
 }
 
-static Int vex_strlen ( const Char* str )
+static Int vex_strlen ( const HChar* str )
 {
    Int i = 0;
    while (str[i] != 0) i++;
    return i;
 }
 
-Bool vex_streq ( const Char* s1, const Char* s2 )
+Bool vex_streq ( const HChar* s1, const HChar* s2 )
 {
    while (True) {
       if (*s1 == 0 && *s2 == 0)
@@ -216,10 +216,10 @@ Bool vex_streq ( const Char* s1, const Char* s2 )
 
 /* Copy a string into the buffer. */
 static UInt
-myvprintf_str ( void(*send)(Char), Int flags, Int width, Char* str, 
+myvprintf_str ( void(*send)(HChar), Int flags, Int width, HChar* str, 
                 Bool capitalise )
 {
-#  define MAYBE_TOUPPER(ch) (capitalise ? vex_toupper(ch) : (ch))
+#  define MAYBE_TOUPPER(ch) toHChar(capitalise ? vex_toupper(ch) : (ch))
    UInt ret = 0;
    Int i, extra;
    Int len = vex_strlen(str);
@@ -265,14 +265,14 @@ myvprintf_str ( void(*send)(Char), Int flags, Int width, Char* str,
  *  WIDTH is the width of the field.
  */
 static UInt
-myvprintf_int64 ( void(*send)(Char), Int flags, Int base, Int width, ULong p)
+myvprintf_int64 ( void(*send)(HChar), Int flags, Int base, Int width, ULong p)
 {
-   Char buf[40];
-   Int  ind = 0;
-   Int  i, nc = 0;
-   Bool neg = False;
-   Char *digits = "0123456789ABCDEF";
-   UInt ret = 0;
+   HChar buf[40];
+   Int   ind = 0;
+   Int   i, nc = 0;
+   Bool  neg = False;
+   HChar *digits = "0123456789ABCDEF";
+   UInt  ret = 0;
 
    if (base < 2 || base > 16)
       return ret;
@@ -303,7 +303,7 @@ myvprintf_int64 ( void(*send)(Char), Int flags, Int base, Int width, ULong p)
    if (width > 0 && !(flags & VG_MSG_LJUSTIFY)) {
       for(; ind < width; ind++) {
          vassert(ind < 39);
-         buf[ind] = (flags & VG_MSG_ZJUSTIFY) ? '0': ' ';
+         buf[ind] = toHChar((flags & VG_MSG_ZJUSTIFY) ? '0': ' ');
       }
    }
 
@@ -324,7 +324,7 @@ myvprintf_int64 ( void(*send)(Char), Int flags, Int base, Int width, ULong p)
 
 /* A simple vprintf().  */
 static 
-UInt vprintf_wrk ( void(*send)(Char), const Char *format, va_list vargs )
+UInt vprintf_wrk ( void(*send)(HChar), const HChar *format, va_list vargs )
 {
    UInt ret = 0;
    int i;
@@ -420,12 +420,13 @@ UInt vprintf_wrk ( void(*send)(Char), const Char *format, va_list vargs )
             break;
          case 'c': /* %c */
            ret++;
-            send(va_arg (vargs, int));
+            send(toHChar(va_arg (vargs, int)));
             break;
          case 's': case 'S': { /* %s */
             char *str = va_arg (vargs, char *);
             if (str == (char*) 0) str = "(null)";
-            ret += myvprintf_str(send, flags, width, str, format[i]=='S');
+            ret += myvprintf_str(send, flags, width, str, 
+                                 toBool(format[i]=='S'));
             break;
         }
 #        if 0
@@ -459,10 +460,10 @@ UInt vprintf_wrk ( void(*send)(Char), const Char *format, va_list vargs )
    debugging info should be sent via here.  The official route is to
    to use vg_message().  This interface is deprecated.
 */
-static Char myprintf_buf[1000];
-static Int  n_myprintf_buf;
+static HChar myprintf_buf[1000];
+static Int   n_myprintf_buf;
 
-static void add_to_myprintf_buf ( Char c )
+static void add_to_myprintf_buf ( HChar c )
 {
    if (c == '\n' || n_myprintf_buf >= 1000-10 /*paranoia*/ ) {
       (*vex_log_bytes)( myprintf_buf, vex_strlen(myprintf_buf) );
@@ -495,9 +496,9 @@ UInt vex_printf ( const char *format, ... )
 
 /* A general replacement for sprintf(). */
 
-static Char *vg_sprintf_ptr;
+static HChar *vg_sprintf_ptr;
 
-static void add_to_vg_sprintf_buf ( Char c )
+static void add_to_vg_sprintf_buf ( HChar c )
 {
    *vg_sprintf_ptr++ = c;
 }
index 22d1e9543cd0725f71a8fd7f9e48e7ef76d64c49..c71e12cc144a9c3475888c5123d030de6be092f6 100644 (file)
@@ -55,8 +55,8 @@
                              __PRETTY_FUNCTION__), 0)))
 
 __attribute__ ((__noreturn__))
-extern void vex_assert_fail ( const Char* expr, const Char* file,
-                              Int line, const Char* fn );
+extern void vex_assert_fail ( const HChar* expr, const HChar* file,
+                              Int line, const HChar* fn );
 __attribute__ ((__noreturn__))
 extern void vpanic ( HChar* str );
 
@@ -72,7 +72,7 @@ extern UInt vex_sprintf ( HChar* buf, const HChar *format, ... );
 
 /* String ops */
 
-extern Bool vex_streq ( const Char* s1, const Char* s2 );
+extern Bool vex_streq ( const HChar* s1, const HChar* s2 );
 
 
 /* Storage management: clear the area, and allocate from it. */
index 54159cbd600c6ed12b94a6aa88d0d2405ef9daf1..97709397ab08b8c91416df730c5912c879124269 100644 (file)
@@ -203,7 +203,7 @@ extern void LibVEX_Init (
    __attribute__ ((noreturn))
    void (*failure_exit) ( void ),
    /* logging output function */
-   void (*log_bytes) ( Char*, Int nbytes ),
+   void (*log_bytes) ( HChar*, Int nbytes ),
    /* debug paranoia level */
    Int debuglevel,
    /* Are we supporting valgrind checking? */
index ab08ea06af9db5ff225e26bfda32fc62f98cb99f..ce8182be4d4ca0c969432462a0e284d628cf1945 100644 (file)
@@ -82,6 +82,10 @@ static inline UChar toUChar ( Int x ) {
    x &= 0xFF;
    return (UChar)x;
 }
+static inline HChar toHChar ( Int x ) {
+   x &= 0xFF;
+   return (HChar)x;
+}
 static inline UShort toUShort ( Int x ) {
    x &= 0xFFFF;
    return (UShort)x;
index 449c4c33e3667c0aa707495bbc6bb56c019d781c..e7c23b5845beacae94e6008f65c78ab67331892a 100644 (file)
@@ -31,7 +31,7 @@ void failure_exit ( void )
 }
 
 static
-void log_bytes ( Char* bytes, Int nbytes )
+void log_bytes ( HChar* bytes, Int nbytes )
 {
    fwrite ( bytes, 1, nbytes, stdout );
 }