Skip to content

Commit

Permalink
Merge pull request #6 from Dual-Life/develop
Browse files Browse the repository at this point in the history
1.58 Clang macros
  • Loading branch information
jdhedden authored Jan 23, 2018
2 parents 0968cb8 + 48dd280 commit a2fa09f
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 15 deletions.
4 changes: 4 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ Revision history for Perl extension threads::shared.
-
-

1.58 Mon Jan 22 20:09:07 EST 2018
- Fix CLANG macros.
- Sync with blead.

1.57 Sun May 7 22:48:33 2017
- Fix Clang macro backward compatibility per patch by Andy Grundman

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.57
threads::shared version 1.58
============================

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.57'; # Please update the pod, too.
our $VERSION = '1.58'; # 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.57
This document describes threads::shared version 1.58
=head1 SYNOPSIS
Expand Down
20 changes: 11 additions & 9 deletions shared.xs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,15 @@
# include "shared.h"
#endif

#ifndef CLANG_DIAG_IGNORE
# define CLANG_DIAG_IGNORE(x)
# define CLANG_DIAG_RESTORE
#endif
#ifndef CLANG_DIAG_IGNORE_STMT
# define CLANG_DIAG_IGNORE_STMT(x) CLANG_DIAG_IGNORE(x) NOOP
# define CLANG_DIAG_RESTORE_STMT CLANG_DIAG_RESTORE NOOP
#endif

#ifdef USE_ITHREADS

/* Magic signature(s) for mg_private to make PERL_MAGIC_ext magic safer */
Expand Down Expand Up @@ -656,17 +665,10 @@ 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_DIAG_IGNORE)
CLANG_DIAG_IGNORE(-Wthread-safety);
CLANG_DIAG_IGNORE_STMT(-Wthread-safety);
/* warning: calling function 'pthread_cond_timedwait' requires holding mutex 'mut' exclusively [-Wthread-safety-analysis] */
#endif

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

/* perl.h defines CLANG_DIAG_* but only in 5.24+ */
#if defined(CLANG_DIAG_RESTORE)
CLANG_DIAG_RESTORE;
#endif
CLANG_DIAG_RESTORE_STMT;

case 0: got_it = 1; break;
case ETIMEDOUT: break;
Expand Down
10 changes: 7 additions & 3 deletions t/test.pl
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ sub find_git_or_skip {
} else {
$reason = 'not being run from a git checkout';
}
if ($ENV{'PERL_BUILD_PACKAGING'}) {
$reason = 'PERL_BUILD_PACKAGING is set';
}
skip_all($reason) if $_[0] && $_[0] eq 'all';
skip($reason, @_);
}
Expand Down Expand Up @@ -860,7 +863,7 @@ sub unlink_all {
if( -f $file ){
_print_stderr "# Couldn't unlink '$file': $!\n";
}else{
++$count;
$count = $count + 1; # don't use ++
}
}
$count;
Expand Down Expand Up @@ -914,7 +917,7 @@ sub _num_to_alpha{
my $tempfile_count = 0;
sub tempfile {
while(1){
my $try = "tmp$$";
my $try = (-d "t" ? "t/" : "")."tmp$$";
my $alpha = _num_to_alpha($tempfile_count,2);
last unless defined $alpha;
$try = $try . $alpha;
Expand Down Expand Up @@ -1141,7 +1144,7 @@ sub setup_multiple_progs {
my $found;
while (<$fh>) {
if (/^__END__/) {
++$found;
$found = $found + 1; # don't use ++
last;
}
}
Expand Down Expand Up @@ -1516,6 +1519,7 @@ sub capture_warnings {

local @::__capture;
local $SIG {__WARN__} = \&__capture;
local $Level = 1;
&$code;
return @::__capture;
}
Expand Down

0 comments on commit a2fa09f

Please sign in to comment.