Skip to content

Commit e3c2771

Browse files
author
Jerry D. Hedden
authored
Merge pull request #3 from Dual-Life/develop
1.54 Fix Clang macro
2 parents b9e587d + e11e8e6 commit e3c2771

File tree

5 files changed

+49
-11
lines changed

5 files changed

+49
-11
lines changed

Changes

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ Revision history for Perl extension threads::shared.
33
-
44
-
55

6+
1.54 Sat Dec 31 17:33:20 2016
7+
- Fix Clang macro
8+
9+
1.53 Fri Dec 30 17:35:13 2016
10+
- Sync from blead
11+
612
1.52 Mon May 16 18:46:52 2016
713
- Make t/test.pl compatible with Perls < 5.10 (again)
814

README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
threads::shared version 1.52
1+
threads::shared version 1.54
22
============================
33

44
This module needs Perl 5.8.0 or later compiled with USEITHREADS.

lib/threads/shared.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use warnings;
77

88
use Scalar::Util qw(reftype refaddr blessed);
99

10-
our $VERSION = '1.52'; # Please update the pod, too.
10+
our $VERSION = '1.54'; # Please update the pod, too.
1111
my $XS_VERSION = $VERSION;
1212
$VERSION = eval $VERSION;
1313

@@ -195,7 +195,7 @@ threads::shared - Perl extension for sharing data structures between threads
195195
196196
=head1 VERSION
197197
198-
This document describes threads::shared version 1.52
198+
This document describes threads::shared version 1.54
199199
200200
=head1 SYNOPSIS
201201

shared.xs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,17 @@ Perl_sharedsv_cond_timedwait(perl_cond *cond, perl_mutex *mut, double abs)
656656
abs -= (NV)ts.tv_sec;
657657
ts.tv_nsec = (long)(abs * 1000000000.0);
658658

659+
#if defined(__clang__) || defined(__clang)
660+
CLANG_DIAG_IGNORE(-Wthread-safety);
661+
/* warning: calling function 'pthread_cond_timedwait' requires holding mutex 'mut' exclusively [-Wthread-safety-analysis] */
662+
#endif
663+
659664
switch (pthread_cond_timedwait(cond, mut, &ts)) {
665+
666+
#if defined(__clang__) || defined(__clang)
667+
CLANG_DIAG_RESTORE;
668+
#endif
669+
660670
case 0: got_it = 1; break;
661671
case ETIMEDOUT: break;
662672
#ifdef OEMVS

t/test.pl

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ sub _create_runperl { # Create the string to qx in runperl().
652652
$runperl = "$ENV{PERL_RUNPERL_DEBUG} $runperl";
653653
}
654654
unless ($args{nolib}) {
655-
$runperl = $runperl . ' "-I../lib"'; # doublequotes because of VMS
655+
$runperl = $runperl . ' "-I../lib" "-I." '; # doublequotes because of VMS
656656
}
657657
if ($args{switches}) {
658658
local $Level = 2;
@@ -953,11 +953,19 @@ sub register_tempfile {
953953
return $count;
954954
}
955955

956-
# This is the temporary file for _fresh_perl
956+
# This is the temporary file for fresh_perl
957957
my $tmpfile = tempfile();
958958

959-
sub _fresh_perl {
960-
my($prog, $action, $expect, $runperl_args, $name) = @_;
959+
sub fresh_perl {
960+
my($prog, $runperl_args) = @_;
961+
962+
# Run 'runperl' with the complete perl program contained in '$prog', and
963+
# arguments in the hash referred to by '$runperl_args'. The results are
964+
# returned, with $? set to the exit code. Unless overridden, stderr is
965+
# redirected to stdout.
966+
967+
die sprintf "Third argument to fresh_perl_.* must be hashref of args to fresh_perl (or {})"
968+
unless !(defined $runperl_args) || ref($runperl_args) eq 'HASH';
961969

962970
# Given the choice of the mis-parsable {}
963971
# (we want an anon hash, but a borked lexer might think that it's a block)
@@ -970,12 +978,13 @@ sub _fresh_perl {
970978
$runperl_args->{progfile} ||= $tmpfile;
971979
$runperl_args->{stderr} = 1 unless exists $runperl_args->{stderr};
972980

973-
open TEST, ">$tmpfile" or die "Cannot open $tmpfile: $!";
981+
open TEST, '>', $tmpfile or die "Cannot open $tmpfile: $!";
974982
print TEST $prog;
975983
close TEST or die "Cannot close $tmpfile: $!";
976984

977985
my $results = runperl(%$runperl_args);
978-
my $status = $?;
986+
my $status = $?; # Not necessary to save this, but it makes it clear to
987+
# future maintainers.
979988

980989
# Clean up the results into something a bit more predictable.
981990
$results =~ s/\n+$//;
@@ -994,6 +1003,17 @@ sub _fresh_perl {
9941003
$results =~ s/\n\n/\n/g;
9951004
}
9961005

1006+
$? = $status;
1007+
return $results;
1008+
}
1009+
1010+
1011+
sub _fresh_perl {
1012+
my($prog, $action, $expect, $runperl_args, $name) = @_;
1013+
1014+
my $results = fresh_perl($prog, $runperl_args);
1015+
my $status = $?;
1016+
9971017
# Use the first line of the program as a name if none was given
9981018
unless( $name ) {
9991019
($first_line, $name) = $prog =~ /^((.{1,50}).*)/;
@@ -1058,8 +1078,9 @@ sub fresh_perl_like {
10581078
# Each program is source code to run followed by an "EXPECT" line, followed
10591079
# by the expected output.
10601080
#
1061-
# The code to run may begin with a command line switch such as -w or -0777
1062-
# (alphanumerics only), and may contain (note the '# ' on each):
1081+
# The first line of the code to run may be a command line switch such as -wE
1082+
# or -0777 (alphanumerics only; only one cluster, beginning with a minus is
1083+
# allowed). Later lines may contain (note the '# ' on each):
10631084
# # TODO reason for todo
10641085
# # SKIP reason for skip
10651086
# # SKIP ?code to test if this should be skipped
@@ -1241,6 +1262,7 @@ sub run_multiple_progs {
12411262
open my $fh, '>', $tmpfile or die "Cannot open >$tmpfile: $!";
12421263
print $fh q{
12431264
BEGIN {
1265+
push @INC, '.';
12441266
open STDERR, '>&', STDOUT
12451267
or die "Can't dup STDOUT->STDERR: $!;";
12461268
}

0 commit comments

Comments
 (0)