Skip to content

Commit

Permalink
Merge pull request #3 from Dual-Life/develop
Browse files Browse the repository at this point in the history
1.54 Fix Clang macro
  • Loading branch information
jdhedden authored Jan 16, 2017
2 parents b9e587d + e11e8e6 commit e3c2771
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 11 deletions.
6 changes: 6 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ Revision history for Perl extension threads::shared.
-
-

1.54 Sat Dec 31 17:33:20 2016
- Fix Clang macro

1.53 Fri Dec 30 17:35:13 2016
- Sync from blead

1.52 Mon May 16 18:46:52 2016
- Make t/test.pl compatible with Perls < 5.10 (again)

Expand Down
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
threads::shared version 1.52
threads::shared version 1.54
============================

This module needs Perl 5.8.0 or later compiled with USEITHREADS.
Expand Down
4 changes: 2 additions & 2 deletions lib/threads/shared.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use warnings;

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

our $VERSION = '1.52'; # Please update the pod, too.
our $VERSION = '1.54'; # Please update the pod, too.
my $XS_VERSION = $VERSION;
$VERSION = eval $VERSION;

Expand Down Expand Up @@ -195,7 +195,7 @@ threads::shared - Perl extension for sharing data structures between threads
=head1 VERSION
This document describes threads::shared version 1.52
This document describes threads::shared version 1.54
=head1 SYNOPSIS
Expand Down
10 changes: 10 additions & 0 deletions shared.xs
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,17 @@ Perl_sharedsv_cond_timedwait(perl_cond *cond, perl_mutex *mut, double abs)
abs -= (NV)ts.tv_sec;
ts.tv_nsec = (long)(abs * 1000000000.0);

#if defined(__clang__) || defined(__clang)
CLANG_DIAG_IGNORE(-Wthread-safety);
/* warning: calling function 'pthread_cond_timedwait' requires holding mutex 'mut' exclusively [-Wthread-safety-analysis] */
#endif

switch (pthread_cond_timedwait(cond, mut, &ts)) {

#if defined(__clang__) || defined(__clang)
CLANG_DIAG_RESTORE;
#endif

case 0: got_it = 1; break;
case ETIMEDOUT: break;
#ifdef OEMVS
Expand Down
38 changes: 30 additions & 8 deletions t/test.pl
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ sub _create_runperl { # Create the string to qx in runperl().
$runperl = "$ENV{PERL_RUNPERL_DEBUG} $runperl";
}
unless ($args{nolib}) {
$runperl = $runperl . ' "-I../lib"'; # doublequotes because of VMS
$runperl = $runperl . ' "-I../lib" "-I." '; # doublequotes because of VMS
}
if ($args{switches}) {
local $Level = 2;
Expand Down Expand Up @@ -953,11 +953,19 @@ sub register_tempfile {
return $count;
}

# This is the temporary file for _fresh_perl
# This is the temporary file for fresh_perl
my $tmpfile = tempfile();

sub _fresh_perl {
my($prog, $action, $expect, $runperl_args, $name) = @_;
sub fresh_perl {
my($prog, $runperl_args) = @_;

# Run 'runperl' with the complete perl program contained in '$prog', and
# arguments in the hash referred to by '$runperl_args'. The results are
# returned, with $? set to the exit code. Unless overridden, stderr is
# redirected to stdout.

die sprintf "Third argument to fresh_perl_.* must be hashref of args to fresh_perl (or {})"
unless !(defined $runperl_args) || ref($runperl_args) eq 'HASH';

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

open TEST, ">$tmpfile" or die "Cannot open $tmpfile: $!";
open TEST, '>', $tmpfile or die "Cannot open $tmpfile: $!";
print TEST $prog;
close TEST or die "Cannot close $tmpfile: $!";

my $results = runperl(%$runperl_args);
my $status = $?;
my $status = $?; # Not necessary to save this, but it makes it clear to
# future maintainers.

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

$? = $status;
return $results;
}


sub _fresh_perl {
my($prog, $action, $expect, $runperl_args, $name) = @_;

my $results = fresh_perl($prog, $runperl_args);
my $status = $?;

# Use the first line of the program as a name if none was given
unless( $name ) {
($first_line, $name) = $prog =~ /^((.{1,50}).*)/;
Expand Down Expand Up @@ -1058,8 +1078,9 @@ sub fresh_perl_like {
# Each program is source code to run followed by an "EXPECT" line, followed
# by the expected output.
#
# The code to run may begin with a command line switch such as -w or -0777
# (alphanumerics only), and may contain (note the '# ' on each):
# The first line of the code to run may be a command line switch such as -wE
# or -0777 (alphanumerics only; only one cluster, beginning with a minus is
# allowed). Later lines may contain (note the '# ' on each):
# # TODO reason for todo
# # SKIP reason for skip
# # SKIP ?code to test if this should be skipped
Expand Down Expand Up @@ -1241,6 +1262,7 @@ sub run_multiple_progs {
open my $fh, '>', $tmpfile or die "Cannot open >$tmpfile: $!";
print $fh q{
BEGIN {
push @INC, '.';
open STDERR, '>&', STDOUT
or die "Can't dup STDOUT->STDERR: $!;";
}
Expand Down

0 comments on commit e3c2771

Please sign in to comment.