]> granicus.if.org Git - vim/commitdiff
patch 8.2.4694: avoidance of #elif causes more preproc nesting v8.2.4694
authorichizok <gclient.gaap@gmail.com>
Tue, 5 Apr 2022 13:18:44 +0000 (14:18 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 5 Apr 2022 13:18:44 +0000 (14:18 +0100)
Problem:    Avoidance of #elif causes more preproc nesting.
Solution:   Use #elif where it is useful. (Ozaki Kiichi, closes #10081)

src/option.c
src/optiondefs.h
src/optionstr.c
src/version.c

index 71b71ba53c5f99ee357624fc68a64e9b860f5794..4d50a6480c4785a50fc1eb2aadf301fa805f14a4 100644 (file)
@@ -198,16 +198,14 @@ set_init_1(int clean_arg)
        if (options[opt_idx].def_val[VI_DEFAULT] == (char_u *)0L)
 #endif
        {
-#ifdef HAVE_AVAIL_MEM
+#if defined(HAVE_AVAIL_MEM)
            // Use amount of memory available at this moment.
            n = (mch_avail_mem(FALSE) >> 1);
-#else
-# ifdef HAVE_TOTAL_MEM
+#elif defined(HAVE_TOTAL_MEM)
            // Use amount of memory available to Vim.
            n = (mch_total_mem(FALSE) >> 1);
-# else
+#else
            n = (0x7fffffff >> 11);
-# endif
 #endif
            options[opt_idx].def_val[VI_DEFAULT] = (char_u *)n;
            opt_idx = findoption((char_u *)"maxmem");
@@ -266,21 +264,18 @@ set_init_1(int clean_arg)
     }
 #endif
 
-#if defined(FEAT_POSTSCRIPT) && (defined(MSWIN) || defined(VMS) || defined(MAC) || defined(hpux))
+#if defined(FEAT_POSTSCRIPT) && \
+       (defined(MSWIN) || defined(VMS) || defined(MAC) || defined(hpux))
     // Set print encoding on platforms that don't default to latin1
     set_string_default("penc",
 # if defined(MSWIN)
                       (char_u *)"cp1252"
-# else
-#  ifdef VMS
+# elif defined(VMS)
                       (char_u *)"dec-mcs"
-#  else
-#   ifdef MAC
+# elif defined(MAC)
                       (char_u *)"mac-roman"
-#   else // HPUX
+# else // HPUX
                       (char_u *)"hp-roman8"
-#   endif
-#  endif
 # endif
                       );
 #endif
@@ -290,13 +285,11 @@ set_init_1(int clean_arg)
     set_string_default("pexpr",
 # if defined(MSWIN)
            (char_u *)"system('copy' . ' ' . v:fname_in . (&printdevice == '' ? ' LPT1:' : (' \"' . &printdevice . '\"'))) . delete(v:fname_in)"
-# else
-#  ifdef VMS
+# elif defined(VMS)
            (char_u *)"system('print/delete' . (&printdevice == '' ? '' : ' /queue=' . &printdevice) . ' ' . v:fname_in)"
 
-#  else
+# else
            (char_u *)"system('lpr' . (&printdevice == '' ? '' : ' -P' . &printdevice) . ' ' . v:fname_in) . delete(v:fname_in) + v:shell_error"
-#  endif
 # endif
            );
 #endif
@@ -430,11 +423,9 @@ set_init_1(int clean_arg)
            vim_setenv((char_u *)"LANG", (char_u *)buf);
        }
     }
-# else
-#  ifdef MACOS_CONVERT
+# elif defined(MACOS_CONVERT)
     // Moved to os_mac_conv.c to avoid dependency problems.
     mac_lang_init();
-#  endif
 # endif
 
 # ifdef MSWIN
index 9eb0e7859bbf53a5e7a831ed53bc22ee90443bec..4f2ec4ddc5485281fc0ccfc024de1f309b38e9a0 100644 (file)
@@ -1148,21 +1148,17 @@ static struct vimoption options[] =
 #ifdef FEAT_QUICKFIX
                            (char_u *)&p_gp, PV_GP,
                            {
-# ifdef MSWIN
+# if defined(MSWIN)
                            // may be changed to "grep -n" in os_win32.c
                            (char_u *)"findstr /n",
-# else
-#  ifdef UNIX
+# elif defined(UNIX)
                            // Add an extra file name so that grep will always
                            // insert a file name in the match line.
                            (char_u *)"grep -n $* /dev/null",
-#  else
-#   ifdef VMS
+# elif defined(VMS)
                            (char_u *)"SEARCH/NUMBERS ",
-#   else
+# else
                            (char_u *)"grep -n ",
-#   endif
-#  endif
 # endif
                            (char_u *)0L}
 #else
@@ -1431,14 +1427,12 @@ static struct vimoption options[] =
                                // ( and ) are used in text separating fnames
                            (char_u *)"@,48-57,/,\\,.,-,_,+,,,#,$,%,{,},[,],:,@-@,!,~,=",
 #else
-# ifdef AMIGA
+# if defined(AMIGA)
                            (char_u *)"@,48-57,/,.,-,_,+,,,$,:",
-# else
-#  ifdef VMS
+# elif defined(VMS)
                            (char_u *)"@,48-57,/,.,-,_,+,,,#,$,%,<,>,[,],:,;,~",
-#  else // UNIX et al.
+# else // UNIX et al.
                            (char_u *)"@,48-57,/,.,-,_,+,,,#,$,%,~,=",
-#  endif
 # endif
 #endif
                                (char_u *)0L} SCTX_INIT},
@@ -1497,18 +1491,14 @@ static struct vimoption options[] =
     {"keywordprg",  "kp",   P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
                            (char_u *)&p_kp, PV_KP,
                            {
-#ifdef MSWIN
+#if defined(MSWIN)
                            (char_u *)":help",
-#else
-# ifdef VMS
+#elif defined(VMS)
                            (char_u *)"help",
-# else
-#  ifdef USEMAN_S
+#elif defined(USEMAN_S)
                            (char_u *)"man -s",
-#  else
+#else
                            (char_u *)"man",
-#  endif
-# endif
 #endif
                                (char_u *)0L} SCTX_INIT},
     {"langmap",     "lmap", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP|P_SECURE,
@@ -2767,13 +2757,11 @@ static struct vimoption options[] =
                            (char_u *)&p_viminfo, PV_NONE,
 #if defined(MSWIN)
                            {(char_u *)"", (char_u *)"'100,<50,s10,h,rA:,rB:"}
-#else
-# ifdef AMIGA
+#elif defined(AMIGA)
                            {(char_u *)"",
                                 (char_u *)"'100,<50,s10,h,rdf0:,rdf1:,rdf2:"}
-# else
+#else
                            {(char_u *)"", (char_u *)"'100,<50,s10,h"}
-# endif
 #endif
 #else
                            (char_u *)NULL, PV_NONE,
index 5c3f76dc9e7e6ce3811fd2e5443d50a873dd5574..09e6d8a12e6dfe2b3894e5416e8858972b5c2d61 100644 (file)
@@ -949,14 +949,12 @@ ambw_end:
                || check_opt_strings(p_wak, p_wak_values, FALSE) != OK)
            errmsg = e_invalid_argument;
 # ifdef FEAT_MENU
-#  ifdef FEAT_GUI_MOTIF
+#  if defined(FEAT_GUI_MOTIF)
        else if (gui.in_use)
            gui_motif_set_mnemonics(p_wak[0] == 'y' || p_wak[0] == 'm');
-#  else
-#   ifdef FEAT_GUI_GTK
+#  elif defined(FEAT_GUI_GTK)
        else if (gui.in_use)
            gui_gtk_set_mnemonics(p_wak[0] == 'y' || p_wak[0] == 'm');
-#   endif
 #  endif
 # endif
     }
index 203b9472b85c6350c34eb551f8a6aeb75f40b6ce..3e220f581f04924f7e29eb3655bc00e1161f785b 100644 (file)
@@ -711,28 +711,24 @@ static char *(features[]) =
 #else
        "-xim",
 #endif
-#ifdef MSWIN
+#if defined(MSWIN)
 # ifdef FEAT_XPM_W32
        "+xpm_w32",
 # else
        "-xpm_w32",
 # endif
-#else
-# ifdef HAVE_XPM
+#elif defined(HAVE_XPM)
        "+xpm",
-# else
+#else
        "-xpm",
-# endif
 #endif
 #if defined(UNIX) || defined(VMS)
-# ifdef USE_XSMP_INTERACT
+# if defined(USE_XSMP_INTERACT)
        "+xsmp_interact",
-# else
-#  ifdef USE_XSMP
+# elif defined(USE_XSMP)
        "+xsmp",
-#  else
+# else
        "-xsmp",
-#  endif
 # endif
 # ifdef FEAT_XCLIPBOARD
        "+xterm_clipboard",
@@ -750,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4694,
 /**/
     4693,
 /**/
@@ -10454,53 +10452,35 @@ list_version(void)
     }
 #endif
 
-#ifdef FEAT_HUGE
+#if defined(FEAT_HUGE)
     msg_puts(_("\nHuge version "));
-#else
-# ifdef FEAT_BIG
+#elif defined(FEAT_BIG)
     msg_puts(_("\nBig version "));
-# else
-#  ifdef FEAT_NORMAL
+#elif defined(FEAT_NORMAL)
     msg_puts(_("\nNormal version "));
-#  else
-#   ifdef FEAT_SMALL
+#elif defined(FEAT_SMALL)
     msg_puts(_("\nSmall version "));
-#   else
+#else
     msg_puts(_("\nTiny version "));
-#   endif
-#  endif
-# endif
 #endif
-#ifndef FEAT_GUI
+#if !defined(FEAT_GUI)
     msg_puts(_("without GUI."));
-#else
-# ifdef FEAT_GUI_GTK
-#  ifdef USE_GTK3
+#elif defined(FEAT_GUI_GTK)
+# if defined(USE_GTK3)
     msg_puts(_("with GTK3 GUI."));
-#  else
-#   ifdef FEAT_GUI_GNOME
+# elif defined(FEAT_GUI_GNOME)
      msg_puts(_("with GTK2-GNOME GUI."));
-#   else
+# else
      msg_puts(_("with GTK2 GUI."));
-#   endif
 # endif
-# else
-#  ifdef FEAT_GUI_MOTIF
+#elif defined(FEAT_GUI_MOTIF)
     msg_puts(_("with X11-Motif GUI."));
-#  else
-#   ifdef FEAT_GUI_HAIKU
+#elif defined(FEAT_GUI_HAIKU)
     msg_puts(_("with Haiku GUI."));
-#   else
-#    ifdef FEAT_GUI_PHOTON
+#elif defined(FEAT_GUI_PHOTON)
     msg_puts(_("with Photon GUI."));
-#    else
-#     if defined(MSWIN)
+#elif defined(MSWIN)
     msg_puts(_("with GUI."));
-#     endif
-#    endif
-#   endif
-#  endif
-# endif
 #endif
     version_msg(_("  Features included (+) or not (-):\n"));