stat lstat utime
);
-our $VERSION = '1.9747';
+our $VERSION = '1.9748';
our $XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
#define PERL_VERSION_GE(r,v,s) \
(PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s))
+#ifndef GCC_DIAG_IGNORE
+# define GCC_DIAG_IGNORE(x)
+# define GCC_DIAG_RESTORE
+#endif
+#ifndef GCC_DIAG_IGNORE_STMT
+# define GCC_DIAG_IGNORE_STMT(x) GCC_DIAG_IGNORE(x) NOOP
+# define GCC_DIAG_RESTORE_STMT GCC_DIAG_RESTORE NOOP
+#endif
+
/* At least ppport.h 3.13 gets this wrong: one really cannot
* have NVgf as anything else than "g" under Perl 5.6.x. */
#if PERL_REVISION == 5 && PERL_VERSION == 6
/* on some platforms the 1st arg to setitimer is an enum, which
* causes -Wc++-compat to complain about passing an int instead
*/
-#ifdef GCC_DIAG_IGNORE
- GCC_DIAG_IGNORE(-Wc++-compat);
-#endif
+ GCC_DIAG_IGNORE_STMT(-Wc++-compat);
if (setitimer(which, &newit, &oldit) == 0) {
EXTEND(sp, 1);
PUSHs(sv_2mortal(newSVnv(TV2NV(oldit.it_value))));
PUSHs(sv_2mortal(newSVnv(TV2NV(oldit.it_interval))));
}
}
-#ifdef GCC_DIAG_RESTORE
- GCC_DIAG_RESTORE;
-#endif
+ GCC_DIAG_RESTORE_STMT;
void
getitimer(which)
/* on some platforms the 1st arg to getitimer is an enum, which
* causes -Wc++-compat to complain about passing an int instead
*/
-#ifdef GCC_DIAG_IGNORE
- GCC_DIAG_IGNORE(-Wc++-compat);
-#endif
+ GCC_DIAG_IGNORE_STMT(-Wc++-compat);
if (getitimer(which, &nowit) == 0) {
EXTEND(sp, 1);
PUSHs(sv_2mortal(newSVnv(TV2NV(nowit.it_value))));
PUSHs(sv_2mortal(newSVnv(TV2NV(nowit.it_interval))));
}
}
-#ifdef GCC_DIAG_RESTORE
- GCC_DIAG_RESTORE;
-#endif
+ GCC_DIAG_RESTORE_STMT;
#endif /* #if defined(HAS_GETITIMER) && defined(HAS_SETITIMER) */
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;
=head1 VERSION
-This document describes threads::shared version 1.57
+This document describes threads::shared version 1.58
=head1 SYNOPSIS
# 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 */
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;
use strict;
use warnings;
-our $VERSION = '2.20'; # remember to update version in POD!
+our $VERSION = '2.21'; # remember to update version in POD!
my $XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
=head1 VERSION
-This document describes threads version 2.20
+This document describes threads version 2.21
=head1 WARNING
# endif
#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
+# define CLANG_DIAG_IGNORE_DECL(x) CLANG_DIAG_IGNORE(x) dNOOP
+# define CLANG_DIAG_RESTORE_DECL CLANG_DIAG_RESTORE dNOOP
+#endif
+
#ifdef USE_ITHREADS
#ifdef __amigaos4__
MUTEX_UNLOCK(&my_pool->create_destruct_mutex);
return (thread);
-#if defined(CLANG_DIAG_IGNORE)
- CLANG_DIAG_IGNORE(-Wthread-safety);
+ CLANG_DIAG_IGNORE_STMT(-Wthread-safety);
/* warning: mutex 'thread->mutex' is not held on every path through here [-Wthread-safety-analysis] */
-#endif
}
-/* perl.h defines CLANG_DIAG_* but only in 5.24+ */
-#if defined(CLANG_DIAG_RESTORE)
-CLANG_DIAG_RESTORE
-#endif
+CLANG_DIAG_RESTORE_DECL;
#endif /* USE_ITHREADS */
/* Let thread run. */
/* See S_ithread_run() for more detail. */
- CLANG_DIAG_IGNORE(-Wthread-safety);
+ CLANG_DIAG_IGNORE_STMT(-Wthread-safety);
/* warning: releasing mutex 'thread->mutex' that was not held [-Wthread-safety-analysis] */
MUTEX_UNLOCK(&thread->mutex);
- CLANG_DIAG_RESTORE;
+ CLANG_DIAG_RESTORE_STMT;
/* XSRETURN(1); - implied */
)
{
- GCC_DIAG_IGNORE(-Wformat-nonliteral); /* PL_warn_nl is constant */
+ GCC_DIAG_IGNORE_STMT(-Wformat-nonliteral); /* PL_warn_nl is constant */
Perl_warner(aTHX_ packWARN(WARN_NEWLINE), PL_warn_nl, "open");
- GCC_DIAG_RESTORE;
+ GCC_DIAG_RESTORE_STMT;
}
goto say_false;
}
PL_laststatval = PerlLIO_stat(d, &PL_statcache);
}
if (PL_laststatval < 0 && ckWARN(WARN_NEWLINE) && should_warn_nl(s)) {
- GCC_DIAG_IGNORE(-Wformat-nonliteral); /* PL_warn_nl is constant */
+ GCC_DIAG_IGNORE_STMT(-Wformat-nonliteral); /* PL_warn_nl is constant */
Perl_warner(aTHX_ packWARN(WARN_NEWLINE), PL_warn_nl, "stat");
- GCC_DIAG_RESTORE;
+ GCC_DIAG_RESTORE_STMT;
}
return PL_laststatval;
}
PL_laststatval = PerlLIO_lstat(file,&PL_statcache);
}
if (PL_laststatval < 0 && ckWARN(WARN_NEWLINE) && should_warn_nl(file)) {
- GCC_DIAG_IGNORE(-Wformat-nonliteral); /* PL_warn_nl is constant */
+ GCC_DIAG_IGNORE_STMT(-Wformat-nonliteral); /* PL_warn_nl is constant */
Perl_warner(aTHX_ packWARN(WARN_NEWLINE), PL_warn_nl, "lstat");
- GCC_DIAG_RESTORE;
+ GCC_DIAG_RESTORE_STMT;
}
return PL_laststatval;
}
/* allowing user-supplied (rather than literal) formats
* is normally frowned upon as a potential security risk;
* but this is part of the API so we have to allow it */
- GCC_DIAG_IGNORE(-Wformat-nonliteral);
+ GCC_DIAG_IGNORE_STMT(-Wformat-nonliteral);
buf = my_strftime(SvPV_nolen(fmt), sec, min, hour, mday, mon, year, wday, yday, isdst);
- GCC_DIAG_RESTORE;
+ GCC_DIAG_RESTORE_STMT;
sv = sv_newmortal();
if (buf) {
STRLEN len = strlen(buf);
/* ------------------------------- handy.h ------------------------------- */
/* saves machine code for a common noreturn idiom typically used in Newx*() */
-#ifdef GCC_DIAG_PRAGMA
-GCC_DIAG_IGNORE(-Wunused-function) /* Intentionally left semicolonless. */
-#endif
+GCC_DIAG_IGNORE_DECL(-Wunused-function);
static void
S_croak_memory_wrap(void)
{
Perl_croak_nocontext("%s",PL_memory_wrap);
}
-#ifdef GCC_DIAG_PRAGMA
-GCC_DIAG_RESTORE /* Intentionally left semicolonless. */
-#endif
+GCC_DIAG_RESTORE_DECL;
/* ------------------------------- utf8.h ------------------------------- */
s--;
}
}
- GCC_DIAG_IGNORE(-Wcast-qual);
+ GCC_DIAG_IGNORE_STMT(-Wcast-qual);
return (U8 *)s;
- GCC_DIAG_RESTORE;
+ GCC_DIAG_RESTORE_STMT;
}
/*
while (off--) {
STRLEN skip = UTF8SKIP(s);
if ((STRLEN)(end - s) <= skip) {
- GCC_DIAG_IGNORE(-Wcast-qual);
+ GCC_DIAG_IGNORE_STMT(-Wcast-qual);
return (U8 *)end;
- GCC_DIAG_RESTORE;
+ GCC_DIAG_RESTORE_STMT;
}
s += skip;
}
- GCC_DIAG_IGNORE(-Wcast-qual);
+ GCC_DIAG_IGNORE_STMT(-Wcast-qual);
return (U8 *)s;
- GCC_DIAG_RESTORE;
+ GCC_DIAG_RESTORE_STMT;
}
/*
s--;
}
- GCC_DIAG_IGNORE(-Wcast-qual);
+ GCC_DIAG_IGNORE_STMT(-Wcast-qual);
return (U8 *)s;
- GCC_DIAG_RESTORE;
+ GCC_DIAG_RESTORE_STMT;
}
/*
* _CHECK_AND_WARN_PROBLEMATIC_LOCALE */
if (PL_warn_locale) {
- /*GCC_DIAG_IGNORE(-Wformat-security); Didn't work */
Perl_ck_warner(aTHX_ packWARN(WARN_LOCALE),
SvPVX(PL_warn_locale),
0 /* dummy to avoid compiler warning */ );
- /* GCC_DIAG_RESTORE; */
SvREFCNT_dec_NN(PL_warn_locale);
PL_warn_locale = NULL;
}
/* on gcc (and clang), specify that a warning should be temporarily
* ignored; e.g.
*
- * GCC_DIAG_IGNORE(-Wmultichar);
+ * GCC_DIAG_IGNORE_DECL(-Wmultichar);
* char b = 'ab';
- * GCC_DIAG_RESTORE;
+ * GCC_DIAG_RESTORE_DECL;
*
* based on http://dbp-consulting.com/tutorials/SuppressingGCCWarnings.html
*
* Note that "pragma GCC diagnostic push/pop" was added in GCC 4.6, Mar 2011;
* clang only pretends to be GCC 4.2, but still supports push/pop.
*
- * Note on usage: on non-gcc (or lookalike, like clang) compilers
- * one cannot use these with a semicolon at file (global) level without
- * warnings since they are defined as empty, which leads into the terminating
- * semicolon being left alone on a line:
- * ;
- * which makes compilers mildly cranky. Therefore at file level one
- * should use the GCC_DIAG_IGNORE and GCC_DIAG_RESTORE macros *without*
- * the semicolons.
+ * Note on usage: all macros must be used at a place where a declaration
+ * or statement can occur, i.e., not in the middle of an expression.
+ * *_DIAG_IGNORE() and *_DIAG_RESTORE can be used in any such place, but
+ * must be used without a following semicolon. *_DIAG_IGNORE_DECL() and
+ * *_DIAG_RESTORE_DECL must be used with a following semicolon, and behave
+ * syntactically as declarations (like dNOOP). *_DIAG_IGNORE_STMT()
+ * and *_DIAG_RESTORE_STMT must be used with a following semicolon,
+ * and behave syntactically as statements (like NOOP).
*
- * (A dead-on-arrival solution would be to try to define the macros as
- * NOOP or dNOOP, those don't work both inside functions and outside.)
*/
#if defined(__clang__) || defined(__clang) || \
# define GCC_DIAG_IGNORE(w)
# define GCC_DIAG_RESTORE
#endif
+#define GCC_DIAG_IGNORE_DECL(x) GCC_DIAG_IGNORE(x) dNOOP
+#define GCC_DIAG_RESTORE_DECL GCC_DIAG_RESTORE dNOOP
+#define GCC_DIAG_IGNORE_STMT(x) GCC_DIAG_IGNORE(x) NOOP
+#define GCC_DIAG_RESTORE_STMT GCC_DIAG_RESTORE NOOP
/* for clang specific pragmas */
#if defined(__clang__) || defined(__clang)
# define CLANG_DIAG_PRAGMA(x) _Pragma (#x)
# define CLANG_DIAG_IGNORE(w)
# define CLANG_DIAG_RESTORE
#endif
+#define CLANG_DIAG_IGNORE_DECL(x) CLANG_DIAG_IGNORE(x) dNOOP
+#define CLANG_DIAG_RESTORE_DECL CLANG_DIAG_RESTORE dNOOP
+#define CLANG_DIAG_IGNORE_STMT(x) CLANG_DIAG_IGNORE(x) NOOP
+#define CLANG_DIAG_RESTORE_STMT CLANG_DIAG_RESTORE NOOP
#define NOOP /*EMPTY*/(void)0
/* cea2e8a9dd23747f accidentally lost the comment originally from the first
*/
/* The quadmath literals are anon structs which -Wc++-compat doesn't like. */
-GCC_DIAG_IGNORE(-Wc++-compat)
+GCC_DIAG_IGNORE_DECL(-Wc++-compat);
# ifdef USE_QUADMATH
/* Cannot use HUGE_VALQ for PL_inf because not a compile-time
# endif
# endif
-GCC_DIAG_RESTORE
+GCC_DIAG_RESTORE_DECL;
#else
* - casting the LHS to (void*) -- totally unportable
*
* So let's try silencing the warning at least for gcc. */
- GCC_DIAG_IGNORE(-Wpointer-sign);
+ GCC_DIAG_IGNORE_STMT(-Wpointer-sign);
PerlSIO_set_ptr(stdio, ptr); /* LHS STDCHAR* cast non-portable */
- GCC_DIAG_RESTORE;
+ GCC_DIAG_RESTORE_STMT;
#ifdef STDIO_PTR_LVAL_SETS_CNT
assert(PerlSIO_get_cnt(stdio) == (cnt));
#endif
}
#else
/* we generate fmt ourselves so it is safe */
- GCC_DIAG_IGNORE(-Wformat-nonliteral);
+ GCC_DIAG_IGNORE_STMT(-Wformat-nonliteral);
len = my_snprintf(t, max, fmt, (int) fieldsize, (int) arg, value);
- GCC_DIAG_RESTORE;
+ GCC_DIAG_RESTORE_STMT;
#endif
PERL_MY_SNPRINTF_POST_GUARD(len, max);
RESTORE_LC_NUMERIC();
if (PL_laststatval < 0) {
if (ckWARN(WARN_NEWLINE) && should_warn_nl(file)) {
/* PL_warn_nl is constant */
- GCC_DIAG_IGNORE(-Wformat-nonliteral);
+ GCC_DIAG_IGNORE_STMT(-Wformat-nonliteral);
Perl_warner(aTHX_ packWARN(WARN_NEWLINE), PL_warn_nl, "stat");
- GCC_DIAG_RESTORE;
+ GCC_DIAG_RESTORE_STMT;
}
max = 0;
}
*/
bool neg;
Stat_t s;
- CLANG_DIAG_IGNORE(-Wtautological-compare);
- GCC_DIAG_IGNORE(-Wtype-limits);
+ CLANG_DIAG_IGNORE_STMT(-Wtautological-compare);
+ GCC_DIAG_IGNORE_STMT(-Wtype-limits);
neg = PL_statcache.st_ino < 0;
- GCC_DIAG_RESTORE;
- CLANG_DIAG_RESTORE;
+ GCC_DIAG_RESTORE_STMT;
+ CLANG_DIAG_RESTORE_STMT;
if (neg) {
s.st_ino = (IV)PL_statcache.st_ino;
if (LIKELY(s.st_ino == PL_statcache.st_ino)) {
}
if (ckWARN(WARN_NEWLINE) && should_warn_nl(file)) {
/* PL_warn_nl is constant */
- GCC_DIAG_IGNORE(-Wformat-nonliteral);
+ GCC_DIAG_IGNORE_STMT(-Wformat-nonliteral);
Perl_warner(aTHX_ packWARN(WARN_NEWLINE), PL_warn_nl, "open");
- GCC_DIAG_RESTORE;
+ GCC_DIAG_RESTORE_STMT;
}
FT_RETURNUNDEF;
}
#else
format = "\\x%02" UVXf "-\\x%02" UVXf;
#endif
- GCC_DIAG_IGNORE(-Wformat-nonliteral);
+ GCC_DIAG_IGNORE_STMT(-Wformat-nonliteral);
Perl_sv_catpvf(aTHX_ sv, format, start, this_end);
- GCC_DIAG_RESTORE;
+ GCC_DIAG_RESTORE_STMT;
break;
}
}
/* hopefully the above makes ptr a very constrained format
* that is safe to use, even though it's not literal */
- GCC_DIAG_IGNORE(-Wformat-nonliteral);
+ GCC_DIAG_IGNORE_STMT(-Wformat-nonliteral);
#ifdef USE_QUADMATH
{
const char* qfmt = quadmath_format_single(ptr);
#else
elen = my_snprintf(PL_efloatbuf, PL_efloatsize, ptr, fv);
#endif
- GCC_DIAG_RESTORE;
+ GCC_DIAG_RESTORE_STMT;
}
eptr = PL_efloatbuf;
desc = "sort";
/* PL_warn_uninit_sv is constant */
- GCC_DIAG_IGNORE(-Wformat-nonliteral);
+ GCC_DIAG_IGNORE_STMT(-Wformat-nonliteral);
if (desc)
/* diag_listed_as: Use of uninitialized value%s */
Perl_warner(aTHX_ packWARN(WARN_UNINITIALIZED), PL_warn_uninit_sv,
else
Perl_warner(aTHX_ packWARN(WARN_UNINITIALIZED), PL_warn_uninit,
"", "", "");
- GCC_DIAG_RESTORE;
+ GCC_DIAG_RESTORE_STMT;
}
/*
/* XXX because taint_proper adds extra format args, we can't
* get the caller to check properly; o we just silence the warning
* and hope the callers aren't naughty */
- GCC_DIAG_IGNORE(-Wformat-nonliteral);
+ GCC_DIAG_IGNORE_STMT(-Wformat-nonliteral);
if (PL_unsafe || TAINT_WARN_get) {
Perl_ck_warner_d(aTHX_ packWARN(WARN_TAINT), f, s, ug);
}
else {
Perl_croak(aTHX_ f, s, ug);
}
- GCC_DIAG_RESTORE;
+ GCC_DIAG_RESTORE_STMT;
}
}
PERL_ARGS_ASSERT_PRINTBUF;
- GCC_DIAG_IGNORE(-Wformat-nonliteral); /* fmt checked by caller */
+ GCC_DIAG_IGNORE_STMT(-Wformat-nonliteral); /* fmt checked by caller */
PerlIO_printf(Perl_debug_log, fmt, pv_display(tmp, s, strlen(s), 0, 60));
- GCC_DIAG_RESTORE;
+ GCC_DIAG_RESTORE_STMT;
SvREFCNT_dec(tmp);
}
if (!*d && !gv_stashpv(PL_tokenbuf, UTF ? SVf_UTF8 : 0))
{
/* PL_warn_reserved is constant */
- GCC_DIAG_IGNORE(-Wformat-nonliteral);
+ GCC_DIAG_IGNORE_STMT(-Wformat-nonliteral);
Perl_warner(aTHX_ packWARN(WARN_RESERVED), PL_warn_reserved,
PL_tokenbuf);
- GCC_DIAG_RESTORE;
+ GCC_DIAG_RESTORE_STMT;
}
}
}
if (has_colon) {
/* "my" variable %s can't be in a package */
/* PL_no_myglob is constant */
- GCC_DIAG_IGNORE(-Wformat-nonliteral);
+ GCC_DIAG_IGNORE_STMT(-Wformat-nonliteral);
yyerror_pv(Perl_form(aTHX_ PL_no_myglob,
PL_in_my == KEY_my ? "my" : "state",
*PL_tokenbuf == '&' ? "subroutin" : "variabl",
PL_tokenbuf),
UTF ? SVf_UTF8 : 0);
- GCC_DIAG_RESTORE;
+ GCC_DIAG_RESTORE_STMT;
}
if (PL_in_my == KEY_sigvar) {
buflen = 64;
Newx(buf, buflen, char);
- GCC_DIAG_IGNORE(-Wformat-nonliteral); /* fmt checked by caller */
+ GCC_DIAG_IGNORE_STMT(-Wformat-nonliteral); /* fmt checked by caller */
len = strftime(buf, buflen, fmt, &mytm);
- GCC_DIAG_RESTORE;
+ GCC_DIAG_RESTORE_STMT;
/*
** The following is needed to handle to the situation where
Renew(buf, bufsize, char);
while (buf) {
- GCC_DIAG_IGNORE(-Wformat-nonliteral); /* fmt checked by caller */
+ GCC_DIAG_IGNORE_STMT(-Wformat-nonliteral); /* fmt checked by caller */
buflen = strftime(buf, bufsize, fmt, &mytm);
- GCC_DIAG_RESTORE;
+ GCC_DIAG_RESTORE_STMT;
if (buflen > 0 && buflen < bufsize)
break;