PL_compiling.cop_warnings = pWARN_NONE;
break;
}
- if (isWARN_on(sv, WARN_ALL)) {
+ if (isWARN_on(sv, WARN_ALL) && !isWARNf_on(sv, WARN_ALL)) {
PL_compiling.cop_warnings = pWARN_ALL;
PL_dowarn |= G_WARN_ONCE ;
}
Use of EQ is deprecated at - line 8.
########
+# Check compile time warning
+use warnings FATAL => 'all' ;
+{
+ no warnings ;
+ 1 if $a EQ $b ;
+}
+1 if $a EQ $b ;
+print STDERR "The End.\n" ;
+EXPECT
+Use of EQ is deprecated at - line 8.
+########
+
# Check runtime scope of pragma
use warnings FATAL => 'uninitialized' ;
{
########
# Check runtime scope of pragma
+use warnings FATAL => 'all' ;
+{
+ no warnings ;
+ my $b ; chop $b ;
+}
+my $b ; chop $b ;
+print STDERR "The End.\n" ;
+EXPECT
+Use of uninitialized value in scalar chop at - line 8.
+########
+
+# Check runtime scope of pragma
no warnings ;
{
use warnings FATAL => 'uninitialized' ;
Use of uninitialized value in scalar chop at - line 6.
########
+# Check runtime scope of pragma
+no warnings ;
+{
+ use warnings FATAL => 'all' ;
+ $a = sub { my $b ; chop $b ; }
+}
+&$a ;
+print STDERR "The End.\n" ;
+EXPECT
+Use of uninitialized value in scalar chop at - line 6.
+########
+
--FILE-- abc
1 if $a EQ $b ;
1;
#define specialWARN(x) ((x) == pWARN_STD || (x) == pWARN_ALL || \
(x) == pWARN_NONE)
-
-#define ckDEAD(x) \
- ( ! specialWARN(PL_curcop->cop_warnings) && \
- IsSet(SvPVX(PL_curcop->cop_warnings), 2*x+1))
-
-#define ckWARN(x) \
- ( (PL_curcop->cop_warnings != pWARN_STD && \
- PL_curcop->cop_warnings != pWARN_NONE && \
- (PL_curcop->cop_warnings == pWARN_ALL || \
- IsSet(SvPVX(PL_curcop->cop_warnings), 2*x) ) ) \
- || (PL_curcop->cop_warnings == pWARN_STD && PL_dowarn & G_WARN_ON) )
-
-#define ckWARN2(x,y) \
- ( (PL_curcop->cop_warnings != pWARN_STD && \
- PL_curcop->cop_warnings != pWARN_NONE && \
- (PL_curcop->cop_warnings == pWARN_ALL || \
- IsSet(SvPVX(PL_curcop->cop_warnings), 2*x) || \
- IsSet(SvPVX(PL_curcop->cop_warnings), 2*y) ) ) \
- || (PL_curcop->cop_warnings == pWARN_STD && PL_dowarn & G_WARN_ON) )
-
-#define ckWARN_d(x) \
- (PL_curcop->cop_warnings == pWARN_STD || \
- PL_curcop->cop_warnings == pWARN_ALL || \
- (PL_curcop->cop_warnings != pWARN_NONE && \
- IsSet(SvPVX(PL_curcop->cop_warnings), 2*x) ) )
-
-#define ckWARN2_d(x,y) \
- (PL_curcop->cop_warnings == pWARN_STD || \
- PL_curcop->cop_warnings == pWARN_ALL || \
- (PL_curcop->cop_warnings != pWARN_NONE && \
- (IsSet(SvPVX(PL_curcop->cop_warnings), 2*x) || \
- IsSet(SvPVX(PL_curcop->cop_warnings), 2*y) ) ) )
-
-
-#define isLEXWARN_on (PL_curcop->cop_warnings != pWARN_STD)
-#define isLEXWARN_off (PL_curcop->cop_warnings == pWARN_STD)
-#define isWARN_ONCE (PL_dowarn & (G_WARN_ON|G_WARN_ONCE))
-#define isWARN_on(c,x) (IsSet(SvPVX(c), 2*(x)))
-
#define WARN_ALL 0
#define WARN_CHMOD 1
#define WARN_CLOSURE 2
#define WARN_ALLstring "\125\125\125\125\125\125\125\125\125\125\125\125"
#define WARN_NONEstring "\0\0\0\0\0\0\0\0\0\0\0\0"
+#define isLEXWARN_on (PL_curcop->cop_warnings != pWARN_STD)
+#define isLEXWARN_off (PL_curcop->cop_warnings == pWARN_STD)
+#define isWARN_ONCE (PL_dowarn & (G_WARN_ON|G_WARN_ONCE))
+#define isWARN_on(c,x) (IsSet(SvPVX(c), 2*(x)))
+#define isWARNf_on(c,x) (IsSet(SvPVX(c), 2*(x)+1))
+
+#define ckDEAD(x) \
+ ( ! specialWARN(PL_curcop->cop_warnings) && \
+ ( isWARNf_on(PL_curcop->cop_warnings, WARN_ALL) || \
+ isWARNf_on(PL_curcop->cop_warnings, x)))
+
+#define ckWARN(x) \
+ ( (isLEXWARN_on && PL_curcop->cop_warnings != pWARN_NONE && \
+ (PL_curcop->cop_warnings == pWARN_ALL || \
+ isWARN_on(PL_curcop->cop_warnings, x) ) ) \
+ || (isLEXWARN_off && PL_dowarn & G_WARN_ON) )
+
+#define ckWARN2(x,y) \
+ ( (isLEXWARN_on && PL_curcop->cop_warnings != pWARN_NONE && \
+ (PL_curcop->cop_warnings == pWARN_ALL || \
+ isWARN_on(PL_curcop->cop_warnings, x) || \
+ isWARN_on(PL_curcop->cop_warnings, y) ) ) \
+ || (isLEXWARN_off && PL_dowarn & G_WARN_ON) )
+
+#define ckWARN_d(x) \
+ (isLEXWARN_off || PL_curcop->cop_warnings == pWARN_ALL || \
+ (PL_curcop->cop_warnings != pWARN_NONE && \
+ isWARN_on(PL_curcop->cop_warnings, x) ) )
+
+#define ckWARN2_d(x,y) \
+ (isLEXWARN_off || PL_curcop->cop_warnings == pWARN_ALL || \
+ (PL_curcop->cop_warnings != pWARN_NONE && \
+ (isWARN_on(PL_curcop->cop_warnings, x) || \
+ isWARN_on(PL_curcop->cop_warnings, y) ) ) )
+
/* end of file warnings.h */
#define specialWARN(x) ((x) == pWARN_STD || (x) == pWARN_ALL || \
(x) == pWARN_NONE)
-
-#define ckDEAD(x) \
- ( ! specialWARN(PL_curcop->cop_warnings) && \
- IsSet(SvPVX(PL_curcop->cop_warnings), 2*x+1))
-
-#define ckWARN(x) \
- ( (PL_curcop->cop_warnings != pWARN_STD && \
- PL_curcop->cop_warnings != pWARN_NONE && \
- (PL_curcop->cop_warnings == pWARN_ALL || \
- IsSet(SvPVX(PL_curcop->cop_warnings), 2*x) ) ) \
- || (PL_curcop->cop_warnings == pWARN_STD && PL_dowarn & G_WARN_ON) )
-
-#define ckWARN2(x,y) \
- ( (PL_curcop->cop_warnings != pWARN_STD && \
- PL_curcop->cop_warnings != pWARN_NONE && \
- (PL_curcop->cop_warnings == pWARN_ALL || \
- IsSet(SvPVX(PL_curcop->cop_warnings), 2*x) || \
- IsSet(SvPVX(PL_curcop->cop_warnings), 2*y) ) ) \
- || (PL_curcop->cop_warnings == pWARN_STD && PL_dowarn & G_WARN_ON) )
-
-#define ckWARN_d(x) \
- (PL_curcop->cop_warnings == pWARN_STD || \
- PL_curcop->cop_warnings == pWARN_ALL || \
- (PL_curcop->cop_warnings != pWARN_NONE && \
- IsSet(SvPVX(PL_curcop->cop_warnings), 2*x) ) )
-
-#define ckWARN2_d(x,y) \
- (PL_curcop->cop_warnings == pWARN_STD || \
- PL_curcop->cop_warnings == pWARN_ALL || \
- (PL_curcop->cop_warnings != pWARN_NONE && \
- (IsSet(SvPVX(PL_curcop->cop_warnings), 2*x) || \
- IsSet(SvPVX(PL_curcop->cop_warnings), 2*y) ) ) )
-
-
-#define isLEXWARN_on (PL_curcop->cop_warnings != pWARN_STD)
-#define isLEXWARN_off (PL_curcop->cop_warnings == pWARN_STD)
-#define isWARN_ONCE (PL_dowarn & (G_WARN_ON|G_WARN_ONCE))
-#define isWARN_on(c,x) (IsSet(SvPVX(c), 2*(x)))
-
EOM
my $offset = 0 ;
print WARN <<'EOM';
+#define isLEXWARN_on (PL_curcop->cop_warnings != pWARN_STD)
+#define isLEXWARN_off (PL_curcop->cop_warnings == pWARN_STD)
+#define isWARN_ONCE (PL_dowarn & (G_WARN_ON|G_WARN_ONCE))
+#define isWARN_on(c,x) (IsSet(SvPVX(c), 2*(x)))
+#define isWARNf_on(c,x) (IsSet(SvPVX(c), 2*(x)+1))
+
+#define ckDEAD(x) \
+ ( ! specialWARN(PL_curcop->cop_warnings) && \
+ ( isWARNf_on(PL_curcop->cop_warnings, WARN_ALL) || \
+ isWARNf_on(PL_curcop->cop_warnings, x)))
+
+#define ckWARN(x) \
+ ( (isLEXWARN_on && PL_curcop->cop_warnings != pWARN_NONE && \
+ (PL_curcop->cop_warnings == pWARN_ALL || \
+ isWARN_on(PL_curcop->cop_warnings, x) ) ) \
+ || (isLEXWARN_off && PL_dowarn & G_WARN_ON) )
+
+#define ckWARN2(x,y) \
+ ( (isLEXWARN_on && PL_curcop->cop_warnings != pWARN_NONE && \
+ (PL_curcop->cop_warnings == pWARN_ALL || \
+ isWARN_on(PL_curcop->cop_warnings, x) || \
+ isWARN_on(PL_curcop->cop_warnings, y) ) ) \
+ || (isLEXWARN_off && PL_dowarn & G_WARN_ON) )
+
+#define ckWARN_d(x) \
+ (isLEXWARN_off || PL_curcop->cop_warnings == pWARN_ALL || \
+ (PL_curcop->cop_warnings != pWARN_NONE && \
+ isWARN_on(PL_curcop->cop_warnings, x) ) )
+
+#define ckWARN2_d(x,y) \
+ (isLEXWARN_off || PL_curcop->cop_warnings == pWARN_ALL || \
+ (PL_curcop->cop_warnings != pWARN_NONE && \
+ (isWARN_on(PL_curcop->cop_warnings, x) || \
+ isWARN_on(PL_curcop->cop_warnings, y) ) ) )
+
/* end of file warnings.h */
EOM