[libcxxabi] r238945 - fallback_malloc: silence conversion warning (NFC)

Saleem Abdulrasool compnerd at compnerd.org
Wed Jun 3 10:25:36 PDT 2015


Author: compnerd
Date: Wed Jun  3 12:25:35 2015
New Revision: 238945

URL: http://llvm.org/viewvc/llvm-project?rev=238945&view=rev
Log:
fallback_malloc: silence conversion warning (NFC)

This silences some conversion warnings from GCC 4.9.2.  Simply casting the RHS
doesn't seem to be sufficient to silence the warning.  Convert the operation
equal operator usage to calculation and assignment.

Modified:
    libcxxabi/trunk/src/fallback_malloc.ipp

Modified: libcxxabi/trunk/src/fallback_malloc.ipp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/fallback_malloc.ipp?rev=238945&r1=238944&r2=238945&view=diff
==============================================================================
--- libcxxabi/trunk/src/fallback_malloc.ipp (original)
+++ libcxxabi/trunk/src/fallback_malloc.ipp Wed Jun  3 12:25:35 2015
@@ -97,8 +97,8 @@ void *fallback_malloc(size_t len) {
 
         if (p->len > nelems) {  //  chunk is larger, shorten, and return the tail
             heap_node *q;
-            
-            p->len -= nelems;
+
+            p->len = static_cast<heap_size>(p->len - nelems);
             q = p + p->len;
             q->next_node = 0;
             q->len = static_cast<heap_size>(nelems);
@@ -143,14 +143,14 @@ void fallback_free (void *ptr) {
 #ifdef DEBUG_FALLBACK_MALLOC
             std::cout << "  Appending onto chunk at " << offset_from_node ( p ) << std::endl;
 #endif
-            p->len += cp->len;  // make the free heap_node larger
+            p->len = static_cast<heap_size>(p->len + cp->len);  // make the free heap_node larger
             return;
             }
         else if ( after ( cp ) == p ) { // there's a free heap_node right after
 #ifdef DEBUG_FALLBACK_MALLOC
             std::cout << "  Appending free chunk at " << offset_from_node ( p ) << std::endl;
 #endif
-            cp->len += p->len;
+            cp->len = static_cast<heap_size>(cp->len + p->len);
             if ( prev == 0 ) {
                 freelist = cp;
                 cp->next_node = p->next_node;





More information about the cfe-commits mailing list