patch 9.0.2180: POSIX function name in exarg causes issues

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>
This commit is contained in:
Zoltan Arpadffy
2023-12-19 20:53:07 +01:00
committed by Christian Brabandt
parent 63210c214a
commit 6fdb628082
17 changed files with 45 additions and 47 deletions

View 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;