Move the code related to deprecate("comma-less variable list") into a function.
Nicholas Clark [Tue, 13 Oct 2009 09:27:36 +0000 (10:27 +0100)]
This makes all calls to deprecate() string constants.

embed.fnc
embed.h
proto.h
toke.c

index 7e4ce51..06927a8 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
@@ -1812,6 +1812,7 @@ so        |SV*    |new_constant   |NULLOK const char *s|STRLEN len \
                                |NN const char *key|STRLEN keylen|NN SV *sv \
                                |NULLOK SV *pv|NULLOK const char *type \
                                |STRLEN typelen
+s      |int    |deprecate_commaless_var_list
 s      |int    |ao             |int toketype
 #  if defined(PERL_CR_FILTER)
 s      |I32    |cr_textfilter  |int idx|NULLOK SV *sv|int maxlen
diff --git a/embed.h b/embed.h
index 59e8174..98215c2 100644 (file)
--- a/embed.h
+++ b/embed.h
 #define tokenize_use           S_tokenize_use
 #endif
 #ifdef PERL_CORE
+#define deprecate_commaless_var_list   S_deprecate_commaless_var_list
 #define ao                     S_ao
 #endif
 #  if defined(PERL_CR_FILTER)
 #define filter_gets(a,b,c)     S_filter_gets(aTHX_ a,b,c)
 #define find_in_my_stash(a,b)  S_find_in_my_stash(aTHX_ a,b)
 #define tokenize_use(a,b)      S_tokenize_use(aTHX_ a,b)
+#define deprecate_commaless_var_list() S_deprecate_commaless_var_list(aTHX)
 #define ao(a)                  S_ao(aTHX_ a)
 #endif
 #  if defined(PERL_CR_FILTER)
diff --git a/proto.h b/proto.h
index c99a25a..ae13a6f 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -5841,6 +5841,7 @@ STATIC SV*        S_new_constant(pTHX_ const char *s, STRLEN len, const char *key, STRL
 #define PERL_ARGS_ASSERT_NEW_CONSTANT  \
        assert(key); assert(sv)
 
+STATIC int     S_deprecate_commaless_var_list(pTHX);
 STATIC int     S_ao(pTHX_ int toketype);
 #  if defined(PERL_CR_FILTER)
 STATIC I32     S_cr_textfilter(pTHX_ int idx, SV *sv, int maxlen);
diff --git a/toke.c b/toke.c
index 03cf6fd..dc87f27 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -100,7 +100,6 @@ static int
 S_pending_ident(pTHX);
 
 static const char ident_too_long[] = "Identifier too long";
-static const char commaless_variable_list[] = "comma-less variable list";
 
 #ifndef PERL_NO_UTF16_FILTER
 static I32 utf16_textfilter(pTHX_ int idx, SV *sv, int maxlen);
@@ -451,6 +450,13 @@ S_printbuf(pTHX_ const char *const fmt, const char *const s)
 
 #endif
 
+static int
+S_deprecate_commaless_var_list(pTHX) {
+    PL_expect = XTERM;
+    deprecate("comma-less variable list");
+    return REPORT(','); /* grandfather non-comma-format format */
+}
+
 /*
  * S_ao
  *
@@ -4860,9 +4866,7 @@ Perl_yylex(pTHX)
 
        if (PL_expect == XOPERATOR) {
            if (PL_lex_formbrack && PL_lex_brackets == PL_lex_formbrack) {
-               PL_expect = XTERM;
-               deprecate(commaless_variable_list);
-               return REPORT(','); /* grandfather non-comma-format format */
+               return deprecate_commaless_var_list();
            }
        }
 
@@ -5118,9 +5122,7 @@ Perl_yylex(pTHX)
        DEBUG_T( { printbuf("### Saw string before %s\n", s); } );
        if (PL_expect == XOPERATOR) {
            if (PL_lex_formbrack && PL_lex_brackets == PL_lex_formbrack) {
-               PL_expect = XTERM;
-               deprecate(commaless_variable_list);
-               return REPORT(','); /* grandfather non-comma-format format */
+               return deprecate_commaless_var_list();
            }
            else
                no_op("String",s);
@@ -5135,9 +5137,7 @@ Perl_yylex(pTHX)
        DEBUG_T( { printbuf("### Saw string before %s\n", s); } );
        if (PL_expect == XOPERATOR) {
            if (PL_lex_formbrack && PL_lex_brackets == PL_lex_formbrack) {
-               PL_expect = XTERM;
-               deprecate(commaless_variable_list);
-               return REPORT(','); /* grandfather non-comma-format format */
+               return deprecate_commaless_var_list();
            }
            else
                no_op("String",s);