diff options
author | Karl Williamson <khw@cpan.org> | 2016-11-17 06:21:54 -0700 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2016-11-18 09:41:07 -0700 |
commit | 147e38468b8279e26a0ca11e4efd8492016f2702 (patch) | |
tree | 4d3c3b5b692937fc40e2fed20aaa1b7afd3ba56e /malloc.c | |
parent | 51d89e3583b4182c42c21b343376f2286f67fc3b (diff) | |
download | perl-147e38468b8279e26a0ca11e4efd8492016f2702.tar.gz |
Change white space to avoid C++ deprecation warning
C++11 requires space between the end of a string literal and a macro, so
that a feature can unambiguously be added to the language. Starting in
g++ 6.2, the compiler emits a warning when there isn't a space
(presumably so that future versions can support C++11). Unfortunately
there are many such instances in the perl core. This commit fixes
those, including those in ext/, but individual commits will be used for
the other modules, those in dist/ and cpan/.
This commit also inserts space at the end of a macro before a string
literal, even though that is not deprecated, and removes useless ""
literals following a macro (instead of inserting a blank). The result
is easier to read, making the macro stand out, and be clearer as to the
intention.
Code and modules included with the Perl core need to be compilable using
C++. This is so that perl can be embedded in C++ programs. (Actually,
only the hdr files need to be so compilable, but it would be hard to
test that just the hdrs are compilable.) So we need to accommodate
changes to the C++ language.
Diffstat (limited to 'malloc.c')
-rw-r--r-- | malloc.c | 38 |
1 files changed, 24 insertions, 14 deletions
@@ -1015,7 +1015,9 @@ emergency_sbrk(MEM_SIZE size) /* Give the possibility to recover, but avoid an infinite cycle. */ MALLOC_UNLOCK; emergency_buffer_last_req = size; - emergency_sbrk_croak("Out of memory during \"large\" request for %"UVuf" bytes, total sbrk() is %"UVuf" bytes", (UV)size, (UV)(goodsbrk + sbrk_slack)); + emergency_sbrk_croak("Out of memory during \"large\" request for %" UVuf + " bytes, total sbrk() is %" UVuf " bytes", + (UV)size, (UV)(goodsbrk + sbrk_slack)); } if ((MEM_SIZE)emergency_buffer_size >= rsize) { @@ -1059,7 +1061,9 @@ emergency_sbrk(MEM_SIZE size) } do_croak: MALLOC_UNLOCK; - emergency_sbrk_croak("Out of memory during request for %"UVuf" bytes, total sbrk() is %"UVuf" bytes", (UV)size, (UV)(goodsbrk + sbrk_slack)); + emergency_sbrk_croak("Out of memory during request for %" UVuf + " bytes, total sbrk() is %" UVuf " bytes", + (UV)size, (UV)(goodsbrk + sbrk_slack)); NOT_REACHED; /* NOTREACHED */ return NULL; } @@ -1306,7 +1310,7 @@ Perl_malloc(size_t nbytes) || (p && PTR2UV(p) < (1<<LOG_OF_MIN_ARENA)) ) { dTHX; PerlIO_printf(PerlIO_stderr(), - "Unaligned pointer in the free chain 0x%"UVxf"\n", + "Unaligned pointer in the free chain 0x%" UVxf "\n", PTR2UV(p)); } if ( (PTR2UV(p->ov_next) & (MEM_ALIGNBYTES - 1)) @@ -1314,7 +1318,7 @@ Perl_malloc(size_t nbytes) dTHX; PerlIO_printf(PerlIO_stderr(), "Unaligned \"next\" pointer in the free " - "chain 0x%"UVxf" at 0x%"UVxf"\n", + "chain 0x%" UVxf " at 0x%" UVxf "\n", PTR2UV(p->ov_next), PTR2UV(p)); } #endif @@ -1323,7 +1327,7 @@ Perl_malloc(size_t nbytes) MALLOC_UNLOCK; DEBUG_m(PerlIO_printf(Perl_debug_log, - "0x%"UVxf": (%05lu) malloc %ld bytes\n", + "0x% "UVxf ": (%05lu) malloc %ld bytes\n", PTR2UV((Malloc_t)(p + CHUNK_SHIFT)), (unsigned long)(PL_an++), (long)size)); @@ -1803,7 +1807,7 @@ Perl_mfree(Malloc_t where) #endif DEBUG_m(PerlIO_printf(Perl_debug_log, - "0x%"UVxf": (%05lu) free\n", + "0x%" UVxf ": (%05lu) free\n", PTR2UV(cp), (unsigned long)(PL_an++))); if (cp == NULL) @@ -2030,7 +2034,7 @@ Perl_realloc(void *mp, size_t nbytes) #endif res = cp; DEBUG_m(PerlIO_printf(Perl_debug_log, - "0x%"UVxf": (%05lu) realloc %ld bytes inplace\n", + "0x%" UVxf ": (%05lu) realloc %ld bytes inplace\n", PTR2UV(res),(unsigned long)(PL_an++), (long)size)); } else if (incr == 1 && (cp - M_OVERHEAD == last_op) @@ -2068,7 +2072,7 @@ Perl_realloc(void *mp, size_t nbytes) } else { hard_way: DEBUG_m(PerlIO_printf(Perl_debug_log, - "0x%"UVxf": (%05lu) realloc %ld bytes the hard way\n", + "0x%" UVxf ": (%05lu) realloc %ld bytes the hard way\n", PTR2UV(cp),(unsigned long)(PL_an++), (long)size)); if ((res = (char*)Perl_malloc(nbytes)) == NULL) @@ -2242,13 +2246,14 @@ Perl_dump_mstats(pTHX_ const char *s) if (s) PerlIO_printf(Perl_error_log, - "Memory allocation statistics %s (buckets %"IVdf"(%"IVdf")..%"IVdf"(%"IVdf")\n", + "Memory allocation statistics %s (buckets %" IVdf + "(%" IVdf ")..%" IVdf "(%" IVdf ")\n", s, (IV)BUCKET_SIZE_REAL(MIN_BUCKET), (IV)BUCKET_SIZE_NO_SURPLUS(MIN_BUCKET), (IV)BUCKET_SIZE_REAL(buffer.topbucket), (IV)BUCKET_SIZE_NO_SURPLUS(buffer.topbucket)); - PerlIO_printf(Perl_error_log, "%8"IVdf" free:", buffer.totfree); + PerlIO_printf(Perl_error_log, "%8" IVdf " free:", buffer.totfree); for (i = MIN_EVEN_REPORT; i <= buffer.topbucket; i += BUCKETS_PER_POW2) { PerlIO_printf(Perl_error_log, ((i < 8*BUCKETS_PER_POW2 || i == 10*BUCKETS_PER_POW2) @@ -2266,7 +2271,8 @@ Perl_dump_mstats(pTHX_ const char *s) buffer.nfree[i]); } #endif - PerlIO_printf(Perl_error_log, "\n%8"IVdf" used:", buffer.total - buffer.totfree); + PerlIO_printf(Perl_error_log, "\n%8" IVdf " used:", + buffer.total - buffer.totfree); for (i = MIN_EVEN_REPORT; i <= buffer.topbucket; i += BUCKETS_PER_POW2) { PerlIO_printf(Perl_error_log, ((i < 8*BUCKETS_PER_POW2 || i == 10*BUCKETS_PER_POW2) @@ -2284,7 +2290,9 @@ Perl_dump_mstats(pTHX_ const char *s) buffer.ntotal[i] - buffer.nfree[i]); } #endif - PerlIO_printf(Perl_error_log, "\nTotal sbrk(): %"IVdf"/%"IVdf":%"IVdf". Odd ends: pad+heads+chain+tail: %"IVdf"+%"IVdf"+%"IVdf"+%"IVdf".\n", + PerlIO_printf(Perl_error_log, "\nTotal sbrk(): %" IVdf "/%" IVdf ":%" + IVdf ". Odd ends: pad+heads+chain+tail: %" IVdf "+%" + IVdf "+%" IVdf "+%" IVdf ".\n", buffer.total_sbrk, buffer.sbrks, buffer.sbrk_good, buffer.sbrk_slack, buffer.start_slack, buffer.total_chain, buffer.sbrked_remains); @@ -2357,8 +2365,10 @@ Perl_sbrk(int size) } } - DEBUG_m(PerlIO_printf(Perl_debug_log, "sbrk malloc size %ld (reqsize %ld), left size %ld, give addr 0x%"UVxf"\n", - size, reqsize, Perl_sbrk_oldsize, PTR2UV(got))); + DEBUG_m(PerlIO_printf(Perl_debug_log, + "sbrk malloc size %ld (reqsize %ld), left size %ld, give addr 0x%" + UVxf "\n", + size, reqsize, Perl_sbrk_oldsize, PTR2UV(got))); return (void *)got; } |