In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/a135cb6c4c7ef56a4b3ad97f942b3c73600512c0?hp=7ebb7b4a7bb15c929045760e5dda4bb94ab4ecc7>
- Log ----------------------------------------------------------------- commit a135cb6c4c7ef56a4b3ad97f942b3c73600512c0 Author: Karl Williamson <[email protected]> Date: Fri Nov 18 13:20:50 2016 -0700 Time-HiRes: Remove impediment to compiling under C++11 C++11 changed from earlier versions to require 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 deprecation warning when there isn't a space (presumably so that future versions can support C++11). Although not required by the C++11 change, this patch also makes sure there is space after a macro call, before a string literal. This makes the macro stand out, and is easier to read. This patch also changes any affected lines that exceed 79 columns, as specified by perlhack. 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. ----------------------------------------------------------------------- Summary of changes: dist/Time-HiRes/HiRes.pm | 2 +- dist/Time-HiRes/HiRes.xs | 40 +++++++++++++++++++++++++++++----------- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/dist/Time-HiRes/HiRes.pm b/dist/Time-HiRes/HiRes.pm index f2338f5..f22c462 100644 --- a/dist/Time-HiRes/HiRes.pm +++ b/dist/Time-HiRes/HiRes.pm @@ -28,7 +28,7 @@ our @EXPORT_OK = qw (usleep sleep ualarm alarm gettimeofday time tv_interval stat lstat utime ); -our $VERSION = '1.9740_02'; +our $VERSION = '1.9740_03'; our $XS_VERSION = $VERSION; $VERSION = eval $VERSION; diff --git a/dist/Time-HiRes/HiRes.xs b/dist/Time-HiRes/HiRes.xs index a8d26c7..6b0dba8 100644 --- a/dist/Time-HiRes/HiRes.xs +++ b/dist/Time-HiRes/HiRes.xs @@ -1025,7 +1025,8 @@ usleep(useconds) useconds -= NV_1E6 * seconds; } } else if (useconds < 0.0) - croak("Time::HiRes::usleep(%"NVgf"): negative time not invented yet", useconds); + croak("Time::HiRes::usleep(%" NVgf + "): negative time not invented yet", useconds); usleep((U32)useconds); } else PerlProc_pause(); @@ -1047,7 +1048,8 @@ nanosleep(nsec) struct timespec sleepfor, unslept; CODE: if (nsec < 0.0) - croak("Time::HiRes::nanosleep(%"NVgf"): negative time not invented yet", nsec); + croak("Time::HiRes::nanosleep(%" NVgf + "): negative time not invented yet", nsec); nanosleep_init(nsec, &sleepfor, &unslept); if (nanosleep(&sleepfor, &unslept) == 0) { RETVAL = nsec; @@ -1092,11 +1094,15 @@ sleep(...) useconds = -(IV)useconds; #endif /* #if defined(__sparc64__) && defined(__GNUC__) */ if ((IV)useconds < 0) - croak("Time::HiRes::sleep(%"NVgf"): internal error: useconds < 0 (unsigned %"UVuf" signed %"IVdf")", seconds, useconds, (IV)useconds); + croak("Time::HiRes::sleep(%" NVgf + "): internal error: useconds < 0 (unsigned %" UVuf + " signed %" IVdf ")", + seconds, useconds, (IV)useconds); } usleep(useconds); } else - croak("Time::HiRes::sleep(%"NVgf"): negative time not invented yet", seconds); + croak("Time::HiRes::sleep(%" NVgf + "): negative time not invented yet", seconds); } else PerlProc_pause(); gettimeofday(&Tb, NULL); @@ -1144,7 +1150,9 @@ ualarm(useconds,uinterval=0) } #else if (useconds >= IV_1E6 || uinterval >= IV_1E6) - croak("Time::HiRes::ualarm(%d, %d): useconds or uinterval equal to or more than %"IVdf, useconds, uinterval, IV_1E6); + croak("Time::HiRes::ualarm(%d, %d): useconds or uinterval" + " equal to or more than %" IVdf, + useconds, uinterval, IV_1E6); RETVAL = ualarm(useconds, uinterval); #endif @@ -1157,7 +1165,8 @@ alarm(seconds,interval=0) NV interval CODE: if (seconds < 0.0 || interval < 0.0) - croak("Time::HiRes::alarm(%"NVgf", %"NVgf"): negative time not invented yet", seconds, interval); + croak("Time::HiRes::alarm(%" NVgf ", %" NVgf + "): negative time not invented yet", seconds, interval); { IV iseconds = (IV)seconds; IV iinterval = (IV)interval; @@ -1165,7 +1174,9 @@ alarm(seconds,interval=0) NV finterval = interval - iinterval; IV useconds, uinterval; if (fseconds >= 1.0 || finterval >= 1.0) - croak("Time::HiRes::alarm(%"NVgf", %"NVgf"): seconds or interval too large to split correctly", seconds, interval); + croak("Time::HiRes::alarm(%" NVgf ", %" NVgf + "): seconds or interval too large to split correctly", + seconds, interval); useconds = IV_1E6 * fseconds; uinterval = IV_1E6 * finterval; #if defined(HAS_SETITIMER) && defined(ITIMER_REAL) @@ -1185,7 +1196,9 @@ alarm(seconds,interval=0) } #else if (iseconds || iinterval) - croak("Time::HiRes::alarm(%"NVgf", %"NVgf"): seconds or interval equal to or more than 1.0 ", seconds, interval); + croak("Time::HiRes::alarm(%" NVgf ", %" NVgf + "): seconds or interval equal to or more than 1.0 ", + seconds, interval); RETVAL = (NV)ualarm( useconds, uinterval ) / NV_1E6; #endif } @@ -1313,7 +1326,9 @@ setitimer(which, seconds, interval = 0) struct itimerval oldit; PPCODE: if (seconds < 0.0 || interval < 0.0) - croak("Time::HiRes::setitimer(%"IVdf", %"NVgf", %"NVgf"): negative time not invented yet", (IV)which, seconds, interval); + croak("Time::HiRes::setitimer(%" IVdf ", %" NVgf ", %" NVgf + "): negative time not invented yet", + (IV)which, seconds, interval); newit.it_value.tv_sec = (IV)seconds; newit.it_value.tv_usec = (IV)((seconds - (NV)newit.it_value.tv_sec) * NV_1E6); @@ -1388,7 +1403,9 @@ PROTOTYPE: $$@ utbufp = NULL; else { if (SvNV(accessed) < 0.0 || SvNV(modified) < 0.0) - croak("Time::HiRes::utime(%"NVgf", %"NVgf"): negative time not invented yet", SvNV(accessed), SvNV(modified)); + croak("Time::HiRes::utime(%" NVgf ", %" NVgf + "): negative time not invented yet", + SvNV(accessed), SvNV(modified)); Zero(&utbuf, sizeof utbuf, char); utbuf[0].tv_sec = (Time_t)SvNV(accessed); /* time accessed */ utbuf[0].tv_nsec = (long)( ( SvNV(accessed) - utbuf[0].tv_sec ) * 1e9 ); @@ -1517,7 +1534,8 @@ clock_nanosleep(clock_id, nsec, flags = 0) struct timespec sleepfor, unslept; CODE: if (nsec < 0.0) - croak("Time::HiRes::clock_nanosleep(..., %"NVgf"): negative time not invented yet", nsec); + croak("Time::HiRes::clock_nanosleep(..., %" NVgf + "): negative time not invented yet", nsec); nanosleep_init(nsec, &sleepfor, &unslept); if (clock_nanosleep(clock_id, flags, &sleepfor, &unslept) == 0) { RETVAL = nsec; -- Perl5 Master Repository
