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 /ext/POSIX | |
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 'ext/POSIX')
-rw-r--r-- | ext/POSIX/POSIX.xs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs index a9da9730f0..5c7d81a045 100644 --- a/ext/POSIX/POSIX.xs +++ b/ext/POSIX/POSIX.xs @@ -1214,7 +1214,7 @@ static void S_setpayload(NV* nvp, NV_PAYLOAD_TYPE payload, bool signaling) { NV t1 = c99_trunc(payload); /* towards zero (drop fractional) */ #ifdef NV_PAYLOAD_DEBUG - Perl_warn(aTHX_ "t1 = %"NVgf" (payload %"NVgf")\n", t1, payload); + Perl_warn(aTHX_ "t1 = %" NVgf " (payload %" NVgf ")\n", t1, payload); #endif if (t1 <= UV_MAX) { a[0] = (UV)t1; /* Fast path, also avoids rounding errors (right?) */ @@ -1244,7 +1244,7 @@ static void S_setpayload(NV* nvp, NV_PAYLOAD_TYPE payload, bool signaling) #endif #ifdef NV_PAYLOAD_DEBUG for (i = 0; i < (int)C_ARRAY_LENGTH(a); i++) { - Perl_warn(aTHX_ "a[%d] = 0x%"UVxf"\n", i, a[i]); + Perl_warn(aTHX_ "a[%d] = 0x%" UVxf "\n", i, a[i]); } #endif for (i = 0; i < (int)sizeof(p); i++) { @@ -1255,7 +1255,9 @@ static void S_setpayload(NV* nvp, NV_PAYLOAD_TYPE payload, bool signaling) ((U8 *)(nvp))[i] &= ~m[i]; /* For NaNs with non-zero payload bits. */ ((U8 *)(nvp))[i] |= b; #ifdef NV_PAYLOAD_DEBUG - Perl_warn(aTHX_ "set p[%2d] = %02x (i = %d, m = %02x, s = %2d, b = %02x, u = %08"UVxf")\n", i, ((U8 *)(nvp))[i], i, m[i], s, b, u); + Perl_warn(aTHX_ + "set p[%2d] = %02x (i = %d, m = %02x, s = %2d, b = %02x, u = %08" + UVxf ")\n", i, ((U8 *)(nvp))[i], i, m[i], s, b, u); #endif a[p[i] / UVSIZE] &= ~u; } @@ -1272,7 +1274,7 @@ static void S_setpayload(NV* nvp, NV_PAYLOAD_TYPE payload, bool signaling) #endif for (i = 0; i < (int)C_ARRAY_LENGTH(a); i++) { if (a[i]) { - Perl_warn(aTHX_ "payload lost bits (%"UVxf")", a[i]); + Perl_warn(aTHX_ "payload lost bits (%" UVxf ")", a[i]); break; } } @@ -1303,7 +1305,7 @@ static NV_PAYLOAD_TYPE S_getpayload(NV nv) } for (i = (int)C_ARRAY_LENGTH(a) - 1; i >= 0; i--) { #ifdef NV_PAYLOAD_DEBUG - Perl_warn(aTHX_ "a[%d] = %"UVxf"\n", i, a[i]); + Perl_warn(aTHX_ "a[%d] = %" UVxf "\n", i, a[i]); #endif payload *= UV_MAX; payload += a[i]; |