]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fix a few casts that dropped type qualifiers. As pointed out by
authorFlorian Krohm <florian@eich-krohm.de>
Thu, 18 Sep 2014 18:35:47 +0000 (18:35 +0000)
committerFlorian Krohm <florian@eich-krohm.de>
Thu, 18 Sep 2014 18:35:47 +0000 (18:35 +0000)
-Wcast-qual.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14554

coregrind/m_debuginfo/image.c
coregrind/m_debuginfo/storage.c
coregrind/m_deduppoolalloc.c
coregrind/m_scheduler/scheduler.c
coregrind/m_syswrap/syswrap-generic.c
coregrind/pub_core_dispatch.h
helgrind/hg_intercepts.c

index dfe077fd457186849ef7b5310bad82021f693d3e..a289f441b1208ff4d77ad6a36e6f80f519e4b005 100644 (file)
@@ -877,7 +877,7 @@ Int ML_(img_strcmp_c)(DiImage* img, DiOffT off1, const HChar* str2)
    ensure_valid(img, off1, 1, "ML_(img_strcmp_c)");
    while (True) {
       UChar c1 = get(img, off1);
-      UChar c2 = *(UChar*)str2;
+      UChar c2 = *(const UChar*)str2;
       if (c1 < c2) return -1;
       if (c1 > c2) return 1;
       if (c1 == 0) return 0;
index 3d8a13f0cb504e074d984f07e1da2b655d223bb3..ab570be4a39c11b5ab8a5b53dc103a9494444998 100644 (file)
@@ -1858,8 +1858,8 @@ static void canonicaliseSymtab ( struct _DebugInfo* di )
 static DiLoc* sorting_loctab = NULL;
 static Int compare_DiLoc_via_ix ( const void* va, const void* vb ) 
 {
-   const DiLoc* a = &sorting_loctab[*(UInt*)va];
-   const DiLoc* b = &sorting_loctab[*(UInt*)vb];
+   const DiLoc* a = &sorting_loctab[*(const UInt*)va];
+   const DiLoc* b = &sorting_loctab[*(const UInt*)vb];
    if (a->addr < b->addr) return -1;
    if (a->addr > b->addr) return  1;
    return 0;
index 916f7e8263403fbe54edeceb4d1000d8eb4f1129..53d68535e74fae6b5437449ddbee74a277afa49e 100644 (file)
@@ -249,10 +249,10 @@ void* VG_(allocEltDedupPA) (DedupPoolAlloc *ddpa, SizeT eltSzB, const void *elt)
    // (A lot can be 10% of the elements colliding, even on
    // small nr of elements such as 10_000).
    ht_elt.key = VG_(adler32) (0, NULL, 0);
-   ht_elt.key = VG_(adler32) (ht_elt.key, (UChar*)elt, eltSzB);
+   ht_elt.key = VG_(adler32) (ht_elt.key, elt, eltSzB);
 
    ht_elt.eltSzB = eltSzB;
-   ht_elt.elt = (UChar*) elt;
+   ht_elt.elt = (void *)elt;
 
    ht_ins = VG_(HT_gen_lookup) (ddpa->ht_elements, &ht_elt, cmp_pool_elt);
    if (ht_ins)
@@ -282,9 +282,9 @@ void* VG_(allocEltDedupPA) (DedupPoolAlloc *ddpa, SizeT eltSzB, const void *elt)
 static __inline__
 UInt elt2nr (DedupPoolAlloc *ddpa, const void *dedup_elt)
 {
-   vg_assert ((UChar*)dedup_elt >= ddpa->curpool
-              && (UChar*)dedup_elt < ddpa->curpool_free);
-   return 1 + ((UChar*)dedup_elt - ddpa->curpool)
+   vg_assert (dedup_elt >= (const void *)ddpa->curpool
+              && dedup_elt < (const void *)ddpa->curpool_free);
+   return 1 + ((const UChar*)dedup_elt - (const UChar *)ddpa->curpool)
       / VG_ROUNDUP(ddpa->fixedSzb, ddpa->eltAlign);
 }
 
index 14d340ae0d6ab404f8e20814d51bc43fe332b0c4..342fbe6bb8f929995f5644131d7b8c5cb0351d1d 100644 (file)
@@ -696,7 +696,7 @@ void VG_(scheduler_init_phase2) ( ThreadId tid_main,
    guest state, its two copies, and the spill area.  In short, all 4
    areas must have a 16-aligned size and be 16-aligned, and placed
    back-to-back. */
-static void do_pre_run_checks ( ThreadState* tst )
+static void do_pre_run_checks ( volatile ThreadState* tst )
 {
    Addr a_vex     = (Addr) & tst->arch.vex;
    Addr a_vexsh1  = (Addr) & tst->arch.vex_shadow1;
@@ -859,7 +859,7 @@ void run_thread_for_a_while ( /*OUT*/HWord* two_words,
    vg_assert(*dispatchCtrP > 0);
 
    tst = VG_(get_ThreadState)(tid);
-   do_pre_run_checks( (ThreadState*)tst );
+   do_pre_run_checks( tst );
    /* end Paranoia */
 
    /* Futz with the XIndir stats counters. */
@@ -934,7 +934,7 @@ void run_thread_for_a_while ( /*OUT*/HWord* two_words,
       jumped, 
       VG_(disp_run_translations)( 
          two_words,
-         (void*)&tst->arch.vex,
+         (volatile void*)&tst->arch.vex,
          host_code_addr
       )
    );
index 44564aea457d96ff3ecd5cd5b374a543b2684a3d..79d9320f857e88a55d216cd45698f54776995c41 100644 (file)
@@ -673,7 +673,8 @@ void inet6_format(HChar *s, const UChar ip[16])
    static const unsigned char V4mappedprefix[12] = {0,0,0,0,0,0,0,0,0,0,0xff,0xff};
 
    if (!VG_(memcmp)(ip, V4mappedprefix, 12)) {
-      struct vki_in_addr *sin_addr = (struct vki_in_addr *)(ip + 12);
+      const struct vki_in_addr *sin_addr =
+          (const struct vki_in_addr *)(ip + 12);
       UInt addr = VG_(ntohl)(sin_addr->s_addr);
 
       VG_(sprintf)(s, "::ffff:%u.%u.%u.%u",
index 1193fad68c46c91a82fa92f9ed8bee46d79f56c7..9e08e9d46a47ef05d8f6ccca591ba532bdee32c7 100644 (file)
@@ -62,7 +62,7 @@
    where we have to return a chain-me request.
 */
 void VG_(disp_run_translations)( HWord* two_words,
-                                 void*  guest_state, 
+                                 volatile void*  guest_state, 
                                  Addr   host_addr );
 
 /* We need to know addresses of the continuation-point (cp_) labels so
index 71bd40288b24892ef8b1500ee2af042d47b6b041..fb9963a4760cc6fa8fc74ba5430bc66cfc542d5d 100644 (file)
 __attribute__((noinline))
 static int my_memcmp ( const void* ptr1, const void* ptr2, size_t size)
 {
-   unsigned char* uchar_ptr1 = (unsigned char*) ptr1;
-   unsigned char* uchar_ptr2 = (unsigned char*) ptr2;
+   const unsigned char* uchar_ptr1 = (const unsigned char*) ptr1;
+   const unsigned char* uchar_ptr2 = (const unsigned char*) ptr2;
    size_t i;
    for (i = 0; i < size; ++i) {
       if (uchar_ptr1[i] != uchar_ptr2[i])