diff options
author | Paul Marquess <paul.marquess@btinternet.com> | 1998-07-29 10:28:45 +0100 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1998-08-09 11:31:53 +0000 |
commit | 599cee73f2261c5e09cde7ceba3f9a896989e117 (patch) | |
tree | ca10c96d845fe755d35da930b1935926856e99b9 /warning.h | |
parent | 33938b7370f825af073cea6d9fadf7e82857ec9c (diff) | |
download | perl-599cee73f2261c5e09cde7ceba3f9a896989e117.tar.gz |
lexical warnings; tweaks to places that didn't apply correctly
Message-Id: <9807290828.AA26286@claudius.bfsec.bt.co.uk>
Subject: lexical warnings patch for 5.005_50
p4raw-id: //depot/perl@1773
Diffstat (limited to 'warning.h')
-rw-r--r-- | warning.h | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/warning.h b/warning.h new file mode 100644 index 0000000000..235c075518 --- /dev/null +++ b/warning.h @@ -0,0 +1,100 @@ +/* !!!!!!! DO NOT EDIT THIS FILE !!!!!!! + This file is built by warning.pl + Any changes made here will be lost! +*/ + + +#define Off(x) ((x) / 8) +#define Bit(x) (1 << ((x) % 8)) +#define IsSet(a, x) ((a)[Off(x)] & Bit(x)) + +#define G_WARN_OFF 0 /* $^W == 0 */ +#define G_WARN_ON 1 /* $^W != 0 */ +#define G_WARN_ALL_ON 2 /* -W flag */ +#define G_WARN_ALL_OFF 4 /* -X flag */ +#define G_WARN_ALL_MASK (G_WARN_ALL_ON|G_WARN_ALL_OFF) + +#if 1 + +/* Part of the logic below assumes that WARN_NONE is NULL */ + +#define ckDEAD(x) \ + (curcop->cop_warnings != WARN_ALL && \ + curcop->cop_warnings != WARN_NONE && \ + IsSet(SvPVX(curcop->cop_warnings), 2*x+1)) + +#define ckWARN(x) \ + ( (curcop->cop_warnings && \ + (curcop->cop_warnings == WARN_ALL || \ + IsSet(SvPVX(curcop->cop_warnings), 2*x) ) ) \ + || (PL_dowarn & G_WARN_ON) ) + +#define ckWARN2(x,y) \ + ( (curcop->cop_warnings && \ + (curcop->cop_warnings == WARN_ALL || \ + IsSet(SvPVX(curcop->cop_warnings), 2*x) || \ + IsSet(SvPVX(curcop->cop_warnings), 2*y) ) ) \ + || (PL_dowarn & G_WARN_ON) ) + +#else + +#define ckDEAD(x) \ + (curcop->cop_warnings != WARN_ALL && \ + curcop->cop_warnings != WARN_NONE && \ + SvPVX(curcop->cop_warnings)[Off(2*x+1)] & Bit(2*x+1) ) + +#define ckWARN(x) \ + ( (PL_dowarn & G_WARN_ON) || ( (PL_dowarn & G_WARN_DISABLE) && \ + curcop->cop_warnings && \ + ( curcop->cop_warnings == WARN_ALL || \ + SvPVX(curcop->cop_warnings)[Off(2*x)] & Bit(2*x) ) ) ) + +#define ckWARN2(x,y) \ + ( (PL_dowarn & G_WARN_ON) || ( (PL_dowarn & G_WARN_DISABLE) && \ + curcop->cop_warnings && \ + ( curcop->cop_warnings == WARN_ALL || \ + SvPVX(curcop->cop_warnings)[Off(2*x)] & Bit(2*x) || \ + SvPVX(curcop->cop_warnings)[Off(2*y)] & Bit(2*y) ) ) ) + +#endif + +#define WARN_NONE NULL +#define WARN_ALL (&sv_yes) + +#define WARN_REDEFINE 0 +#define WARN_VOID 1 +#define WARN_UNSAFE 2 +#define WARN_TAINT 3 +#define WARN_SUBSTR 4 +#define WARN_CLOSURE 5 +#define WARN_UNTIE 6 +#define WARN_SIGNAL 7 +#define WARN_UTF8 8 +#define WARN_NUMERIC 9 +#define WARN_DEFAULT 10 +#define WARN_ONCE 11 +#define WARN_SYNTAX 12 +#define WARN_RESERVED 13 +#define WARN_DEPRECATED 14 +#define WARN_SEMICOLON 15 +#define WARN_PRINTF 16 +#define WARN_OCTAL 17 +#define WARN_AMBIGUOUS 18 +#define WARN_PARENTHESIS 19 +#define WARN_PRECEDENCE 20 +#define WARN_IO 21 +#define WARN_NEWLINE 22 +#define WARN_CLOSED 23 +#define WARN_EXEC 24 +#define WARN_UNOPENED 25 +#define WARN_PIPE 26 +#define WARN_UNINITIALIZED 27 +#define WARN_RECURSION 28 +#define WARN_MISC 29 + +#define WARNsize 8 +#define WARN_ALLstring "\125\125\125\125\125\125\125\125" +#define WARN_NONEstring "\0\0\0\0\0\0\0\0" + +/* end of file warning.h */ + |