From: Tkil <tkil@reptile.scrye.com>
Date: Thu, 4 Dec 1997 02:38:26 +0000 (-0700)
Subject: [win32] merge another conflicting maintpatch to op.c
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2c4aebbdec0f7c22369f4986d7cad0139e4dd272;p=p5sagit%2Fp5-mst-13.2.git

[win32] merge another conflicting maintpatch to op.c
	    #17:  "Enhanced "use strict" warning"
	 Msg-ID:  <199712040938.CAA07628@reptile.scrye.com>
	  Files:  gv.c t/pragma/strict-subs t/pragma/strict-vars

p4raw-id: //depot/win32/perl@640
---

diff --git a/gv.c b/gv.c
index 11dc761..c0c671d 100644
--- a/gv.c
+++ b/gv.c
@@ -531,7 +531,15 @@ gv_fetchpv(char *nambeg, I32 add, I32 sv_type)
 
     if (!stash) {
 	if (add) {
-	    warn("Global symbol \"%s\" requires explicit package name", name);
+	    char sv_type_char = ((sv_type == SVt_PV) ? '$'
+				 : (sv_type == SVt_PVAV) ? '@'
+				 : (sv_type == SVt_PVHV) ? '%'
+				 : 0);
+	    if (sv_type_char) 
+		warn("Global symbol \"%c%s\" requires explicit package name",
+		     sv_type_char, name);
+	    else
+		warn("Global symbol \"%s\" requires explicit package name", name);
 	    ++error_count;
 	    stash = curstash ? curstash : defstash;	/* avoid core dumps */
 	    add_gvflags = ((sv_type == SVt_PV) ? GVf_IMPORTED_SV
diff --git a/t/pragma/strict-subs b/t/pragma/strict-subs
index 43fce71..61ec286 100644
--- a/t/pragma/strict-subs
+++ b/t/pragma/strict-subs
@@ -81,7 +81,7 @@ use strict 'vars' ;
 $joe = 1 ;
 EXPECT
 Variable "$joe" is not imported at - line 8.
-Global symbol "joe" requires explicit package name at - line 8.
+Global symbol "$joe" requires explicit package name at - line 8.
 Execution of - aborted due to compilation errors.
 ########
 
@@ -93,7 +93,7 @@ no strict;
 }
 $joe = 1 ;
 EXPECT
-Global symbol "joe" requires explicit package name at - line 6.
+Global symbol "$joe" requires explicit package name at - line 6.
 Execution of - aborted due to compilation errors.
 ########
 
diff --git a/t/pragma/strict-vars b/t/pragma/strict-vars
index 7ca9843..42107fa 100644
--- a/t/pragma/strict-vars
+++ b/t/pragma/strict-vars
@@ -40,7 +40,7 @@ EXPECT
 use strict ;
 $fred ;
 EXPECT
-Global symbol "fred" requires explicit package name at - line 4.
+Global symbol "$fred" requires explicit package name at - line 4.
 Execution of - aborted due to compilation errors.
 ########
 
@@ -48,7 +48,7 @@ Execution of - aborted due to compilation errors.
 use strict 'vars' ;
 $fred ;
 EXPECT
-Global symbol "fred" requires explicit package name at - line 4.
+Global symbol "$fred" requires explicit package name at - line 4.
 Execution of - aborted due to compilation errors.
 ########
 
@@ -56,7 +56,7 @@ Execution of - aborted due to compilation errors.
 use strict 'vars' ;
 local $fred ;
 EXPECT
-Global symbol "fred" requires explicit package name at - line 4.
+Global symbol "$fred" requires explicit package name at - line 4.
 Execution of - aborted due to compilation errors.
 ########
 
@@ -69,7 +69,7 @@ use strict 'vars' ;
 $joe = 1 ;
 EXPECT
 Variable "$joe" is not imported at - line 8.
-Global symbol "joe" requires explicit package name at - line 8.
+Global symbol "$joe" requires explicit package name at - line 8.
 Execution of - aborted due to compilation errors.
 ########
 
@@ -81,7 +81,7 @@ no strict;
 }
 $joe = 1 ;
 EXPECT
-Global symbol "joe" requires explicit package name at - line 6.
+Global symbol "$joe" requires explicit package name at - line 6.
 Execution of - aborted due to compilation errors.
 ########
 
@@ -114,7 +114,7 @@ $joe = 1 ;
 require "./abc";
 EXPECT
 Variable "$joe" is not imported at ./abc line 2.
-Global symbol "joe" requires explicit package name at ./abc line 2.
+Global symbol "$joe" requires explicit package name at ./abc line 2.
 Compilation failed in require at - line 2.
 ########
 
@@ -127,7 +127,7 @@ $joe = 1 ;
 use abc;
 EXPECT
 Variable "$joe" is not imported at abc.pm line 2.
-Global symbol "joe" requires explicit package name at abc.pm line 2.
+Global symbol "$joe" requires explicit package name at abc.pm line 2.
 Compilation failed in require at - line 2.
 BEGIN failed--compilation aborted at - line 2.
 ########
@@ -152,7 +152,7 @@ eval {
 print STDERR $@;
 $joe = 1 ;
 EXPECT
-Global symbol "joe" requires explicit package name at - line 6.
+Global symbol "$joe" requires explicit package name at - line 6.
 Execution of - aborted due to compilation errors.
 ########
 
@@ -164,7 +164,7 @@ eval {
 print STDERR $@;
 $joe = 1 ;
 EXPECT
-Global symbol "joe" requires explicit package name at - line 5.
+Global symbol "$joe" requires explicit package name at - line 5.
 Execution of - aborted due to compilation errors.
 ########
 
@@ -178,7 +178,7 @@ print STDERR $@;
 $joe = 1 ;
 EXPECT
 Variable "$joe" is not imported at - line 9.
-Global symbol "joe" requires explicit package name at - line 9.
+Global symbol "$joe" requires explicit package name at - line 9.
 Execution of - aborted due to compilation errors.
 ########
 
@@ -199,7 +199,7 @@ eval q[
     $joe = 1 ;
 ]; print STDERR $@;
 EXPECT
-Global symbol "joe" requires explicit package name at (eval 1) line 3.
+Global symbol "$joe" requires explicit package name at (eval 1) line 3.
 ########
 
 # Check scope of pragma with eval
@@ -208,7 +208,7 @@ eval '
     $joe = 1 ;
 '; print STDERR $@ ;
 EXPECT
-Global symbol "joe" requires explicit package name at (eval 1) line 2.
+Global symbol "$joe" requires explicit package name at (eval 1) line 2.
 ########
 
 # Check scope of pragma with eval
@@ -219,5 +219,5 @@ eval '
 '; print STDERR $@;
 $joe = 1 ;
 EXPECT
-Global symbol "joe" requires explicit package name at - line 8.
+Global symbol "$joe" requires explicit package name at - line 8.
 Execution of - aborted due to compilation errors.