]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.0.2180: POSIX function name in exarg causes issues v9.0.2180
authorZoltan Arpadffy <zoltan.arpadffy@gmail.com>
Tue, 19 Dec 2023 19:53:07 +0000 (20:53 +0100)
committerChristian Brabandt <cb@256bit.org>
Tue, 19 Dec 2023 19:53:07 +0000 (20:53 +0100)
Problem:  POSIX function name in exarg struct causes issues
          on OpenVMS
Solution: Rename getline member in exarg struct to ea_getline,
          remove isinf() workaround for VMS

There are compilers that do not treat well POSIX functions - like
getline - usage in the structs.

Older VMS compilers could digest this... but the newer OpenVMS compilers
( like VSI C x86-64 X7.4-843 (GEM 50XB9) ) cannot deal with these
structs. This could be limited to getline() that is defined via
getdelim() and might not affect all POSIX functions in general - but
avoiding POSIX function names usage in the structs is a "safe side"
practice without compromising the functionality or the code readability.

The previous OpenVMS X86 port used a workaround limiting the compiler
capabilities using __CRTL_VER_OVERRIDE=80400000
In order to make the OpenVMS port future proof, this pull request
proposes a possible solution.

closes: #13704

Signed-off-by: Zoltan Arpadffy <zoltan.arpadffy@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
17 files changed:
src/Make_vms.mms
src/digraph.c
src/eval.c
src/evalvars.c
src/ex_cmds.c
src/ex_cmds.h
src/ex_cmds2.c
src/ex_docmd.c
src/ex_getln.c
src/macros.h
src/pty.c
src/scriptfile.c
src/usercmd.c
src/userfunc.c
src/version.c
src/vim9class.c
src/vim9compile.c

index 4c206018fc0534ef55c0863f0cc8fdc84f86b43b..85b825e2dddaaf2b84fc6737691b2909dd4c847b 100644 (file)
@@ -112,8 +112,8 @@ CCVER       =
 CC_DEF  = cc
 PREFIX  = /prefix=all/name=(upper,short)
 OPTIMIZE= /opt
-.IFDEF MMSX86_64 # This is needed because of getline function name used in stucts like ex_cmds.h  
-ARCH_DEF= ,__CRTL_VER_OVERRIDE=80400000
+.IFDEF MMSX86_64
+ARCH_DEF=        # ,__CRTL_VER_OVERRIDE=80400000 
 .ENDIF
 .ENDIF
 
index 0a4a4a3b4108daa01236d92b1ae2ac015d721708..f19e58ec791e7d7136b960025c832273bde9353d 100644 (file)
@@ -2315,7 +2315,7 @@ ex_loadkeymap(exarg_T *eap)
      */
     for (;;)
     {
-       line = eap->getline(0, eap->cookie, 0, TRUE);
+       line = eap->ea_getline(0, eap->cookie, 0, TRUE);
        if (line == NULL)
            break;
 
index 877a20ff28da77186b9f5f41f6e7ccc3aabf0d48..6f88e03a3bf6e76df2746a4c1a0e914d493a2a18 100644 (file)
@@ -133,9 +133,9 @@ fill_evalarg_from_eap(evalarg_T *evalarg, exarg_T *eap, int skip)
        return;
 
     evalarg->eval_cstack = eap->cstack;
-    if (sourcing_a_script(eap) || eap->getline == get_list_line)
+    if (sourcing_a_script(eap) || eap->ea_getline == get_list_line)
     {
-       evalarg->eval_getline = eap->getline;
+       evalarg->eval_getline = eap->ea_getline;
        evalarg->eval_cookie = eap->cookie;
     }
 }
@@ -7542,7 +7542,7 @@ ex_execute(exarg_T *eap)
            sticky_cmdmod_flags = cmdmod.cmod_flags
                                                & (CMOD_LEGACY | CMOD_VIM9CMD);
            do_cmdline((char_u *)ga.ga_data,
-                      eap->getline, eap->cookie, DOCMD_NOWAIT|DOCMD_VERBOSE);
+                      eap->ea_getline, eap->cookie, DOCMD_NOWAIT|DOCMD_VERBOSE);
            sticky_cmdmod_flags = save_sticky_cmdmod_flags;
        }
     }
index f787e81cc3bc98d1b4610e0a887c504007a307e4..64455f0f4f20ce5a3d6c98c451a40c67c675804d 100644 (file)
@@ -776,7 +776,7 @@ heredoc_get(exarg_T *eap, char_u *cmd, int script_get, int vim9compile)
     cctx_T     *cctx = vim9compile ? eap->cookie : NULL;
     int                count = 0;
 
-    if (eap->getline == NULL)
+    if (eap->ea_getline == NULL)
     {
        emsg(_(e_cannot_use_heredoc_here));
        return NULL;
@@ -856,7 +856,7 @@ heredoc_get(exarg_T *eap, char_u *cmd, int script_get, int vim9compile)
        int     ti = 0;
 
        vim_free(theline);
-       theline = eap->getline(NUL, eap->cookie, 0, FALSE);
+       theline = eap->ea_getline(NUL, eap->cookie, 0, FALSE);
        if (theline == NULL)
        {
            semsg(_(e_missing_end_marker_str), marker);
index e311fa8e7abb1131d4e900c5ae7677db87d3354b..d2149336262155a6d1b9be20fffe03f6afd99a26 100644 (file)
@@ -3347,7 +3347,7 @@ ex_append(exarg_T *eap)
                indent = get_indent_lnum(lnum);
        }
        ex_keep_indent = FALSE;
-       if (eap->getline == NULL)
+       if (eap->ea_getline == NULL)
        {
            // No getline() function, use the lines that follow. This ends
            // when there is no more.
@@ -3368,7 +3368,7 @@ ex_append(exarg_T *eap)
            // Set State to avoid the cursor shape to be set to MODE_INSERT
            // state when getline() returns.
            State = MODE_CMDLINE;
-           theline = eap->getline(
+           theline = eap->ea_getline(
 #ifdef FEAT_EVAL
                    eap->cstack->cs_looplevel > 0 ? -1 :
 #endif
index af13510492e8533325dd1d865c344b76cb67babb..4ae6cc229348c18f87d6065ee67ab91f1a65c8cf 100644 (file)
@@ -1950,7 +1950,7 @@ struct exarg
     int                bad_char;       // BAD_KEEP, BAD_DROP or replacement byte
     int                useridx;        // user command index
     char       *errmsg;        // returned error message
-    char_u     *(*getline)(int, void *, int, getline_opt_T);
+    char_u     *(*ea_getline)(int, void *, int, getline_opt_T);
     void       *cookie;        // argument for getline()
 #ifdef FEAT_EVAL
     cstack_T   *cstack;        // condition stack for ":if" etc.
index 45ccb5237696bec3530d2e1c0a064a4f589742f6..0bde73070e5707f429c43652c21ec08b94b00e96 100644 (file)
@@ -610,7 +610,7 @@ ex_listdo(exarg_T *eap)
            ++i;
 
            // execute the command
-           do_cmdline(eap->arg, eap->getline, eap->cookie,
+           do_cmdline(eap->arg, eap->ea_getline, eap->cookie,
                                                DOCMD_VERBOSE + DOCMD_NOWAIT);
 
            if (eap->cmdidx == CMD_bufdo)
index 01d411a632ccf49e9abdcce721e254ec678bcd45..534cd7e0380e39018e5fd7517ece1955c9f17367 100644 (file)
@@ -400,7 +400,7 @@ struct loop_cookie
     int                current_line;           // last read line from growarray
     int                repeating;              // TRUE when looping a second time
     // When "repeating" is FALSE use "getline" and "cookie" to get lines
-    char_u     *(*getline)(int, void *, int, getline_opt_T);
+    char_u     *(*lc_getline)(int, void *, int, getline_opt_T);
     void       *cookie;
 };
 
@@ -940,7 +940,7 @@ do_cmdline(
            cmd_cookie = (void *)&cmd_loop_cookie;
            cmd_loop_cookie.lines_gap = &lines_ga;
            cmd_loop_cookie.current_line = current_line;
-           cmd_loop_cookie.getline = fgetline;
+           cmd_loop_cookie.lc_getline = fgetline;
            cmd_loop_cookie.cookie = cookie;
            cmd_loop_cookie.repeating = (current_line < lines_ga.ga_len);
 
@@ -1468,10 +1468,10 @@ get_loop_line(int c, void *cookie, int indent, getline_opt_T options)
            return NULL;        // trying to read past ":endwhile"/":endfor"
 
        // First time inside the ":while"/":for": get line normally.
-       if (cp->getline == NULL)
+       if (cp->lc_getline == NULL)
            line = getcmdline(c, 0L, indent, 0);
        else
-           line = cp->getline(c, cp->cookie, indent, options);
+           line = cp->lc_getline(c, cp->cookie, indent, options);
        if (line != NULL && store_loop_line(cp->lines_gap, line) == OK)
            ++cp->current_line;
 
@@ -1534,7 +1534,7 @@ getline_equal(
     cp = (struct loop_cookie *)cookie;
     while (gp == get_loop_line)
     {
-       gp = cp->getline;
+       gp = cp->lc_getline;
        cp = cp->cookie;
     }
     return gp == func;
@@ -1563,7 +1563,7 @@ getline_cookie(
     cp = (struct loop_cookie *)cookie;
     while (gp == get_loop_line)
     {
-       gp = cp->getline;
+       gp = cp->lc_getline;
        cp = cp->cookie;
     }
     return cp;
@@ -1598,7 +1598,7 @@ getline_peek(
            wp = (wcmd_T *)(cp->lines_gap->ga_data) + cp->current_line + 1;
            return wp->line;
        }
-       gp = cp->getline;
+       gp = cp->lc_getline;
        cp = cp->cookie;
     }
     if (gp == getsourceline)
@@ -1780,7 +1780,7 @@ do_one_cmd(
     // The "ea" structure holds the arguments that can be used.
     ea.cmd = *cmdlinep;
     ea.cmdlinep = cmdlinep;
-    ea.getline = fgetline;
+    ea.ea_getline = fgetline;
     ea.cookie = cookie;
 #ifdef FEAT_EVAL
     ea.cstack = cstack;
@@ -2844,8 +2844,8 @@ parse_command_modifiers(
 
        // in ex mode, an empty command (after modifiers) works like :+
        if (*eap->cmd == NUL && exmode_active
-                  && (getline_equal(eap->getline, eap->cookie, getexmodeline)
-                      || getline_equal(eap->getline, eap->cookie, getexline))
+                  && (getline_equal(eap->ea_getline, eap->cookie, getexmodeline)
+                      || getline_equal(eap->ea_getline, eap->cookie, getexline))
                        && curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count)
        {
            use_plus_cmd = TRUE;
index 52f4feb3f084c6bcacc1c1a325b6936fb5774006..f2a960e234d13f154ae2578d4f78aa6c3efd72f9 100644 (file)
@@ -4753,7 +4753,7 @@ script_get(exarg_T *eap UNUSED, char_u *cmd UNUSED)
     char_u     *s;
     garray_T   ga;
 
-    if (cmd[0] != '<' || cmd[1] != '<' || eap->getline == NULL)
+    if (cmd[0] != '<' || cmd[1] != '<' || eap->ea_getline == NULL)
        return NULL;
     cmd += 2;
 
index caacd3ae7a5c4d0c0ee576fa87c0359ccf37fa7f..cc2d11fdd162a86253674cfcb9ceb33377f08bf6 100644 (file)
      static inline int isnan(double x)
        { return x != x; }
 #   endif
-#   if defined(VMS) && defined(X86_64)
-     static inline int isinf(double x)
-        { return !isnan(x) && !finite(x); }
-#   endif
 #   ifndef HAVE_ISINF
      static inline int isinf(double x)
        { return !isnan(x) && isnan(x - x); }
index 56238a6ce9c4462204631578b191aad29523f1d7..f11a22dcd8577e608f0df546af03cd8423d4b1e7 100644 (file)
--- a/src/pty.c
+++ b/src/pty.c
@@ -357,7 +357,7 @@ mch_openpty(char **ttyn)
 static char PtyProto[] = "/dev/ptym/ptyXY";
 static char TtyProto[] = "/dev/pty/ttyXY";
 # else
-#  ifdef(__HAIKU__)
+#  ifdef __HAIKU__
 static char PtyProto[] = "/dev/pt/XY";
 static char TtyProto[] = "/dev/tt/XY";
 #  else
index 35582a84c92444b15d518031419b91320d9ba06b..69016bfb1291ab1e7555239e2080b0d2e84adf19 100644 (file)
@@ -2469,7 +2469,7 @@ getsourceline(
     int
 sourcing_a_script(exarg_T *eap)
 {
-    return (getline_equal(eap->getline, eap->cookie, getsourceline));
+    return (getline_equal(eap->ea_getline, eap->cookie, getsourceline));
 }
 
 /*
@@ -2497,7 +2497,7 @@ ex_scriptencoding(exarg_T *eap)
        name = eap->arg;
 
     // Setup for conversion from the specified encoding to 'encoding'.
-    sp = (source_cookie_T *)getline_cookie(eap->getline, eap->cookie);
+    sp = (source_cookie_T *)getline_cookie(eap->ea_getline, eap->cookie);
     convert_setup(&sp->conv, name, p_enc);
 
     if (name != eap->arg)
@@ -2561,7 +2561,7 @@ do_finish(exarg_T *eap, int reanimate)
     int                idx;
 
     if (reanimate)
-       ((source_cookie_T *)getline_cookie(eap->getline,
+       ((source_cookie_T *)getline_cookie(eap->ea_getline,
                                              eap->cookie))->finished = FALSE;
 
     // Cleanup (and inactivate) conditionals, but stop when a try conditional
@@ -2575,7 +2575,7 @@ do_finish(exarg_T *eap, int reanimate)
        report_make_pending(CSTP_FINISH, NULL);
     }
     else
-       ((source_cookie_T *)getline_cookie(eap->getline,
+       ((source_cookie_T *)getline_cookie(eap->ea_getline,
                                               eap->cookie))->finished = TRUE;
 }
 
index 31912578091dad62a39db092187c9d4197f5b39d..04b341933ac3e843895e7d2d6107c4a114926899 100644 (file)
@@ -1110,7 +1110,7 @@ may_get_cmd_block(exarg_T *eap, char_u *p, char_u **tofree, int *flags)
     char_u *retp = p;
 
     if (*p == '{' && ends_excmd2(eap->arg, skipwhite(p + 1))
-                                                      && eap->getline != NULL)
+                                                   && eap->ea_getline != NULL)
     {
        garray_T    ga;
        char_u      *line = NULL;
@@ -1127,7 +1127,7 @@ may_get_cmd_block(exarg_T *eap, char_u *p, char_u **tofree, int *flags)
            for (;;)
            {
                vim_free(line);
-               if ((line = eap->getline(':', eap->cookie,
+               if ((line = eap->ea_getline(':', eap->cookie,
                                           0, GETLINE_CONCAT_CONTBAR)) == NULL)
                {
                    emsg(_(e_missing_rcurly));
@@ -1955,7 +1955,7 @@ do_ucmd(exarg_T *eap)
 #endif
     }
 
-    (void)do_cmdline(buf, eap->getline, eap->cookie,
+    (void)do_cmdline(buf, eap->ea_getline, eap->cookie,
                                   DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_KEYTYPED);
 
     // Careful: Do not use "cmd" here, it may have become invalid if a user
index 1580a37c7ace7ff5361a6b5e32fe08046a295a32..ea03e786950eac2614ed96eb25d40c454d52d1eb 100644 (file)
@@ -198,10 +198,10 @@ get_function_line(
 {
     char_u *theline;
 
-    if (eap->getline == NULL)
+    if (eap->ea_getline == NULL)
        theline = getcmdline(':', 0L, indent, 0);
     else
-       theline = eap->getline(':', eap->cookie, indent, getline_options);
+       theline = eap->ea_getline(':', eap->cookie, indent, getline_options);
     if (theline != NULL)
     {
        if (lines_to_free->ga_len > 0
@@ -264,7 +264,7 @@ get_function_args(
     p = arg;
     while (*p != endchar)
     {
-       while (eap != NULL && eap->getline != NULL
+       while (eap != NULL && eap->ea_getline != NULL
                         && (*p == NUL || (VIM_ISWHITE(*whitep) && *p == '#')))
        {
            // End of the line, get the next one.
@@ -889,7 +889,7 @@ get_function_body(
 
     // Detect having skipped over comment lines to find the return
     // type.  Add NULL lines to keep the line count correct.
-    sourcing_lnum_off = get_sourced_lnum(eap->getline, eap->cookie);
+    sourcing_lnum_off = get_sourced_lnum(eap->ea_getline, eap->cookie);
     if (SOURCING_LNUM < sourcing_lnum_off)
     {
        sourcing_lnum_off -= SOURCING_LNUM;
@@ -952,7 +952,7 @@ get_function_body(
        }
 
        // Detect line continuation: SOURCING_LNUM increased more than one.
-       sourcing_lnum_off = get_sourced_lnum(eap->getline, eap->cookie);
+       sourcing_lnum_off = get_sourced_lnum(eap->ea_getline, eap->cookie);
        if (SOURCING_LNUM < sourcing_lnum_off)
            sourcing_lnum_off -= SOURCING_LNUM;
        else
@@ -1349,7 +1349,7 @@ lambda_function_body(
        fill_exarg_from_cctx(&eap, evalarg->eval_cctx);
     else
     {
-       eap.getline = evalarg->eval_getline;
+       eap.ea_getline = evalarg->eval_getline;
        eap.cookie = evalarg->eval_cookie;
     }
 
index 89b224eaa3c0affeba4f33140cf08c4e1f02354b..3f636c7a340714e57f4242d69719d5085e61f52f 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2180,
 /**/
     2179,
 /**/
index a1f4aa27324f03fdd0a76331e9f513ffd63cff69..ec1bb86d09d79a57690924f1168a76d57a700057 100644 (file)
@@ -1369,7 +1369,7 @@ ex_class(exarg_T *eap)
 
     if (!current_script_is_vim9()
                || (cmdmod.cmod_flags & CMOD_LEGACY)
-               || !getline_equal(eap->getline, eap->cookie, getsourceline))
+               || !getline_equal(eap->ea_getline, eap->cookie, getsourceline))
     {
        if (is_class)
            emsg(_(e_class_can_only_be_defined_in_vim9_script));
@@ -1530,7 +1530,7 @@ early_ret:
     for (;;)
     {
        vim_free(theline);
-       theline = eap->getline(':', eap->cookie, 0, GETLINE_CONCAT_ALL);
+       theline = eap->ea_getline(':', eap->cookie, 0, GETLINE_CONCAT_ALL);
        if (theline == NULL)
            break;
        char_u *line = skipwhite(theline);
@@ -1778,7 +1778,7 @@ early_ret:
            ea.cmd = line;
            ea.arg = p;
            ea.cmdidx = CMD_def;
-           ea.getline = eap->getline;
+           ea.ea_getline = eap->ea_getline;
            ea.cookie = eap->cookie;
 
            ga_init2(&lines_to_free, sizeof(char_u *), 50);
@@ -2177,7 +2177,7 @@ ex_type(exarg_T *eap UNUSED)
 
     if (!current_script_is_vim9()
                || (cmdmod.cmod_flags & CMOD_LEGACY)
-               || !getline_equal(eap->getline, eap->cookie, getsourceline))
+               || !getline_equal(eap->ea_getline, eap->cookie, getsourceline))
     {
        emsg(_(e_type_can_only_be_defined_in_vim9_script));
        return;
index 7bf25526d8ad4eab6cd928d597a0901400b0f11e..b896f43d308c2e49366a489993bfe377c1fcbd5d 100644 (file)
@@ -971,7 +971,7 @@ exarg_getline(
     void
 fill_exarg_from_cctx(exarg_T *eap, cctx_T *cctx)
 {
-    eap->getline = exarg_getline;
+    eap->ea_getline = exarg_getline;
     eap->cookie = cctx;
     eap->skip = cctx->ctx_skip == SKIP_YES;
 }
@@ -2628,7 +2628,7 @@ compile_assignment(
        list_T     *l;
 
        // [let] varname =<< [trim] {end}
-       eap->getline = exarg_getline;
+       eap->ea_getline = exarg_getline;
        eap->cookie = cctx;
        l = heredoc_get(eap, op + 3, FALSE, TRUE);
        if (l == NULL)