develooper Front page | perl.perl5.porters | Postings from December 2009

[PATCH] Forgot a strict. Use Perl_ck_warner instead.

From:
John Peacock
Date:
December 27, 2009 09:01
Subject:
[PATCH] Forgot a strict. Use Perl_ck_warner instead.
Message ID:
4B3792C8.7010202@havurah-software.org
Additional patch on top of the previous one.

Testing with CPAN module revealed one place where we need to check vs 
strict in prescan_version.  Switch to use Perl_ck_warner so that the 
"strict version format" warnings are no longer manditory.  Still get a 
syntax error in the appropriate place.

---
  util.c |   22 +++++++++++-----------
  1 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/util.c b/util.c
index ea74e28..cc73d53 100644
--- a/util.c
+++ b/util.c
@@ -4205,7 +4205,7 @@ dotted_decimal_version:
  	if (strict && d[0] == '0' && ! d[1] == '.')
  	{
  	    /* no leading zeros allowed */
-	    Perl_warner(aTHX_ packWARN(WARN_SYNTAX),
+	    Perl_ck_warner(aTHX_ packWARN(WARN_SYNTAX),
  		    "Invalid strict version format (no leading zeros)");
  	    return s;
  	}
@@ -4222,7 +4222,7 @@ dotted_decimal_version:
  	{
  	    if (strict) {
  		/* require v1.2.3 */
-		Perl_warner(aTHX_ packWARN(WARN_SYNTAX),
+		Perl_ck_warner(aTHX_ packWARN(WARN_SYNTAX),
  			"Invalid strict version format (v1.2.3 required)");
  		return s;
  	    }
@@ -4244,7 +4244,7 @@ dotted_decimal_version:
  		}
  		if (*d == '_') {
  		    if (strict) {
-			Perl_warner(aTHX_ packWARN(WARN_SYNTAX),
+			Perl_ck_warner(aTHX_ packWARN(WARN_SYNTAX),
  				"Invalid strict version format (no underscores)");
  			return s;
  		    }
@@ -4267,7 +4267,7 @@ dotted_decimal_version:
  	
  	    if (strict && i < 2) {
  		/* requires v1.2.3 */
-		Perl_warner(aTHX_ packWARN(WARN_SYNTAX),
+		Perl_ck_warner(aTHX_ packWARN(WARN_SYNTAX),
  			"Invalid strict version format (v1.2.3 required)");
  		return s;
  	    }
@@ -4278,17 +4278,17 @@ dotted_decimal_version:
   	if (d[0] == '.' && isDIGIT(d[1])) {
  	    if (strict) {
-		Perl_warner(aTHX_ packWARN(WARN_SYNTAX),
+		Perl_ck_warner(aTHX_ packWARN(WARN_SYNTAX),
  			"Invalid strict version format (0 before decimal required)");
  		return s;
  	    }
  	    goto version_saw_decimal;
  	}
  -	if (!isDIGIT(*d) && d[0] != ';')
+	if (strict && !isDIGIT(*d) && d[0] != ';')
  	{
  	    /* version required */
-	    Perl_warner(aTHX_ packWARN(WARN_SYNTAX),
+	    Perl_ck_warner(aTHX_ packWARN(WARN_SYNTAX),
  		    "Invalid strict version format (version required)");
  	    return s;
  	}
@@ -4296,7 +4296,7 @@ dotted_decimal_version:
  	if (d[0] == '0' && ! d[1] == '.')
  	{
  	    /* no leading zeros allowed */
-	    Perl_warner(aTHX_ packWARN(WARN_SYNTAX),
+	    Perl_ck_warner(aTHX_ packWARN(WARN_SYNTAX),
  		    "Invalid strict version format (no leading zeros)");
  	    return s;
  	}
@@ -4316,7 +4316,7 @@ version_saw_decimal:
  	}
  	if (strict && !isDIGIT(*d) && d != s ) {
  	    /* requires 1.[0-9] */
-	    Perl_warner(aTHX_ packWARN(WARN_SYNTAX),
+	    Perl_ck_warner(aTHX_ packWARN(WARN_SYNTAX),
  		    "Invalid strict version format (1.[0-9] required)");
  	    return s;
  	}
@@ -4327,7 +4327,7 @@ version_saw_decimal:
  		if (alpha)
  		    Perl_croak(aTHX_ "Invalid version format (underscores before 
decimal)");
  		if (strict) {
-		    Perl_warner(aTHX_ packWARN(WARN_SYNTAX),
+		    Perl_ck_warner(aTHX_ packWARN(WARN_SYNTAX),
  			    "Invalid strict version format (v1.2.3 required)");
  		    return s;
  		}
@@ -4337,7 +4337,7 @@ version_saw_decimal:
  	    }
  	    if (*d == '_') {
  		if (strict) {
-		    Perl_warner(aTHX_ packWARN(WARN_SYNTAX),
+		    Perl_ck_warner(aTHX_ packWARN(WARN_SYNTAX),
  			    "Invalid strict version format (no underscores)");
  		    return s;
  		}



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About