0
0
mirror of https://github.com/vim/vim.git synced 2025-10-02 05:04:20 -04:00

patch 8.2.4694: avoidance of #elif causes more preproc nesting

Problem:    Avoidance of #elif causes more preproc nesting.
Solution:   Use #elif where it is useful. (Ozaki Kiichi, closes #10081)
This commit is contained in:
ichizok
2022-04-05 14:18:44 +01:00
committed by Bram Moolenaar
parent 72bb10df1f
commit 02560424bf
4 changed files with 54 additions and 97 deletions

View File

@@ -198,16 +198,14 @@ set_init_1(int clean_arg)
if (options[opt_idx].def_val[VI_DEFAULT] == (char_u *)0L) if (options[opt_idx].def_val[VI_DEFAULT] == (char_u *)0L)
#endif #endif
{ {
#ifdef HAVE_AVAIL_MEM #if defined(HAVE_AVAIL_MEM)
// Use amount of memory available at this moment. // Use amount of memory available at this moment.
n = (mch_avail_mem(FALSE) >> 1); n = (mch_avail_mem(FALSE) >> 1);
#else #elif defined(HAVE_TOTAL_MEM)
# ifdef HAVE_TOTAL_MEM
// Use amount of memory available to Vim. // Use amount of memory available to Vim.
n = (mch_total_mem(FALSE) >> 1); n = (mch_total_mem(FALSE) >> 1);
#else #else
n = (0x7fffffff >> 11); n = (0x7fffffff >> 11);
# endif
#endif #endif
options[opt_idx].def_val[VI_DEFAULT] = (char_u *)n; options[opt_idx].def_val[VI_DEFAULT] = (char_u *)n;
opt_idx = findoption((char_u *)"maxmem"); opt_idx = findoption((char_u *)"maxmem");
@@ -266,21 +264,18 @@ set_init_1(int clean_arg)
} }
#endif #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 print encoding on platforms that don't default to latin1
set_string_default("penc", set_string_default("penc",
# if defined(MSWIN) # if defined(MSWIN)
(char_u *)"cp1252" (char_u *)"cp1252"
# else # elif defined(VMS)
# ifdef VMS
(char_u *)"dec-mcs" (char_u *)"dec-mcs"
# else # elif defined(MAC)
# ifdef MAC
(char_u *)"mac-roman" (char_u *)"mac-roman"
# else // HPUX # else // HPUX
(char_u *)"hp-roman8" (char_u *)"hp-roman8"
# endif
# endif
# endif # endif
); );
#endif #endif
@@ -290,13 +285,11 @@ set_init_1(int clean_arg)
set_string_default("pexpr", set_string_default("pexpr",
# if defined(MSWIN) # if defined(MSWIN)
(char_u *)"system('copy' . ' ' . v:fname_in . (&printdevice == '' ? ' LPT1:' : (' \"' . &printdevice . '\"'))) . delete(v:fname_in)" (char_u *)"system('copy' . ' ' . v:fname_in . (&printdevice == '' ? ' LPT1:' : (' \"' . &printdevice . '\"'))) . delete(v:fname_in)"
# else # elif defined(VMS)
# ifdef VMS
(char_u *)"system('print/delete' . (&printdevice == '' ? '' : ' /queue=' . &printdevice) . ' ' . v:fname_in)" (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" (char_u *)"system('lpr' . (&printdevice == '' ? '' : ' -P' . &printdevice) . ' ' . v:fname_in) . delete(v:fname_in) + v:shell_error"
# endif
# endif # endif
); );
#endif #endif
@@ -430,12 +423,10 @@ set_init_1(int clean_arg)
vim_setenv((char_u *)"LANG", (char_u *)buf); vim_setenv((char_u *)"LANG", (char_u *)buf);
} }
} }
# else # elif defined(MACOS_CONVERT)
# ifdef MACOS_CONVERT
// Moved to os_mac_conv.c to avoid dependency problems. // Moved to os_mac_conv.c to avoid dependency problems.
mac_lang_init(); mac_lang_init();
# endif # endif
# endif
# ifdef MSWIN # ifdef MSWIN
// MS-Windows has builtin support for conversion to and from Unicode, using // MS-Windows has builtin support for conversion to and from Unicode, using

View File

@@ -1148,21 +1148,17 @@ static struct vimoption options[] =
#ifdef FEAT_QUICKFIX #ifdef FEAT_QUICKFIX
(char_u *)&p_gp, PV_GP, (char_u *)&p_gp, PV_GP,
{ {
# ifdef MSWIN # if defined(MSWIN)
// may be changed to "grep -n" in os_win32.c // may be changed to "grep -n" in os_win32.c
(char_u *)"findstr /n", (char_u *)"findstr /n",
# else # elif defined(UNIX)
# ifdef UNIX
// Add an extra file name so that grep will always // Add an extra file name so that grep will always
// insert a file name in the match line. // insert a file name in the match line.
(char_u *)"grep -n $* /dev/null", (char_u *)"grep -n $* /dev/null",
# else # elif defined(VMS)
# ifdef VMS
(char_u *)"SEARCH/NUMBERS ", (char_u *)"SEARCH/NUMBERS ",
# else # else
(char_u *)"grep -n ", (char_u *)"grep -n ",
# endif
# endif
# endif # endif
(char_u *)0L} (char_u *)0L}
#else #else
@@ -1431,15 +1427,13 @@ static struct vimoption options[] =
// ( and ) are used in text separating fnames // ( and ) are used in text separating fnames
(char_u *)"@,48-57,/,\\,.,-,_,+,,,#,$,%,{,},[,],:,@-@,!,~,=", (char_u *)"@,48-57,/,\\,.,-,_,+,,,#,$,%,{,},[,],:,@-@,!,~,=",
#else #else
# ifdef AMIGA # if defined(AMIGA)
(char_u *)"@,48-57,/,.,-,_,+,,,$,:", (char_u *)"@,48-57,/,.,-,_,+,,,$,:",
# else # elif defined(VMS)
# ifdef VMS
(char_u *)"@,48-57,/,.,-,_,+,,,#,$,%,<,>,[,],:,;,~", (char_u *)"@,48-57,/,.,-,_,+,,,#,$,%,<,>,[,],:,;,~",
# else // UNIX et al. # else // UNIX et al.
(char_u *)"@,48-57,/,.,-,_,+,,,#,$,%,~,=", (char_u *)"@,48-57,/,.,-,_,+,,,#,$,%,~,=",
# endif # endif
# endif
#endif #endif
(char_u *)0L} SCTX_INIT}, (char_u *)0L} SCTX_INIT},
{"isident", "isi", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, {"isident", "isi", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
@@ -1497,18 +1491,14 @@ static struct vimoption options[] =
{"keywordprg", "kp", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE, {"keywordprg", "kp", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
(char_u *)&p_kp, PV_KP, (char_u *)&p_kp, PV_KP,
{ {
#ifdef MSWIN #if defined(MSWIN)
(char_u *)":help", (char_u *)":help",
#else #elif defined(VMS)
# ifdef VMS
(char_u *)"help", (char_u *)"help",
# else #elif defined(USEMAN_S)
# ifdef USEMAN_S
(char_u *)"man -s", (char_u *)"man -s",
#else #else
(char_u *)"man", (char_u *)"man",
# endif
# endif
#endif #endif
(char_u *)0L} SCTX_INIT}, (char_u *)0L} SCTX_INIT},
{"langmap", "lmap", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP|P_SECURE, {"langmap", "lmap", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP|P_SECURE,
@@ -2767,14 +2757,12 @@ static struct vimoption options[] =
(char_u *)&p_viminfo, PV_NONE, (char_u *)&p_viminfo, PV_NONE,
#if defined(MSWIN) #if defined(MSWIN)
{(char_u *)"", (char_u *)"'100,<50,s10,h,rA:,rB:"} {(char_u *)"", (char_u *)"'100,<50,s10,h,rA:,rB:"}
#else #elif defined(AMIGA)
# ifdef AMIGA
{(char_u *)"", {(char_u *)"",
(char_u *)"'100,<50,s10,h,rdf0:,rdf1:,rdf2:"} (char_u *)"'100,<50,s10,h,rdf0:,rdf1:,rdf2:"}
#else #else
{(char_u *)"", (char_u *)"'100,<50,s10,h"} {(char_u *)"", (char_u *)"'100,<50,s10,h"}
#endif #endif
#endif
#else #else
(char_u *)NULL, PV_NONE, (char_u *)NULL, PV_NONE,
{(char_u *)0L, (char_u *)0L} {(char_u *)0L, (char_u *)0L}

View File

@@ -949,15 +949,13 @@ ambw_end:
|| check_opt_strings(p_wak, p_wak_values, FALSE) != OK) || check_opt_strings(p_wak, p_wak_values, FALSE) != OK)
errmsg = e_invalid_argument; errmsg = e_invalid_argument;
# ifdef FEAT_MENU # ifdef FEAT_MENU
# ifdef FEAT_GUI_MOTIF # if defined(FEAT_GUI_MOTIF)
else if (gui.in_use) else if (gui.in_use)
gui_motif_set_mnemonics(p_wak[0] == 'y' || p_wak[0] == 'm'); gui_motif_set_mnemonics(p_wak[0] == 'y' || p_wak[0] == 'm');
# else # elif defined(FEAT_GUI_GTK)
# ifdef FEAT_GUI_GTK
else if (gui.in_use) else if (gui.in_use)
gui_gtk_set_mnemonics(p_wak[0] == 'y' || p_wak[0] == 'm'); gui_gtk_set_mnemonics(p_wak[0] == 'y' || p_wak[0] == 'm');
# endif # endif
# endif
# endif # endif
} }
#endif #endif

View File

@@ -711,29 +711,25 @@ static char *(features[]) =
#else #else
"-xim", "-xim",
#endif #endif
#ifdef MSWIN #if defined(MSWIN)
# ifdef FEAT_XPM_W32 # ifdef FEAT_XPM_W32
"+xpm_w32", "+xpm_w32",
# else # else
"-xpm_w32", "-xpm_w32",
# endif # endif
#else #elif defined(HAVE_XPM)
# ifdef HAVE_XPM
"+xpm", "+xpm",
#else #else
"-xpm", "-xpm",
#endif #endif
#endif
#if defined(UNIX) || defined(VMS) #if defined(UNIX) || defined(VMS)
# ifdef USE_XSMP_INTERACT # if defined(USE_XSMP_INTERACT)
"+xsmp_interact", "+xsmp_interact",
# else # elif defined(USE_XSMP)
# ifdef USE_XSMP
"+xsmp", "+xsmp",
# else # else
"-xsmp", "-xsmp",
# endif # endif
# endif
# ifdef FEAT_XCLIPBOARD # ifdef FEAT_XCLIPBOARD
"+xterm_clipboard", "+xterm_clipboard",
# else # else
@@ -750,6 +746,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
4694,
/**/ /**/
4693, 4693,
/**/ /**/
@@ -10454,53 +10452,35 @@ list_version(void)
} }
#endif #endif
#ifdef FEAT_HUGE #if defined(FEAT_HUGE)
msg_puts(_("\nHuge version ")); msg_puts(_("\nHuge version "));
#else #elif defined(FEAT_BIG)
# ifdef FEAT_BIG
msg_puts(_("\nBig version ")); msg_puts(_("\nBig version "));
# else #elif defined(FEAT_NORMAL)
# ifdef FEAT_NORMAL
msg_puts(_("\nNormal version ")); msg_puts(_("\nNormal version "));
# else #elif defined(FEAT_SMALL)
# ifdef FEAT_SMALL
msg_puts(_("\nSmall version ")); msg_puts(_("\nSmall version "));
#else #else
msg_puts(_("\nTiny version ")); msg_puts(_("\nTiny version "));
#endif #endif
# endif #if !defined(FEAT_GUI)
# endif
#endif
#ifndef FEAT_GUI
msg_puts(_("without GUI.")); msg_puts(_("without GUI."));
#else #elif defined(FEAT_GUI_GTK)
# ifdef FEAT_GUI_GTK # if defined(USE_GTK3)
# ifdef USE_GTK3
msg_puts(_("with GTK3 GUI.")); msg_puts(_("with GTK3 GUI."));
# else # elif defined(FEAT_GUI_GNOME)
# ifdef FEAT_GUI_GNOME
msg_puts(_("with GTK2-GNOME GUI.")); msg_puts(_("with GTK2-GNOME GUI."));
# else # else
msg_puts(_("with GTK2 GUI.")); msg_puts(_("with GTK2 GUI."));
# endif # endif
# endif #elif defined(FEAT_GUI_MOTIF)
# else
# ifdef FEAT_GUI_MOTIF
msg_puts(_("with X11-Motif GUI.")); msg_puts(_("with X11-Motif GUI."));
# else #elif defined(FEAT_GUI_HAIKU)
# ifdef FEAT_GUI_HAIKU
msg_puts(_("with Haiku GUI.")); msg_puts(_("with Haiku GUI."));
# else #elif defined(FEAT_GUI_PHOTON)
# ifdef FEAT_GUI_PHOTON
msg_puts(_("with Photon GUI.")); msg_puts(_("with Photon GUI."));
# else #elif defined(MSWIN)
# if defined(MSWIN)
msg_puts(_("with GUI.")); msg_puts(_("with GUI."));
# endif
# endif
# endif
# endif
# endif
#endif #endif
version_msg(_(" Features included (+) or not (-):\n")); version_msg(_(" Features included (+) or not (-):\n"));