@@ -972,6 +972,39 @@ nsec_without_unslept(struct timespec *sleepfor,
972
972
# define IS_SAFE_PATHNAME (pv , len , opname ) (((len)>1)&&memchr((pv), 0, (len)-1)?(SETERRNO(ENOENT, LIB_INVARG),WARNEMU(opname),FALSE):(TRUE))
973
973
#endif
974
974
975
+ STATIC void
976
+ S_croak_xs_unimplemented (const CV * const cv );
977
+
978
+ STATIC void
979
+ S_croak_xs_unimplemented (const CV * const cv )
980
+ {
981
+ dTHX ;
982
+ char buf [sizeof ("CODE(0x%" UVxf ")" ) + (sizeof (UV )* 8 )];
983
+ const char * pv1 ;
984
+ const GV * const gv = CvGV (cv );
985
+ if (gv ) {
986
+ const char * const gvname = GvNAME (gv );
987
+ const HV * const stash = GvSTASH (gv );
988
+ const char * const hvname = stash ? HvNAME (stash ) : NULL ;
989
+ if (hvname )
990
+ Perl_croak_nocontext ("%s::%s(): unimplemented in this platform" ,
991
+ hvname , gvname );
992
+ else {
993
+ pv1 = gvname ;
994
+ goto one_str ;
995
+ }
996
+ } else {
997
+ my_sprintf (buf , sizeof (buf ), "CODE(0x%" UVxf ")" , PTR2UV (cv ));
998
+ pv1 = buf ;
999
+
1000
+ one_str :
1001
+ Perl_croak_nocontext (
1002
+ "%s::%s(): unimplemented in this platform" + (sizeof ("%s::" )- 1 ),
1003
+ pv1 );
1004
+ }
1005
+ }
1006
+ #define croak_xs_unimplemented S_croak_xs_unimplemented
1007
+
975
1008
MODULE = Time ::HiRes PACKAGE = Time ::HiRes
976
1009
977
1010
PROTOTYPES : ENABLE
@@ -990,7 +1023,8 @@ BOOT:
990
1023
/* from MSDN: >= WinXP, function will always succeed and never return zero */
991
1024
unsigned __int64 l_tick_frequency_mem ;
992
1025
if (!QueryPerformanceFrequency ((LARGE_INTEGER * )& l_tick_frequency_mem ))
993
- croak ("%s(): unimplemented in this platform" , "QueryPerformanceFrequency" );
1026
+ croak ("%s::%s(): unimplemented in this platform" + (sizeof ("%s::" )- 1 ),
1027
+ "QueryPerformanceFrequency" );
994
1028
l_tick_frequency = l_tick_frequency_mem ;
995
1029
/* 32-bit CPU anti-sharding paranoia */
996
1030
S_InterlockedExchange64 (& tick_frequency , l_tick_frequency );
@@ -1097,7 +1131,7 @@ nanosleep(nsec)
1097
1131
NV_DIE nsec
1098
1132
CODE :
1099
1133
PERL_UNUSED_ARG (nsec );
1100
- croak ( "%s(): unimplemented in this platform" , "Time::HiRes::nanosleep" );
1134
+ croak_xs_unimplemented ( cv );
1101
1135
RETVAL = 0.0 ;
1102
1136
OUTPUT :
1103
1137
RETVAL
@@ -1154,7 +1188,7 @@ usleep(useconds)
1154
1188
NV_DIE useconds
1155
1189
CODE :
1156
1190
PERL_UNUSED_ARG (useconds );
1157
- croak ( "%s(): unimplemented in this platform" , "Time::HiRes::usleep" );
1191
+ croak_xs_unimplemented ( cv );
1158
1192
RETVAL = 0.0 ;
1159
1193
OUTPUT :
1160
1194
RETVAL
@@ -1254,7 +1288,7 @@ ualarm(useconds,interval=0)
1254
1288
CODE :
1255
1289
PERL_UNUSED_ARG (useconds );
1256
1290
PERL_UNUSED_ARG (interval );
1257
- croak ( "%s(): unimplemented in this platform" , "Time::HiRes::ualarm" );
1291
+ croak_xs_unimplemented ( cv );
1258
1292
RETVAL = -1 ;
1259
1293
OUTPUT :
1260
1294
RETVAL
@@ -1266,7 +1300,7 @@ alarm(seconds,interval=0)
1266
1300
CODE :
1267
1301
PERL_UNUSED_ARG (seconds );
1268
1302
PERL_UNUSED_ARG (interval );
1269
- croak ( "%s(): unimplemented in this platform" , "Time::HiRes::alarm" );
1303
+ croak_xs_unimplemented ( cv );
1270
1304
RETVAL = 0.0 ;
1271
1305
OUTPUT :
1272
1306
RETVAL
@@ -1459,7 +1493,7 @@ PROTOTYPE: $$@
1459
1493
I32_DIE
1460
1494
utime (accessed , modified , ...)
1461
1495
CODE :
1462
- croak ( "%s(): unimplemented in this platform" , "Time::HiRes::utime" );
1496
+ croak_xs_unimplemented ( cv );
1463
1497
RETVAL = 0 ;
1464
1498
OUTPUT :
1465
1499
RETVAL
@@ -1492,7 +1526,7 @@ clock_gettime(clock_id = 0)
1492
1526
clockid_t die_t clock_id
1493
1527
CODE :
1494
1528
PERL_UNUSED_ARG (clock_id );
1495
- croak ( "%s(): unimplemented in this platform" , "Time::HiRes::clock_gettime" );
1529
+ croak_xs_unimplemented ( cv );
1496
1530
RETVAL = 0.0 ;
1497
1531
OUTPUT :
1498
1532
RETVAL
@@ -1525,7 +1559,7 @@ clock_getres(clock_id = 0)
1525
1559
clockid_t die_t clock_id
1526
1560
CODE :
1527
1561
PERL_UNUSED_ARG (clock_id );
1528
- croak ( "%s(): unimplemented in this platform" , "Time::HiRes::clock_getres" );
1562
+ croak_xs_unimplemented ( cv );
1529
1563
RETVAL = 0.0 ;
1530
1564
OUTPUT :
1531
1565
RETVAL
@@ -1566,7 +1600,7 @@ clock_nanosleep(clock_id, nsec, flags = 0)
1566
1600
PERL_UNUSED_ARG (clock_id );
1567
1601
PERL_UNUSED_ARG (nsec );
1568
1602
PERL_UNUSED_ARG (flags );
1569
- croak ( "%s(): unimplemented in this platform" , "Time::HiRes::clock_nanosleep" );
1603
+ croak_xs_unimplemented ( cv );
1570
1604
RETVAL = 0.0 ;
1571
1605
OUTPUT :
1572
1606
RETVAL
@@ -1591,7 +1625,7 @@ clock()
1591
1625
NV_DIE
1592
1626
clock ()
1593
1627
CODE :
1594
- croak ( "%s(): unimplemented in this platform" , "Time::HiRes::clock" );
1628
+ croak_xs_unimplemented ( cv );
1595
1629
RETVAL = 0.0 ;
1596
1630
OUTPUT :
1597
1631
RETVAL
0 commit comments