patch 7.4.2176
Problem:    #ifdefs in main() are complicated.
Solution:   Always define vim_main2().  Move params to the file level.
            (suggested by Ken Takata)
diff --git a/src/if_mzsch.c b/src/if_mzsch.c
index 7a462ad..4138810 100644
--- a/src/if_mzsch.c
+++ b/src/if_mzsch.c
@@ -1009,8 +1009,11 @@
 #endif
 
     int
-mzscheme_main(int argc, char** argv)
+mzscheme_main()
 {
+    int	    argc = 0;
+    char    *argv = NULL;
+
 #ifdef DYNAMIC_MZSCHEME
     /*
      * Racket requires trampolined startup.  We can not load it later.
@@ -1019,16 +1022,16 @@
     if (!mzscheme_enabled(FALSE))
     {
 	disabled = TRUE;
-	return vim_main2(argc, argv);
+	return vim_main2();
     }
 #endif
 #ifdef HAVE_TLS_SPACE
     scheme_register_tls_space(&tls_space, _tls_index);
 #endif
 #ifdef TRAMPOLINED_MZVIM_STARTUP
-    return scheme_main_setup(TRUE, mzscheme_env_main, argc, argv);
+    return scheme_main_setup(TRUE, mzscheme_env_main, argc, &argv);
 #else
-    return mzscheme_env_main(NULL, argc, argv);
+    return mzscheme_env_main(NULL, argc, &argv);
 #endif
 }
 
@@ -1056,7 +1059,7 @@
      * We trampoline into vim_main2
      * Passing argc, argv through from mzscheme_main
      */
-    vim_main_result = vim_main2(argc, argv);
+    vim_main_result = vim_main2();
 #if !defined(TRAMPOLINED_MZVIM_STARTUP) && defined(MZ_PRECISE_GC)
     /* releasing dummy */
     MZ_GC_REG();
diff --git a/src/main.c b/src/main.c
index 48e90c2..c694532 100644
--- a/src/main.c
+++ b/src/main.c
@@ -92,6 +92,9 @@
 
 static int has_dash_c_arg = FALSE;
 
+/* Various parameters passed between main() and other functions. */
+static mparm_T	params;
+
     int
 # ifdef VIMDLL
 _export
@@ -106,9 +109,6 @@
 # endif
 (int argc, char **argv)
 {
-    char_u	*fname = NULL;		/* file name from command line */
-    mparm_T	params;			/* various parameters passed between
-					 * main() and other functions. */
 #ifdef STARTUPTIME
     int		i;
 #endif
@@ -157,6 +157,7 @@
 #endif
 
 #ifdef STARTUPTIME
+    /* Need to find "--startuptime" before actually parsing arguments. */
     for (i = 1; i < argc; ++i)
     {
 	if (STRICMP(argv[i], "--startuptime") == 0 && i + 1 < argc)
@@ -241,7 +242,7 @@
 		mch_chdir((char *)start_dir);
 	}
 #endif
-	fname = alist_name(&GARGLIST[0]);
+	params.fname = alist_name(&GARGLIST[0]);
     }
 
 #if defined(WIN32) && defined(FEAT_MBYTE)
@@ -263,7 +264,7 @@
 	 * Hint: to avoid this when typing a command use a forward slash.
 	 * If the cd fails, it doesn't matter.
 	 */
-	(void)vim_chdirfile(fname);
+	(void)vim_chdirfile(params.fname);
 	if (start_dir != NULL)
 	    mch_dirname(start_dir, MAXPATHL);
     }
@@ -281,7 +282,7 @@
     /*
      * When listing swap file names, don't do cursor positioning et. al.
      */
-    if (recoverymode && fname == NULL)
+    if (recoverymode && params.fname == NULL)
 	params.want_full_screen = FALSE;
 
     /*
@@ -312,8 +313,8 @@
 	if (getcwd((char *)NameBuff, MAXPATHL) != NULL
 						&& STRCMP(NameBuff, "/") == 0)
 	{
-	    if (fname != NULL)
-		(void)vim_chdirfile(fname);
+	    if (params.fname != NULL)
+		(void)vim_chdirfile(params.fname);
 	    else
 	    {
 		expand_env((char_u *)"$HOME", NameBuff, MAXPATHL);
@@ -407,37 +408,23 @@
      * Newer version of MzScheme (Racket) require earlier (trampolined)
      * initialisation via scheme_main_setup.
      * Implement this by initialising it as early as possible
-     * and splitting off remaining Vim main into vim_main2
+     * and splitting off remaining Vim main into vim_main2().
      */
-    {
-	/* Pack up preprocessed command line arguments.
-	 * It is safe because Scheme does not access argc/argv. */
-	char *args[2];
-	args[0] = (char *)fname;
-	args[1] = (char *)&params;
-	return mzscheme_main(2, args);
-    }
-}
+    return mzscheme_main();
+#else
+    return vim_main2();
 #endif
+}
 #endif /* NO_VIM_MAIN */
 
-/* vim_main2() needs to be produced when FEAT_MZSCHEME is defined even when
- * NO_VIM_MAIN is defined. */
-#ifdef FEAT_MZSCHEME
+/*
+ * vim_main2() is needed for FEAT_MZSCHEME, but we define it always to keep
+ * things simple.
+ * It is also defined when NO_VIM_MAIN is defined, but then it's empty.
+ */
     int
-vim_main2(int argc UNUSED, char **argv UNUSED)
+vim_main2(void)
 {
-# ifndef NO_VIM_MAIN
-    char_u	*fname = (char_u *)argv[0];
-    mparm_T	params;
-
-    memcpy(&params, argv[1], sizeof(params));
-# else
-    return 0;
-}
-# endif
-#endif
-
 #ifndef NO_VIM_MAIN
     /* Reset 'loadplugins' for "-u NONE" before "--cmd" arguments.
      * Allows for setting 'loadplugins' there. */
@@ -493,7 +480,7 @@
      * This uses the 'dir' option, therefore it must be after the
      * initializations.
      */
-    if (recoverymode && fname == NULL)
+    if (recoverymode && params.fname == NULL)
     {
 	recover_names(NULL, TRUE, 0, NULL);
 	mch_exit(0);
@@ -888,16 +875,17 @@
     */
     main_loop(FALSE, FALSE);
 
+#endif /* NO_VIM_MAIN */
+
     return 0;
 }
-#endif /* NO_VIM_MAIN */
 #endif /* PROTO */
 
 /*
  * Initialisation shared by main() and some tests.
  */
     void
-common_init(mparm_T *params)
+common_init(mparm_T *paramp)
 {
 
 #ifdef FEAT_MBYTE
@@ -914,7 +902,7 @@
 #ifdef MAC_OS_CLASSIC
     /* Prepare for possibly starting GUI sometime */
     /* Macintosh needs this before any memory is allocated. */
-    gui_prepare(&params->argc, params->argv);
+    gui_prepare(&paramp->argc, paramp->argv);
     TIME_MSG("GUI prepared");
 #endif
 
@@ -963,14 +951,14 @@
      *   --socketid
      *   --windowid
      */
-    early_arg_scan(params);
+    early_arg_scan(paramp);
 
 #ifdef FEAT_SUN_WORKSHOP
-    findYourself(params->argv[0]);
+    findYourself(paramp->argv[0]);
 #endif
 #if defined(FEAT_GUI) && !defined(MAC_OS_CLASSIC)
     /* Prepare for possibly starting GUI sometime */
-    gui_prepare(&params->argc, params->argv);
+    gui_prepare(&paramp->argc, paramp->argv);
     TIME_MSG("GUI prepared");
 #endif
 
@@ -985,7 +973,7 @@
      * (needed for :! to * work). mch_check_win() will also handle the -d or
      * -dev argument.
      */
-    params->stdout_isatty = (mch_check_win(params->argc, params->argv) != FAIL);
+    paramp->stdout_isatty = (mch_check_win(paramp->argc, paramp->argv) != FAIL);
     TIME_MSG("window checked");
 
     /*
diff --git a/src/proto/if_mzsch.pro b/src/proto/if_mzsch.pro
index 193bd49..bab82ce 100644
--- a/src/proto/if_mzsch.pro
+++ b/src/proto/if_mzsch.pro
@@ -3,7 +3,7 @@
 void mzvim_check_threads(void);
 void mzvim_reset_timer(void);
 void mzscheme_end(void);
-int mzscheme_main(int argc, char **argv);
+int mzscheme_main(void);
 void mzscheme_buffer_free(buf_T *buf);
 void mzscheme_window_free(win_T *win);
 void ex_mzscheme(exarg_T *eap);
diff --git a/src/structs.h b/src/structs.h
index 5439748..6cfbb3c 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -3160,7 +3160,7 @@
     timer_T	*tr_prev;
     proftime_T	tr_due;		    /* when the callback is to be invoked */
     int		tr_repeat;	    /* number of times to repeat, -1 forever */
-    long	tr_interval;	    /* only set when it repeats */
+    long	tr_interval;	    /* msec */
     char_u	*tr_callback;	    /* allocated */
     partial_T	*tr_partial;
 #endif
@@ -3180,6 +3180,8 @@
     int		argc;
     char	**argv;
 
+    char_u	*fname;			/* first file to edit */
+
     int		evim_mode;		/* started as "evim" */
     char_u	*use_vimrc;		/* vimrc from -u argument */
 
diff --git a/src/version.c b/src/version.c
index 944dfa4..4d6765f 100644
--- a/src/version.c
+++ b/src/version.c
@@ -764,6 +764,8 @@
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2176,
+/**/
     2175,
 /**/
     2174,
diff --git a/src/vim.h b/src/vim.h
index 928a558..96cfc6c 100644
--- a/src/vim.h
+++ b/src/vim.h
@@ -2439,10 +2439,8 @@
 #define JSON_JS		1   /* use JS instead of JSON */
 #define JSON_NO_NONE	2   /* v:none item not allowed */
 
-#ifdef FEAT_MZSCHEME
-/* this is in main.c, cproto can't handle it. */
-int vim_main2(int argc, char **argv);
-#endif
+/* This is in main.c, cproto can't handle it. */
+int vim_main2(void);
 
 /* Used for flags of do_in_path() */
 #define DIP_ALL	    0x01	/* all matches, not just the first one */