changeset 19013:dd9ab0674eec v8.2.0067

patch 8.2.0067: ERROR_UNKNOWN clashes on some systems Commit: https://github.com/vim/vim/commit/ef140544f6703a7a4c0f6a15f610508ed6b09e89 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Dec 31 21:27:13 2019 +0100 patch 8.2.0067: ERROR_UNKNOWN clashes on some systems Problem: ERROR_UNKNOWN clashes on some systems. Solution: Rename ERROR_ to FCERR_. (Ola S?der, closes https://github.com/vim/vim/issues/5415)
author Bram Moolenaar <Bram@vim.org>
date Tue, 31 Dec 2019 21:30:04 +0100
parents 5eb079827641
children 0ecf33c2ad4b
files src/evalfunc.c src/userfunc.c src/version.c src/vim.h
diffstat 4 files changed, 41 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -976,14 +976,14 @@ call_internal_func(
 
     i = find_internal_func(name);
     if (i < 0)
-	return ERROR_UNKNOWN;
+	return FCERR_UNKNOWN;
     if (argcount < global_functions[i].f_min_argc)
-	return ERROR_TOOFEW;
+	return FCERR_TOOFEW;
     if (argcount > global_functions[i].f_max_argc)
-	return ERROR_TOOMANY;
+	return FCERR_TOOMANY;
     argvars[argcount].v_type = VAR_UNKNOWN;
     global_functions[i].f_func(argvars, rettv);
-    return ERROR_NONE;
+    return FCERR_NONE;
 }
 
 /*
@@ -1003,13 +1003,13 @@ call_internal_method(
 
     fi = find_internal_func(name);
     if (fi < 0)
-	return ERROR_UNKNOWN;
+	return FCERR_UNKNOWN;
     if (global_functions[fi].f_argtype == 0)
-	return ERROR_NOTMETHOD;
+	return FCERR_NOTMETHOD;
     if (argcount + 1 < global_functions[fi].f_min_argc)
-	return ERROR_TOOFEW;
+	return FCERR_TOOFEW;
     if (argcount + 1 > global_functions[fi].f_max_argc)
-	return ERROR_TOOMANY;
+	return FCERR_TOOMANY;
 
     if (global_functions[fi].f_argtype == FEARG_LAST)
     {
@@ -1055,7 +1055,7 @@ call_internal_method(
     argv[argcount + 1].v_type = VAR_UNKNOWN;
 
     global_functions[fi].f_func(argv, rettv);
-    return ERROR_NONE;
+    return FCERR_NONE;
 }
 
 /*
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -549,7 +549,7 @@ fname_trans_sid(char_u *name, char_u *fn
 	if (eval_fname_sid(name))	// "<SID>" or "s:"
 	{
 	    if (current_sctx.sc_sid <= 0)
-		*error = ERROR_SCRIPT;
+		*error = FCERR_SCRIPT;
 	    else
 	    {
 		sprintf((char *)fname_buf + 3, "%ld_",
@@ -566,7 +566,7 @@ fname_trans_sid(char_u *name, char_u *fn
 	{
 	    fname = alloc(i + STRLEN(name + llen) + 1);
 	    if (fname == NULL)
-		*error = ERROR_OTHER;
+		*error = FCERR_OTHER;
 	    else
 	    {
 		*tofree = fname;
@@ -1482,7 +1482,7 @@ call_func(
     funcexe_T	*funcexe)	// more arguments
 {
     int		ret = FAIL;
-    int		error = ERROR_NONE;
+    int		error = FCERR_NONE;
     int		i;
     ufunc_T	*fp;
     char_u	fname_buf[FLEN_FIXED + 1];
@@ -1520,13 +1520,13 @@ call_func(
 	// When the dict was bound explicitly use the one from the partial.
 	if (partial->pt_dict != NULL && (selfdict == NULL || !partial->pt_auto))
 	    selfdict = partial->pt_dict;
-	if (error == ERROR_NONE && partial->pt_argc > 0)
+	if (error == FCERR_NONE && partial->pt_argc > 0)
 	{
 	    for (argv_clear = 0; argv_clear < partial->pt_argc; ++argv_clear)
 	    {
 		if (argv_clear + argcount_in >= MAX_FUNC_ARGS)
 		{
-		    error = ERROR_TOOMANY;
+		    error = FCERR_TOOMANY;
 		    goto theend;
 		}
 		copy_tv(&partial->pt_argv[argv_clear], &argv[argv_clear]);
@@ -1538,7 +1538,7 @@ call_func(
 	}
     }
 
-    if (error == ERROR_NONE && funcexe->evaluate)
+    if (error == FCERR_NONE && funcexe->evaluate)
     {
 	char_u *rfname = fname;
 
@@ -1548,7 +1548,7 @@ call_func(
 
 	rettv->v_type = VAR_NUMBER;	// default rettv is number zero
 	rettv->vval.v_number = 0;
-	error = ERROR_UNKNOWN;
+	error = FCERR_UNKNOWN;
 
 	if (!builtin_function(rfname, -1))
 	{
@@ -1577,7 +1577,7 @@ call_func(
 	    }
 
 	    if (fp != NULL && (fp->uf_flags & FC_DELETED))
-		error = ERROR_DELETED;
+		error = FCERR_DELETED;
 	    else if (fp != NULL)
 	    {
 		if (funcexe->argv_func != NULL)
@@ -1598,11 +1598,11 @@ call_func(
 		if (fp->uf_flags & FC_RANGE && funcexe->doesrange != NULL)
 		    *funcexe->doesrange = TRUE;
 		if (argcount < fp->uf_args.ga_len - fp->uf_def_args.ga_len)
-		    error = ERROR_TOOFEW;
+		    error = FCERR_TOOFEW;
 		else if (!fp->uf_varargs && argcount > fp->uf_args.ga_len)
-		    error = ERROR_TOOMANY;
+		    error = FCERR_TOOMANY;
 		else if ((fp->uf_flags & FC_DICT) && selfdict == NULL)
-		    error = ERROR_DICT;
+		    error = FCERR_DICT;
 		else
 		{
 		    int did_save_redo = FALSE;
@@ -1630,7 +1630,7 @@ call_func(
 		    if (did_save_redo)
 			restoreRedobuff(&save_redo);
 		    restore_search_patterns();
-		    error = ERROR_NONE;
+		    error = FCERR_NONE;
 		}
 	    }
 	}
@@ -1662,7 +1662,7 @@ call_func(
 	 */
 	update_force_abort();
     }
-    if (error == ERROR_NONE)
+    if (error == FCERR_NONE)
 	ret = OK;
 
 theend:
@@ -1674,31 +1674,31 @@ theend:
     {
 	switch (error)
 	{
-	    case ERROR_UNKNOWN:
+	    case FCERR_UNKNOWN:
 		    emsg_funcname(N_("E117: Unknown function: %s"), name);
 		    break;
-	    case ERROR_NOTMETHOD:
+	    case FCERR_NOTMETHOD:
 		    emsg_funcname(
 			       N_("E276: Cannot use function as a method: %s"),
 									 name);
 		    break;
-	    case ERROR_DELETED:
+	    case FCERR_DELETED:
 		    emsg_funcname(N_("E933: Function was deleted: %s"), name);
 		    break;
-	    case ERROR_TOOMANY:
+	    case FCERR_TOOMANY:
 		    emsg_funcname((char *)e_toomanyarg, name);
 		    break;
-	    case ERROR_TOOFEW:
+	    case FCERR_TOOFEW:
 		    emsg_funcname(
 			     N_("E119: Not enough arguments for function: %s"),
 									name);
 		    break;
-	    case ERROR_SCRIPT:
+	    case FCERR_SCRIPT:
 		    emsg_funcname(
 			   N_("E120: Using <SID> not in a script context: %s"),
 									name);
 		    break;
-	    case ERROR_DICT:
+	    case FCERR_DICT:
 		    emsg_funcname(
 		      N_("E725: Calling dict function without Dictionary: %s"),
 									name);
@@ -3847,7 +3847,7 @@ set_ref_in_func(char_u *name, ufunc_T *f
 {
     ufunc_T	*fp = fp_in;
     funccall_T	*fc;
-    int		error = ERROR_NONE;
+    int		error = FCERR_NONE;
     char_u	fname_buf[FLEN_FIXED + 1];
     char_u	*tofree = NULL;
     char_u	*fname;
--- a/src/version.c
+++ b/src/version.c
@@ -743,6 +743,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    67,
+/**/
     66,
 /**/
     65,
--- a/src/vim.h
+++ b/src/vim.h
@@ -2551,15 +2551,15 @@ typedef enum {
 				// be freed.
 
 // errors for when calling a function
-#define ERROR_UNKNOWN	0
-#define ERROR_TOOMANY	1
-#define ERROR_TOOFEW	2
-#define ERROR_SCRIPT	3
-#define ERROR_DICT	4
-#define ERROR_NONE	5
-#define ERROR_OTHER	6
-#define ERROR_DELETED	7
-#define ERROR_NOTMETHOD	8   // function cannot be used as a method
+#define FCERR_UNKNOWN	0
+#define FCERR_TOOMANY	1
+#define FCERR_TOOFEW	2
+#define FCERR_SCRIPT	3
+#define FCERR_DICT	4
+#define FCERR_NONE	5
+#define FCERR_OTHER	6
+#define FCERR_DELETED	7
+#define FCERR_NOTMETHOD	8   // function cannot be used as a method
 
 // flags for find_name_end()
 #define FNE_INCL_BR	1	// include [] in name