This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
makedepend VOS fix from Paul Green.
[perl5.git] / toke.c
diff --git a/toke.c b/toke.c
index 55aaedb..faa1eac 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -4904,7 +4904,7 @@ Perl_yylex(pTHX)
                char tmpbuf[sizeof PL_tokenbuf];
                SSize_t tboffset = 0;
                expectation attrful;
-               bool have_name, have_proto;
+               bool have_name, have_proto, bad_proto;
                int key = tmp;
 
                s = skipspace(s);
@@ -4955,14 +4955,17 @@ Perl_yylex(pTHX)
                    /* strip spaces and check for bad characters */
                    d = SvPVX(PL_lex_stuff);
                    tmp = 0;
+                   bad_proto = FALSE;
                    for (p = d; *p; ++p) {
-                       if (!strchr("$@%*;[]&\\ ", *p))
-                           Perl_croak(aTHX_ "Malformed prototype for %s : %s",
-                                      SvPVX(PL_subname), d);
+                       if (!strchr("$@%*;[]&\\ ", *p))
+                           bad_proto = TRUE;
                        if (!isSPACE(*p))
                            d[tmp++] = *p;
                    }
                    d[tmp] = '\0';
+                   if (bad_proto)
+                       Perl_croak(aTHX_ "Malformed prototype for %s : %s",
+                                  SvPVX(PL_subname), d);
                    SvCUR(PL_lex_stuff) = tmp;
                    have_proto = TRUE;