TAINT_ENV();
TAINT_PROPER("piped open");
if (name[strlen(name)-1] == '|') {
+ dTHR;
name[strlen(name)-1] = '\0' ;
if (ckWARN(WARN_PIPE))
warner(WARN_PIPE, "Can't do bidirectional pipe");
}
}
if (!fp) {
+ dTHR;
if (ckWARN(WARN_NEWLINE) && IoTYPE(io) == '<' && strchr(name, '\n'))
warner(WARN_NEWLINE, warn_nl, "open");
goto say_false;
io = GvIO(gv);
if (!io) { /* never opened */
if (not_implicit) {
+ dTHR;
if (ckWARN(WARN_UNOPENED))
warner(WARN_UNOPENED,
"Close on unopened file <%s>",GvENAME(gv));
#endif
return PerlIO_tell(fp);
}
- if (ckWARN(WARN_UNOPENED))
- warner(WARN_UNOPENED, "tell() on unopened file");
+ {
+ dTHR;
+ if (ckWARN(WARN_UNOPENED))
+ warner(WARN_UNOPENED, "tell() on unopened file");
+ }
SETERRNO(EBADF,RMS$_IFI);
return -1L;
}
#endif
return PerlIO_seek(fp, pos, whence) >= 0;
}
- if (ckWARN(WARN_UNOPENED))
- warner(WARN_UNOPENED, "seek() on unopened file");
+ {
+ dTHR;
+ if (ckWARN(WARN_UNOPENED))
+ warner(WARN_UNOPENED, "seek() on unopened file");
+ }
SETERRNO(EBADF,RMS$_IFI);
return FALSE;
}
if (gv && (io = GvIO(gv)) && (fp = IoIFP(io)))
return PerlLIO_lseek(PerlIO_fileno(fp), pos, whence);
- if (ckWARN(WARN_UNOPENED))
- warner(WARN_UNOPENED, "sysseek() on unopened file");
+ {
+ dTHR;
+ if (ckWARN(WARN_UNOPENED))
+ warner(WARN_UNOPENED, "sysseek() on unopened file");
+ }
SETERRNO(EBADF,RMS$_IFI);
return -1L;
}
}
switch (SvTYPE(sv)) {
case SVt_NULL:
- if (ckWARN(WARN_UNINITIALIZED))
- warner(WARN_UNINITIALIZED, warn_uninit);
+ {
+ dTHR;
+ if (ckWARN(WARN_UNINITIALIZED))
+ warner(WARN_UNINITIALIZED, warn_uninit);
+ }
return TRUE;
case SVt_IV:
if (SvIOK(sv)) {
do_execfree();
goto doshell;
}
- if (ckWARN(WARN_EXEC))
- warner(WARN_EXEC, "Can't exec \"%s\": %s",
- PL_Argv[0], Strerror(errno));
+ {
+ dTHR;
+ if (ckWARN(WARN_EXEC))
+ warner(WARN_EXEC, "Can't exec \"%s\": %s",
+ PL_Argv[0], Strerror(errno));
+ }
}
do_execfree();
return FALSE;
SV* sv = *svp++;
HV* basestash = gv_stashsv(sv, FALSE);
if (!basestash) {
+ dTHR; /* just for ckWARN */
if (ckWARN(WARN_MISC))
warner(WARN_MISC, "Can't locate package %s for @%s::ISA",
SvPVX(sv), HvNAME(stash));
GV*
gv_autoload4(HV *stash, char *name, STRLEN len, I32 method)
{
+ dTHR;
static char autoload[] = "AUTOLOAD";
static STRLEN autolen = 8;
GV* gv;
STATIC OP *
scalarboolean(OP *o)
{
- if (ckWARN(WARN_SYNTAX) &&
- o->op_type == OP_SASSIGN && cBINOPo->op_first->op_type == OP_CONST) {
+ if (o->op_type == OP_SASSIGN && cBINOPo->op_first->op_type == OP_CONST) {
dTHR;
- line_t oldline = PL_curcop->cop_line;
+ if (ckWARN(WARN_SYNTAX)) {
+ line_t oldline = PL_curcop->cop_line;
- if (PL_copline != NOLINE)
- PL_curcop->cop_line = PL_copline;
- warner(WARN_SYNTAX, "Found = in conditional, should be ==");
- PL_curcop->cop_line = oldline;
+ if (PL_copline != NOLINE)
+ PL_curcop->cop_line = PL_copline;
+ warner(WARN_SYNTAX, "Found = in conditional, should be ==");
+ PL_curcop->cop_line = oldline;
+ }
}
return scalar(o);
}
case OP_CONST:
sv = cSVOPo->op_sv;
- if (ckWARN(WARN_VOID)) {
- useless = "a constant";
- if (SvNIOK(sv) && (SvNV(sv) == 0.0 || SvNV(sv) == 1.0))
- useless = 0;
- else if (SvPOK(sv)) {
- if (strnEQ(SvPVX(sv), "di", 2) ||
- strnEQ(SvPVX(sv), "ds", 2) ||
- strnEQ(SvPVX(sv), "ig", 2))
- useless = 0;
+ {
+ dTHR;
+ if (ckWARN(WARN_VOID)) {
+ useless = "a constant";
+ if (SvNIOK(sv) && (SvNV(sv) == 0.0 || SvNV(sv) == 1.0))
+ useless = 0;
+ else if (SvPOK(sv)) {
+ if (strnEQ(SvPVX(sv), "di", 2) ||
+ strnEQ(SvPVX(sv), "ds", 2) ||
+ strnEQ(SvPVX(sv), "ig", 2))
+ useless = 0;
+ }
}
}
null(o); /* don't execute a constant */
}
break;
}
- if (useless && ckWARN(WARN_VOID))
- warner(WARN_VOID, "Useless use of %s in void context", useless);
+ if (useless) {
+ dTHR;
+ if (ckWARN(WARN_VOID))
+ warner(WARN_VOID, "Useless use of %s in void context", useless);
+ }
return o;
}
OP *
bind_match(I32 type, OP *left, OP *right)
{
+ dTHR;
OP *o;
if (ckWARN(WARN_UNSAFE) &&
if (o->op_flags & OPf_PARENS)
list(o);
else {
+ dTHR;
if (ckWARN(WARN_PARENTHESIS) && PL_bufptr > PL_oldbufptr && PL_bufptr[-1] == ',') {
char *s;
for (s = PL_bufptr; *s && (isALNUM(*s) || strchr("@$%, ",*s)); s++) ;
if (SvPOKp(sv) && SvLEN(sv))
return asIV(sv);
if (!SvROK(sv)) {
- if (ckWARN(WARN_UNINITIALIZED) && !(SvFLAGS(sv) & SVs_PADTMP)) {
+ if (!(SvFLAGS(sv) & SVs_PADTMP)) {
dTHR;
- if (!PL_localizing)
+ if (ckWARN(WARN_UNINITIALIZED) && !PL_localizing)
warner(WARN_UNINITIALIZED, warn_uninit);
}
return 0;
}
if (SvPOKp(sv) && SvLEN(sv))
return asIV(sv);
- if (ckWARN(WARN_UNINITIALIZED))
- warner(WARN_UNINITIALIZED, warn_uninit);
+ {
+ dTHR;
+ if (ckWARN(WARN_UNINITIALIZED))
+ warner(WARN_UNINITIALIZED, warn_uninit);
+ }
return 0;
}
}
if (SvPOKp(sv) && SvLEN(sv))
return asUV(sv);
if (!SvROK(sv)) {
- if (ckWARN(WARN_UNINITIALIZED) && !(SvFLAGS(sv) & SVs_PADTMP)) {
+ if (!(SvFLAGS(sv) & SVs_PADTMP)) {
dTHR;
- if (!PL_localizing)
+ if (ckWARN(WARN_UNINITIALIZED) && !PL_localizing)
warner(WARN_UNINITIALIZED, warn_uninit);
}
return 0;
}
if (SvPOKp(sv) && SvLEN(sv))
return asUV(sv);
- if (ckWARN(WARN_UNINITIALIZED))
- warner(WARN_UNINITIALIZED, warn_uninit);
+ {
+ dTHR;
+ if (ckWARN(WARN_UNINITIALIZED))
+ warner(WARN_UNINITIALIZED, warn_uninit);
+ }
return 0;
}
}
SvUVX(sv) = asUV(sv);
}
else {
- if (ckWARN(WARN_UNINITIALIZED) && !(SvFLAGS(sv) & SVs_PADTMP)) {
+ if (!(SvFLAGS(sv) & SVs_PADTMP)) {
dTHR;
- if (!PL_localizing)
+ if (ckWARN(WARN_UNINITIALIZED) && !PL_localizing)
warner(WARN_UNINITIALIZED, warn_uninit);
}
return 0;
if (SvNOKp(sv))
return SvNVX(sv);
if (SvPOKp(sv) && SvLEN(sv)) {
+ dTHR;
if (ckWARN(WARN_NUMERIC) && !SvIOKp(sv) && !looks_like_number(sv))
not_a_number(sv);
SET_NUMERIC_STANDARD();
if (SvIOKp(sv))
return (double)SvIVX(sv);
if (!SvROK(sv)) {
- if (ckWARN(WARN_UNINITIALIZED) && !(SvFLAGS(sv) & SVs_PADTMP)) {
+ if (!(SvFLAGS(sv) & SVs_PADTMP)) {
dTHR;
- if (!PL_localizing)
+ if (ckWARN(WARN_UNINITIALIZED) && !PL_localizing)
warner(WARN_UNINITIALIZED, warn_uninit);
}
return 0;
return (double)(unsigned long)SvRV(sv);
}
if (SvREADONLY(sv)) {
+ dTHR;
if (SvPOKp(sv) && SvLEN(sv)) {
if (ckWARN(WARN_NUMERIC) && !SvIOKp(sv) && !looks_like_number(sv))
not_a_number(sv);
SvNVX(sv) = (double)SvIVX(sv);
}
else if (SvPOKp(sv) && SvLEN(sv)) {
+ dTHR;
if (ckWARN(WARN_NUMERIC) && !SvIOKp(sv) && !looks_like_number(sv))
not_a_number(sv);
SET_NUMERIC_STANDARD();
if (numtype == 1)
return atol(SvPVX(sv));
- if (!numtype && ckWARN(WARN_NUMERIC))
- not_a_number(sv);
+ if (!numtype) {
+ dTHR;
+ if (ckWARN(WARN_NUMERIC))
+ not_a_number(sv);
+ }
SET_NUMERIC_STANDARD();
d = atof(SvPVX(sv));
if (d < 0.0)
if (numtype == 1)
return strtoul(SvPVX(sv), Null(char**), 10);
#endif
- if (!numtype && ckWARN(WARN_NUMERIC))
- not_a_number(sv);
+ if (!numtype) {
+ dTHR;
+ if (ckWARN(WARN_NUMERIC))
+ not_a_number(sv);
+ }
SET_NUMERIC_STANDARD();
return U_V(atof(SvPVX(sv)));
}
goto tokensave;
}
if (!SvROK(sv)) {
- if (ckWARN(WARN_UNINITIALIZED) && !(SvFLAGS(sv) & SVs_PADTMP)) {
+ if (!(SvFLAGS(sv) & SVs_PADTMP)) {
dTHR;
- if (!PL_localizing)
+ if (ckWARN(WARN_UNINITIALIZED) && !PL_localizing)
warner(WARN_UNINITIALIZED, warn_uninit);
}
*lp = 0;
tsv = Nullsv;
goto tokensave;
}
- if (ckWARN(WARN_UNINITIALIZED))
- warner(WARN_UNINITIALIZED, warn_uninit);
+ {
+ dTHR;
+ if (ckWARN(WARN_UNINITIALIZED))
+ warner(WARN_UNINITIALIZED, warn_uninit);
+ }
*lp = 0;
return "";
}
########
# mg.c
use warning 'signal' ;
+$|=1;
$SIG{"INT"} = "fred"; kill "INT",$$;
EXPECT
SIGINT handler "fred" not defined.
use warning 'unsafe' ;
$_ = 'a' x (2**15+1);
/^()(a\1)*$/ ;
+#
+# If this test fails with a segmentation violation or similar,
+# you may have to increase the default stacksize limit in your
+# shell. You may need superuser privileges.
+#
+# Under the sh, ksh, zsh:
+# $ ulimit -s
+# 8192
+# $ ulimit -s 16000
+#
+# Under the csh:
+# % limit stacksize
+# stacksize 8192 kbytes
+# % limit stacksize 16000
+#
EXPECT
-count exceeded 32766 at - line 4.
+Complex regular subexpression recursion limit (32766) exceeded at - line 4.
########
# regexec.c
use warning 'unsafe' ;
$_ = 'a' x (2**15+1);
/^()(a\1)*?$/ ;
+#
+# If this test fails with a segmentation violation or similar,
+# you may have to increase the default stacksize limit in your
+# shell. You may need superuser privileges.
+#
+# Under the sh, ksh, zsh:
+# $ ulimit -s
+# 8192
+# $ ulimit -s 16000
+#
+# Under the csh:
+# % limit stacksize
+# stacksize 8192 kbytes
+# % limit stacksize 16000
+#
EXPECT
Complex regular subexpression recursion limit (32766) exceeded at - line 4.
void
deprecate(char *s)
{
+ dTHR;
if (ckWARN(WARN_DEPRECATED))
warner(WARN_DEPRECATED, "Use of %s is deprecated", s);
}
/* (now in tr/// code again) */
- if (*s & 0x80 && ckWARN(WARN_UTF8) && thisutf) {
- (void)utf8_to_uv(s, &len); /* could cvt latin-1 to utf8 here... */
- if (len) {
- while (len--)
- *d++ = *s++;
- continue;
+ if (*s & 0x80 && thisutf) {
+ dTHR; /* only for ckWARN */
+ if (ckWARN(WARN_UTF8)) {
+ (void)utf8_to_uv(s, &len); /* could cvt latin-1 to utf8 here... */
+ if (len) {
+ while (len--)
+ *d++ = *s++;
+ continue;
+ }
}
}
if (PL_lex_inwhat == OP_SUBST && !PL_lex_inpat &&
isDIGIT(*s) && *s != '0' && !isDIGIT(s[1]))
{
+ dTHR; /* only for ckWARN */
if (ckWARN(WARN_SYNTAX))
warner(WARN_SYNTAX, "\\%c better written as $%c", *s, *s);
*--s = '$';
if (!e)
yyerror("Missing right brace on \\x{}");
- if (ckWARN(WARN_UTF8) && !utf)
- warner(WARN_UTF8,"Use of \\x{} without utf8 declaration");
+ if (!utf) {
+ dTHR;
+ if (ckWARN(WARN_UTF8))
+ warner(WARN_UTF8,
+ "Use of \\x{} without utf8 declaration");
+ }
/* note: utf always shorter than hex */
d = uv_to_utf8(d, scan_hex(s + 1, e - s - 1, &len));
s = e + 1;
d = uv_to_utf8(d, uv); /* doing a CU or UC */
}
else {
- if (ckWARN(WARN_UTF8) && uv >= 127 && UTF)
- warner(WARN_UTF8,
- "\\x%.*s will produce malformed UTF-8 character; use \\x{%.*s} for that",
- len,s,len,s);
+ if (uv >= 127 && UTF) {
+ dTHR;
+ if (ckWARN(WARN_UTF8))
+ warner(WARN_UTF8,
+ "\\x%.*s will produce malformed UTF-8 character; use \\x{%.*s} for that",
+ len,s,len,s);
+ }
*d++ = (char)uv;
}
s += len;
{
char *w;
- if (ckWARN(WARN_SYNTAX) && *s == ' ' && s[1] == '(') { /* XXX gotta be a better way */
- int level = 1;
- for (w = s+2; *w && level; w++) {
- if (*w == '(')
- ++level;
- else if (*w == ')')
- --level;
- }
- if (*w)
- for (; *w && isSPACE(*w); w++) ;
- if (!*w || !strchr(";|})]oaiuw!=", *w)) /* an advisory hack only... */
- warner(WARN_SYNTAX, "%s (...) interpreted as function",name);
+ if (*s == ' ' && s[1] == '(') { /* XXX gotta be a better way */
+ dTHR; /* only for ckWARN */
+ if (ckWARN(WARN_SYNTAX)) {
+ int level = 1;
+ for (w = s+2; *w && level; w++) {
+ if (*w == '(')
+ ++level;
+ else if (*w == ')')
+ --level;
+ }
+ if (*w)
+ for (; *w && isSPACE(*w); w++) ;
+ if (!*w || !strchr(";|})]oaiuw!=", *w)) /* an advisory hack only... */
+ warner(WARN_SYNTAX, "%s (...) interpreted as function",name);
+ }
}
while (s < PL_bufend && isSPACE(*s))
s++;
*d = '\0';
while (s < send && (*s == ' ' || *s == '\t')) s++;
if ((*s == '[' || (*s == '{' && strNE(dest, "sub")))) {
+ dTHR; /* only for ckWARN */
if (ckWARN(WARN_AMBIGUOUS) && keyword(dest, d - dest)) {
char *brack = *s == '[' ? "[...]" : "{...}";
warner(WARN_AMBIGUOUS,
PL_lex_state = LEX_INTERPEND;
if (funny == '#')
funny = '@';
- if (ckWARN(WARN_AMBIGUOUS) && PL_lex_state == LEX_NORMAL &&
- (keyword(dest, d - dest) || perl_get_cv(dest, FALSE)))
- warner(WARN_AMBIGUOUS,
- "Ambiguous use of %c{%s} resolved to %c%s",
- funny, dest, funny, dest);
+ if (PL_lex_state == LEX_NORMAL) {
+ dTHR; /* only for ckWARN */
+ if (ckWARN(WARN_AMBIGUOUS) &&
+ (keyword(dest, d - dest) || perl_get_cv(dest, FALSE)))
+ {
+ warner(WARN_AMBIGUOUS,
+ "Ambiguous use of %c{%s} resolved to %c%s",
+ funny, dest, funny, dest);
+ }
+ }
}
else {
s = bracket; /* let the parser handle it */
if -w is on
*/
if (*s == '_') {
+ dTHR; /* only for ckWARN */
if (ckWARN(WARN_SYNTAX) && lastub && s - lastub != 3)
warner(WARN_SYNTAX, "Misplaced _ in number");
lastub = ++s;
}
/* final misplaced underbar check */
- if (ckWARN(WARN_SYNTAX) && lastub && s - lastub != 3)
- warner(WARN_SYNTAX, "Misplaced _ in number");
+ if (lastub && s - lastub != 3) {
+ dTHR;
+ if (ckWARN(WARN_SYNTAX))
+ warner(WARN_SYNTAX, "Misplaced _ in number");
+ }
/* read a decimal portion if there is one. avoid
3..5 being interpreted as the number 3. followed
SV* sv = *svp++;
HV* basestash = gv_stashsv(sv, FALSE);
if (!basestash) {
+ dTHR;
if (ckWARN(WARN_MISC))
warner(WARN_SYNTAX,
"Can't locate package %s for @%s::ISA",
void
warner(U32 err, const char* pat,...)
{
+ dTHR;
va_list args;
char *message;
HV *stash;
if (ckDEAD(err)) {
#ifdef USE_THREADS
- DEBUG_L(PerlIO_printf(PerlIO_stderr(), "croak: 0x%lx %s", (unsigned long) thr, message));
+ DEBUG_S(PerlIO_printf(PerlIO_stderr(), "croak: 0x%lx %s", (unsigned long) thr, message));
#endif /* USE_THREADS */
if (PL_diehook) {
/* sv_2cv might call croak() */
retval = n | (*s++ - '0');
len--;
}
- if (len && (*s == '8' || *s == '9') && ckWARN(WARN_OCTAL))
- warner(WARN_OCTAL, "Illegal octal digit ignored");
+ if (len && (*s == '8' || *s == '9')) {
+ dTHR;
+ if (ckWARN(WARN_OCTAL))
+ warner(WARN_OCTAL, "Illegal octal digit ignored");
+ }
*retlen = s - start;
return retval;
}
if (*s == '_')
continue;
else {
+ dTHR;
--s;
if (ckWARN(WARN_UNSAFE))
warner(WARN_UNSAFE,"Illegal hex digit ignored");