mozilla-gcc47.patch
changeset 438 7d934b2f5014
parent 435 df9c4a6e84f8
child 439 7704a021055f
equal deleted inserted replaced
435:df9c4a6e84f8 438:7d934b2f5014
     1 # HG changeset patch
       
     2 # Parent 11d55dfd8e3a732ea60761b259e20790b0ecec43
       
     3 Patch to make Mozilla build with gcc 4.7, including
       
     4 - Bug 734490 - "no viable overloaded 'PRIxPTR'" when building with Clang or GCC 4.7 (TM: Mozilla14)
       
     5 
       
     6 diff --git a/layout/base/tests/TestPoisonArea.cpp b/layout/base/tests/TestPoisonArea.cpp
       
     7 --- a/layout/base/tests/TestPoisonArea.cpp
       
     8 +++ b/layout/base/tests/TestPoisonArea.cpp
       
     9 @@ -392,53 +392,53 @@ ReservePoisonArea()
       
    10  {
       
    11    if (sizeof(uintptr_t) == 8) {
       
    12      // Use the hardware-inaccessible region.
       
    13      // We have to avoid 64-bit constants and shifts by 32 bits, since this
       
    14      // code is compiled in 32-bit mode, although it is never executed there.
       
    15      uintptr_t result = (((uintptr_t(0x7FFFFFFFu) << 31) << 1 |
       
    16                           uintptr_t(0xF0DEAFFFu)) &
       
    17                          ~uintptr_t(PAGESIZE-1));
       
    18 -    printf("INFO | poison area assumed at 0x%.*"PRIxPTR"\n", SIZxPTR, result);
       
    19 +    printf("INFO | poison area assumed at 0x%.*" PRIxPTR "\n", SIZxPTR, result);
       
    20      return result;
       
    21    } else {
       
    22      // First see if we can allocate the preferred poison address from the OS.
       
    23      uintptr_t candidate = (0xF0DEAFFF & ~(PAGESIZE-1));
       
    24      void *result = ReserveRegion(candidate, false);
       
    25      if (result == (void *)candidate) {
       
    26        // success - inaccessible page allocated
       
    27 -      printf("INFO | poison area allocated at 0x%.*"PRIxPTR
       
    28 +      printf("INFO | poison area allocated at 0x%.*" PRIxPTR
       
    29               " (preferred addr)\n", SIZxPTR, (uintptr_t)result);
       
    30        return candidate;
       
    31      }
       
    32  
       
    33      // That didn't work, so see if the preferred address is within a range
       
    34      // of permanently inacessible memory.
       
    35      if (ProbeRegion(candidate)) {
       
    36        // success - selected page cannot be usable memory
       
    37        if (result != MAP_FAILED)
       
    38          ReleaseRegion(result);
       
    39 -      printf("INFO | poison area assumed at 0x%.*"PRIxPTR
       
    40 +      printf("INFO | poison area assumed at 0x%.*" PRIxPTR
       
    41               " (preferred addr)\n", SIZxPTR, candidate);
       
    42        return candidate;
       
    43      }
       
    44  
       
    45      // The preferred address is already in use.  Did the OS give us a
       
    46      // consolation prize?
       
    47      if (result != MAP_FAILED) {
       
    48 -      printf("INFO | poison area allocated at 0x%.*"PRIxPTR
       
    49 +      printf("INFO | poison area allocated at 0x%.*" PRIxPTR
       
    50               " (consolation prize)\n", SIZxPTR, (uintptr_t)result);
       
    51        return (uintptr_t)result;
       
    52      }
       
    53  
       
    54      // It didn't, so try to allocate again, without any constraint on
       
    55      // the address.
       
    56      result = ReserveRegion(0, false);
       
    57      if (result != MAP_FAILED) {
       
    58 -      printf("INFO | poison area allocated at 0x%.*"PRIxPTR
       
    59 +      printf("INFO | poison area allocated at 0x%.*" PRIxPTR
       
    60               " (fallback)\n", SIZxPTR, (uintptr_t)result);
       
    61        return (uintptr_t)result;
       
    62      }
       
    63  
       
    64      printf("ERROR | no usable poison area found\n");
       
    65      return 0;
       
    66    }
       
    67  }
       
    68 @@ -450,17 +450,17 @@ static uintptr_t
       
    69  ReservePositiveControl()
       
    70  {
       
    71  
       
    72    void *result = ReserveRegion(0, false);
       
    73    if (result == MAP_FAILED) {
       
    74      printf("ERROR | allocating positive control | %s\n", LastErrMsg());
       
    75      return 0;
       
    76    }
       
    77 -  printf("INFO | positive control allocated at 0x%.*"PRIxPTR"\n",
       
    78 +  printf("INFO | positive control allocated at 0x%.*" PRIxPTR "\n",
       
    79           SIZxPTR, (uintptr_t)result);
       
    80    return (uintptr_t)result;
       
    81  }
       
    82  
       
    83  /* The "negative control" area confirms that our probe logic does detect a
       
    84   * page that is readable, writable, or executable.
       
    85   */
       
    86  static uintptr_t
       
    87 @@ -481,17 +481,17 @@ ReserveNegativeControl()
       
    88    // Now mark it executable as well as readable and writable.
       
    89    // (mmap(PROT_EXEC) may fail when applied to anonymous memory.)
       
    90  
       
    91    if (MakeRegionExecutable(result)) {
       
    92      printf("ERROR | making negative control executable | %s\n", LastErrMsg());
       
    93      return 0;
       
    94    }
       
    95  
       
    96 -  printf("INFO | negative control allocated at 0x%.*"PRIxPTR"\n",
       
    97 +  printf("INFO | negative control allocated at 0x%.*" PRIxPTR "\n",
       
    98           SIZxPTR, (uintptr_t)result);
       
    99    return (uintptr_t)result;
       
   100  }
       
   101  
       
   102  static void
       
   103  JumpTo(uintptr_t opaddr)
       
   104  {
       
   105  #ifdef __ia64