Break the -v code out from Perl_moreswitches() into S_minus_v().
authorNicholas Clark <nick@ccl4.org>
Thu, 24 Nov 2011 20:40:40 +0000 (21:40 +0100)
committerNicholas Clark <nick@ccl4.org>
Sun, 4 Dec 2011 12:01:52 +0000 (13:01 +0100)
embed.fnc
embed.h
perl.c
proto.h

index 4c8a364..4d2b666 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
@@ -1760,6 +1760,7 @@ sr        |void   |usage
 #ifndef SETUID_SCRIPTS_ARE_SECURE_NOW
 so     |void   |validate_suid  |NN PerlIO *rsfp
 #endif
+sr     |void   |minus_v
 
 s      |void*  |parse_body     |NULLOK char **env|XSINIT_t xsinit
 rs     |void   |run_body       |I32 oldscope
diff --git a/embed.h b/embed.h
index 7b0118e..03aefc1 100644 (file)
--- a/embed.h
+++ b/embed.h
 #define init_postdump_symbols(a,b,c)   S_init_postdump_symbols(aTHX_ a,b,c)
 #define init_predump_symbols() S_init_predump_symbols(aTHX)
 #define mayberelocate(a,b,c)   S_mayberelocate(aTHX_ a,b,c)
+#define minus_v()              S_minus_v(aTHX)
 #define my_exit_jump()         S_my_exit_jump(aTHX)
 #define nuke_stacks()          S_nuke_stacks(aTHX)
 #define open_script(a,b,c,d)   S_open_script(aTHX_ a,b,c,d)
diff --git a/perl.c b/perl.c
index b4a2544..1219e99 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -3320,6 +3320,56 @@ Perl_moreswitches(pTHX_ const char *s)
        s++;
        return s;
     case 'v':
+       minus_v();
+    case 'w':
+       if (! (PL_dowarn & G_WARN_ALL_MASK)) {
+           PL_dowarn |= G_WARN_ON;
+       }
+       s++;
+       return s;
+    case 'W':
+       PL_dowarn = G_WARN_ALL_ON|G_WARN_ON;
+        if (!specialWARN(PL_compiling.cop_warnings))
+            PerlMemShared_free(PL_compiling.cop_warnings);
+       PL_compiling.cop_warnings = pWARN_ALL ;
+       s++;
+       return s;
+    case 'X':
+       PL_dowarn = G_WARN_ALL_OFF;
+        if (!specialWARN(PL_compiling.cop_warnings))
+            PerlMemShared_free(PL_compiling.cop_warnings);
+       PL_compiling.cop_warnings = pWARN_NONE ;
+       s++;
+       return s;
+    case '*':
+    case ' ':
+        while( *s == ' ' )
+          ++s;
+       if (s[0] == '-')        /* Additional switches on #! line. */
+           return s+1;
+       break;
+    case '-':
+    case 0:
+#if defined(WIN32) || !defined(PERL_STRICT_CR)
+    case '\r':
+#endif
+    case '\n':
+    case '\t':
+       break;
+#ifdef ALTERNATE_SHEBANG
+    case 'S':                  /* OS/2 needs -S on "extproc" line. */
+       break;
+#endif
+    default:
+       Perl_croak(aTHX_ "Can't emulate -%.1s on #! line",s);
+    }
+    return NULL;
+}
+
+
+STATIC void
+S_minus_v(pTHX)
+{
        if (!sv_derived_from(PL_patchlevel, "version"))
            upg_version(PL_patchlevel, TRUE);
 #if !defined(DGUX)
@@ -3437,49 +3487,6 @@ Complete documentation for Perl, including FAQ lists, should be found on\n\
 this system using \"man perl\" or \"perldoc perl\".  If you have access to the\n\
 Internet, point your browser at http://www.perl.org/, the Perl Home Page.\n\n");
        my_exit(0);
-    case 'w':
-       if (! (PL_dowarn & G_WARN_ALL_MASK)) {
-           PL_dowarn |= G_WARN_ON;
-       }
-       s++;
-       return s;
-    case 'W':
-       PL_dowarn = G_WARN_ALL_ON|G_WARN_ON;
-        if (!specialWARN(PL_compiling.cop_warnings))
-            PerlMemShared_free(PL_compiling.cop_warnings);
-       PL_compiling.cop_warnings = pWARN_ALL ;
-       s++;
-       return s;
-    case 'X':
-       PL_dowarn = G_WARN_ALL_OFF;
-        if (!specialWARN(PL_compiling.cop_warnings))
-            PerlMemShared_free(PL_compiling.cop_warnings);
-       PL_compiling.cop_warnings = pWARN_NONE ;
-       s++;
-       return s;
-    case '*':
-    case ' ':
-        while( *s == ' ' )
-          ++s;
-       if (s[0] == '-')        /* Additional switches on #! line. */
-           return s+1;
-       break;
-    case '-':
-    case 0:
-#if defined(WIN32) || !defined(PERL_STRICT_CR)
-    case '\r':
-#endif
-    case '\n':
-    case '\t':
-       break;
-#ifdef ALTERNATE_SHEBANG
-    case 'S':                  /* OS/2 needs -S on "extproc" line. */
-       break;
-#endif
-    default:
-       Perl_croak(aTHX_ "Can't emulate -%.1s on #! line",s);
-    }
-    return NULL;
 }
 
 /* compliments of Tom Christiansen */
diff --git a/proto.h b/proto.h
index 56ca49a..d324314 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -5865,6 +5865,9 @@ STATIC SV*        S_mayberelocate(pTHX_ const char *const dir, STRLEN len, U32 flags)
 #define PERL_ARGS_ASSERT_MAYBERELOCATE \
        assert(dir)
 
+STATIC void    S_minus_v(pTHX)
+                       __attribute__noreturn__;
+
 STATIC void    S_my_exit_jump(pTHX)
                        __attribute__noreturn__;