mirror of
https://github.com/neovim/neovim.git
synced 2025-09-10 21:38:19 +00:00
remove HAVE_STDARG_H
This commit is contained in:

committed by
Thiago de Arruda

parent
30160c1561
commit
079c47ed7b
@@ -65,7 +65,6 @@
|
|||||||
#define HAVE_SIGSTACK 1
|
#define HAVE_SIGSTACK 1
|
||||||
#define HAVE_SIGVEC 1
|
#define HAVE_SIGVEC 1
|
||||||
#define HAVE_ST_BLKSIZE 1
|
#define HAVE_ST_BLKSIZE 1
|
||||||
#define HAVE_STDARG_H 1
|
|
||||||
#define HAVE_STDLIB_H 1
|
#define HAVE_STDLIB_H 1
|
||||||
#define HAVE_STRCASECMP 1
|
#define HAVE_STRCASECMP 1
|
||||||
#define HAVE_STRERROR 1
|
#define HAVE_STRERROR 1
|
||||||
|
@@ -11865,13 +11865,11 @@ static void f_prevnonblank(typval_T *argvars, typval_T *rettv)
|
|||||||
rettv->vval.v_number = lnum;
|
rettv->vval.v_number = lnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_STDARG_H
|
|
||||||
/* This dummy va_list is here because:
|
/* This dummy va_list is here because:
|
||||||
* - passing a NULL pointer doesn't work when va_list isn't a pointer
|
* - passing a NULL pointer doesn't work when va_list isn't a pointer
|
||||||
* - locally in the function results in a "used before set" warning
|
* - locally in the function results in a "used before set" warning
|
||||||
* - using va_start() to initialize it gives "function with fixed args" error */
|
* - using va_start() to initialize it gives "function with fixed args" error */
|
||||||
static va_list ap;
|
static va_list ap;
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* "printf()" function
|
* "printf()" function
|
||||||
@@ -11880,7 +11878,6 @@ static void f_printf(typval_T *argvars, typval_T *rettv)
|
|||||||
{
|
{
|
||||||
rettv->v_type = VAR_STRING;
|
rettv->v_type = VAR_STRING;
|
||||||
rettv->vval.v_string = NULL;
|
rettv->vval.v_string = NULL;
|
||||||
#ifdef HAVE_STDARG_H /* only very old compilers can't do this */
|
|
||||||
{
|
{
|
||||||
char_u buf[NUMBUFLEN];
|
char_u buf[NUMBUFLEN];
|
||||||
int len;
|
int len;
|
||||||
@@ -11901,7 +11898,6 @@ static void f_printf(typval_T *argvars, typval_T *rettv)
|
|||||||
}
|
}
|
||||||
did_emsg |= saved_did_emsg;
|
did_emsg |= saved_did_emsg;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
165
src/message.c
165
src/message.c
@@ -328,40 +328,6 @@ void trunc_string(char_u *s, char_u *buf, int room, int buflen)
|
|||||||
* Note: Caller of smgs() and smsg_attr() must check the resulting string is
|
* Note: Caller of smgs() and smsg_attr() must check the resulting string is
|
||||||
* shorter than IOSIZE!!!
|
* shorter than IOSIZE!!!
|
||||||
*/
|
*/
|
||||||
# ifndef HAVE_STDARG_H
|
|
||||||
|
|
||||||
int
|
|
||||||
smsg(char_u *, long, long, long,
|
|
||||||
long, long, long, long, long, long, long);
|
|
||||||
int
|
|
||||||
smsg_attr(int, char_u *, long, long, long,
|
|
||||||
long, long, long, long, long, long, long);
|
|
||||||
|
|
||||||
int vim_snprintf(char *, size_t, char *, long, long, long,
|
|
||||||
long, long, long, long, long, long, long);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* smsg(str, arg, ...) is like using sprintf(buf, str, arg, ...) and then
|
|
||||||
* calling msg(buf).
|
|
||||||
* The buffer used is IObuff, the message is truncated at IOSIZE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* VARARGS */
|
|
||||||
int smsg(char_u *s, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8, long a9, long a10)
|
|
||||||
{
|
|
||||||
return smsg_attr(0, s, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* VARARGS */
|
|
||||||
int smsg_attr(int attr, char_u *s, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8, long a9, long a10)
|
|
||||||
{
|
|
||||||
vim_snprintf((char *)IObuff, IOSIZE, (char *)s,
|
|
||||||
a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
|
|
||||||
return msg_attr(IObuff, attr);
|
|
||||||
}
|
|
||||||
|
|
||||||
# else /* HAVE_STDARG_H */
|
|
||||||
|
|
||||||
int vim_snprintf(char *str, size_t str_m, char *fmt, ...);
|
int vim_snprintf(char *str, size_t str_m, char *fmt, ...);
|
||||||
|
|
||||||
int smsg(char_u *s, ...)
|
int smsg(char_u *s, ...)
|
||||||
@@ -384,8 +350,6 @@ int smsg_attr(int attr, char_u *s, ...)
|
|||||||
return msg_attr(IObuff, attr);
|
return msg_attr(IObuff, attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
# endif /* HAVE_STDARG_H */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Remember the last sourcing name/lnum used in an error message, so that it
|
* Remember the last sourcing name/lnum used in an error message, so that it
|
||||||
* isn't printed each time when it didn't change.
|
* isn't printed each time when it didn't change.
|
||||||
@@ -3060,7 +3024,7 @@ int vim_dialog_yesnoallcancel(int type, char_u *title, char_u *message, int dflt
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(HAVE_STDARG_H) && defined(FEAT_EVAL)
|
#if defined(FEAT_EVAL)
|
||||||
static char *e_printf = N_("E766: Insufficient arguments for printf()");
|
static char *e_printf = N_("E766: Insufficient arguments for printf()");
|
||||||
|
|
||||||
static long tv_nr(typval_T *tvs, int *idxp);
|
static long tv_nr(typval_T *tvs, int *idxp);
|
||||||
@@ -3173,7 +3137,6 @@ static double tv_float(typval_T *tvs, int *idxp)
|
|||||||
/* When generating prototypes all of this is skipped, cproto doesn't
|
/* When generating prototypes all of this is skipped, cproto doesn't
|
||||||
* understand this. */
|
* understand this. */
|
||||||
|
|
||||||
# ifdef HAVE_STDARG_H
|
|
||||||
/* Like vim_vsnprintf() but append to the string. */
|
/* Like vim_vsnprintf() but append to the string. */
|
||||||
int vim_snprintf_add(char *str, size_t str_m, char *fmt, ...)
|
int vim_snprintf_add(char *str, size_t str_m, char *fmt, ...)
|
||||||
{
|
{
|
||||||
@@ -3192,23 +3155,6 @@ int vim_snprintf_add(char *str, size_t str_m, char *fmt, ...)
|
|||||||
return str_l;
|
return str_l;
|
||||||
}
|
}
|
||||||
|
|
||||||
# else
|
|
||||||
/* Like vim_vsnprintf() but append to the string. */
|
|
||||||
int vim_snprintf_add(char *str, size_t str_m, char *fmt, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8, long a9, long a10)
|
|
||||||
{
|
|
||||||
size_t len = STRLEN(str);
|
|
||||||
size_t space;
|
|
||||||
|
|
||||||
if (str_m <= len)
|
|
||||||
space = 0;
|
|
||||||
else
|
|
||||||
space = str_m - len;
|
|
||||||
return vim_vsnprintf(str + len, space, fmt,
|
|
||||||
a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
|
|
||||||
}
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# ifdef HAVE_STDARG_H
|
|
||||||
int vim_snprintf(char *str, size_t str_m, char *fmt, ...)
|
int vim_snprintf(char *str, size_t str_m, char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
@@ -3220,26 +3166,7 @@ int vim_snprintf(char *str, size_t str_m, char *fmt, ...)
|
|||||||
return str_l;
|
return str_l;
|
||||||
}
|
}
|
||||||
|
|
||||||
int vim_vsnprintf(str, str_m, fmt, ap, tvs)
|
int vim_vsnprintf(char *str, size_t str_m, char *fmt, va_list ap, typval_T *tvs)
|
||||||
# else
|
|
||||||
/* clumsy way to work around missing va_list */
|
|
||||||
# define get_a_arg(i) (++i, i == 2 ? a1 : i == 3 ? a2 : i == 4 ? a3 : i == \
|
|
||||||
5 ? a4 : i == 6 ? a5 : i == 7 ? a6 : i == 8 ? a7 : i == \
|
|
||||||
9 ? a8 : i == \
|
|
||||||
10 ? a9 : a10)
|
|
||||||
|
|
||||||
/* VARARGS */
|
|
||||||
int vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
|
|
||||||
# endif
|
|
||||||
char *str;
|
|
||||||
size_t str_m;
|
|
||||||
char *fmt;
|
|
||||||
# ifdef HAVE_STDARG_H
|
|
||||||
va_list ap;
|
|
||||||
typval_T *tvs;
|
|
||||||
# else
|
|
||||||
long a1, a2, a3, a4, a5, a6, a7, a8, a9, a10;
|
|
||||||
# endif
|
|
||||||
{
|
{
|
||||||
size_t str_l = 0;
|
size_t str_l = 0;
|
||||||
char *p = fmt;
|
char *p = fmt;
|
||||||
@@ -3326,13 +3253,7 @@ long a1, a2, a3, a4, a5, a6, a7, a8, a9, a10;
|
|||||||
int j;
|
int j;
|
||||||
|
|
||||||
p++;
|
p++;
|
||||||
j =
|
j = tvs != NULL ? tv_nr(tvs, &arg_idx) : va_arg(ap, int);
|
||||||
#ifndef HAVE_STDARG_H
|
|
||||||
get_a_arg(arg_idx);
|
|
||||||
#else
|
|
||||||
tvs != NULL ? tv_nr(tvs, &arg_idx) :
|
|
||||||
va_arg(ap, int);
|
|
||||||
#endif
|
|
||||||
if (j >= 0)
|
if (j >= 0)
|
||||||
min_field_width = j;
|
min_field_width = j;
|
||||||
else {
|
else {
|
||||||
@@ -3356,13 +3277,7 @@ long a1, a2, a3, a4, a5, a6, a7, a8, a9, a10;
|
|||||||
if (*p == '*') {
|
if (*p == '*') {
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
j =
|
j = tvs != NULL ? tv_nr(tvs, &arg_idx) : va_arg(ap, int);
|
||||||
#ifndef HAVE_STDARG_H
|
|
||||||
get_a_arg(arg_idx);
|
|
||||||
#else
|
|
||||||
tvs != NULL ? tv_nr(tvs, &arg_idx) :
|
|
||||||
va_arg(ap, int);
|
|
||||||
#endif
|
|
||||||
p++;
|
p++;
|
||||||
if (j >= 0)
|
if (j >= 0)
|
||||||
precision = j;
|
precision = j;
|
||||||
@@ -3422,13 +3337,7 @@ long a1, a2, a3, a4, a5, a6, a7, a8, a9, a10;
|
|||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
j =
|
j = tvs != NULL ? tv_nr(tvs, &arg_idx) : va_arg(ap, int);
|
||||||
#ifndef HAVE_STDARG_H
|
|
||||||
get_a_arg(arg_idx);
|
|
||||||
#else
|
|
||||||
tvs != NULL ? tv_nr(tvs, &arg_idx) :
|
|
||||||
va_arg(ap, int);
|
|
||||||
#endif
|
|
||||||
/* standard demands unsigned char */
|
/* standard demands unsigned char */
|
||||||
uchar_arg = (unsigned char)j;
|
uchar_arg = (unsigned char)j;
|
||||||
str_arg = (char *)&uchar_arg;
|
str_arg = (char *)&uchar_arg;
|
||||||
@@ -3437,13 +3346,7 @@ long a1, a2, a3, a4, a5, a6, a7, a8, a9, a10;
|
|||||||
|
|
||||||
case 's':
|
case 's':
|
||||||
case 'S':
|
case 'S':
|
||||||
str_arg =
|
str_arg = tvs != NULL ? tv_str(tvs, &arg_idx) : va_arg(ap, char *);
|
||||||
#ifndef HAVE_STDARG_H
|
|
||||||
(char *)get_a_arg(arg_idx);
|
|
||||||
#else
|
|
||||||
tvs != NULL ? tv_str(tvs, &arg_idx) :
|
|
||||||
va_arg(ap, char *);
|
|
||||||
#endif
|
|
||||||
if (str_arg == NULL) {
|
if (str_arg == NULL) {
|
||||||
str_arg = "[NULL]";
|
str_arg = "[NULL]";
|
||||||
str_arg_l = 6;
|
str_arg_l = 6;
|
||||||
@@ -3517,13 +3420,8 @@ long a1, a2, a3, a4, a5, a6, a7, a8, a9, a10;
|
|||||||
|
|
||||||
if (fmt_spec == 'p') {
|
if (fmt_spec == 'p') {
|
||||||
length_modifier = '\0';
|
length_modifier = '\0';
|
||||||
ptr_arg =
|
ptr_arg = tvs != NULL ? (void *)tv_str(tvs, &arg_idx)
|
||||||
#ifndef HAVE_STDARG_H
|
: va_arg(ap, void *);
|
||||||
(void *)get_a_arg(arg_idx);
|
|
||||||
#else
|
|
||||||
tvs != NULL ? (void *)tv_str(tvs, &arg_idx) :
|
|
||||||
va_arg(ap, void *);
|
|
||||||
#endif
|
|
||||||
if (ptr_arg != NULL)
|
if (ptr_arg != NULL)
|
||||||
arg_sign = 1;
|
arg_sign = 1;
|
||||||
} else if (fmt_spec == 'd') {
|
} else if (fmt_spec == 'd') {
|
||||||
@@ -3532,26 +3430,15 @@ long a1, a2, a3, a4, a5, a6, a7, a8, a9, a10;
|
|||||||
case '\0':
|
case '\0':
|
||||||
case 'h':
|
case 'h':
|
||||||
/* char and short arguments are passed as int. */
|
/* char and short arguments are passed as int. */
|
||||||
int_arg =
|
int_arg = tvs != NULL ? tv_nr(tvs, &arg_idx) : va_arg(ap, int);
|
||||||
#ifndef HAVE_STDARG_H
|
|
||||||
get_a_arg(arg_idx);
|
|
||||||
#else
|
|
||||||
tvs != NULL ? tv_nr(tvs, &arg_idx) :
|
|
||||||
va_arg(ap, int);
|
|
||||||
#endif
|
|
||||||
if (int_arg > 0)
|
if (int_arg > 0)
|
||||||
arg_sign = 1;
|
arg_sign = 1;
|
||||||
else if (int_arg < 0)
|
else if (int_arg < 0)
|
||||||
arg_sign = -1;
|
arg_sign = -1;
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
long_arg =
|
long_arg = tvs != NULL ? tv_nr(tvs, &arg_idx)
|
||||||
#ifndef HAVE_STDARG_H
|
: va_arg(ap, long int);
|
||||||
get_a_arg(arg_idx);
|
|
||||||
#else
|
|
||||||
tvs != NULL ? tv_nr(tvs, &arg_idx) :
|
|
||||||
va_arg(ap, long int);
|
|
||||||
#endif
|
|
||||||
if (long_arg > 0)
|
if (long_arg > 0)
|
||||||
arg_sign = 1;
|
arg_sign = 1;
|
||||||
else if (long_arg < 0)
|
else if (long_arg < 0)
|
||||||
@@ -3563,26 +3450,14 @@ long a1, a2, a3, a4, a5, a6, a7, a8, a9, a10;
|
|||||||
switch (length_modifier) {
|
switch (length_modifier) {
|
||||||
case '\0':
|
case '\0':
|
||||||
case 'h':
|
case 'h':
|
||||||
uint_arg =
|
uint_arg = tvs != NULL ? (unsigned)tv_nr(tvs, &arg_idx)
|
||||||
#ifndef HAVE_STDARG_H
|
: va_arg(ap, unsigned int);
|
||||||
get_a_arg(arg_idx);
|
|
||||||
#else
|
|
||||||
tvs != NULL ? (unsigned)
|
|
||||||
tv_nr(tvs, &arg_idx) :
|
|
||||||
va_arg(ap, unsigned int);
|
|
||||||
#endif
|
|
||||||
if (uint_arg != 0)
|
if (uint_arg != 0)
|
||||||
arg_sign = 1;
|
arg_sign = 1;
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
ulong_arg =
|
ulong_arg = tvs != NULL ? (unsigned long)tv_nr(tvs, &arg_idx)
|
||||||
#ifndef HAVE_STDARG_H
|
: va_arg(ap, unsigned long int);
|
||||||
get_a_arg(arg_idx);
|
|
||||||
#else
|
|
||||||
tvs != NULL ? (unsigned long)
|
|
||||||
tv_nr(tvs, &arg_idx) :
|
|
||||||
va_arg(ap, unsigned long int);
|
|
||||||
#endif
|
|
||||||
if (ulong_arg != 0)
|
if (ulong_arg != 0)
|
||||||
arg_sign = 1;
|
arg_sign = 1;
|
||||||
break;
|
break;
|
||||||
@@ -3725,13 +3600,7 @@ long a1, a2, a3, a4, a5, a6, a7, a8, a9, a10;
|
|||||||
int l;
|
int l;
|
||||||
int remove_trailing_zeroes = FALSE;
|
int remove_trailing_zeroes = FALSE;
|
||||||
|
|
||||||
f =
|
f = tvs != NULL ? tv_float(tvs, &arg_idx) : va_arg(ap, double);
|
||||||
# ifndef HAVE_STDARG_H
|
|
||||||
get_a_arg(arg_idx);
|
|
||||||
# else
|
|
||||||
tvs != NULL ? tv_float(tvs, &arg_idx) :
|
|
||||||
va_arg(ap, double);
|
|
||||||
# endif
|
|
||||||
abs_f = f < 0 ? -f : f;
|
abs_f = f < 0 ? -f : f;
|
||||||
|
|
||||||
if (fmt_spec == 'g' || fmt_spec == 'G') {
|
if (fmt_spec == 'g' || fmt_spec == 'G') {
|
||||||
@@ -3952,10 +3821,8 @@ long a1, a2, a3, a4, a5, a6, a7, a8, a9, a10;
|
|||||||
str[str_l <= str_m - 1 ? str_l : str_m - 1] = '\0';
|
str[str_l <= str_m - 1 ? str_l : str_m - 1] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_STDARG_H
|
|
||||||
if (tvs != NULL && tvs[arg_idx - 1].v_type != VAR_UNKNOWN)
|
if (tvs != NULL && tvs[arg_idx - 1].v_type != VAR_UNKNOWN)
|
||||||
EMSG(_("E767: Too many arguments to printf()"));
|
EMSG(_("E767: Too many arguments to printf()"));
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Return the number of characters formatted (excluding trailing nul
|
/* Return the number of characters formatted (excluding trailing nul
|
||||||
* character), that is, the number of characters that would have been
|
* character), that is, the number of characters that would have been
|
||||||
|
@@ -1819,11 +1819,7 @@ int emsg3(char_u *s, char_u *a1, char_u *a2)
|
|||||||
{
|
{
|
||||||
if (emsg_not_now())
|
if (emsg_not_now())
|
||||||
return TRUE; /* no error messages at the moment */
|
return TRUE; /* no error messages at the moment */
|
||||||
#ifdef HAVE_STDARG_H
|
|
||||||
vim_snprintf((char *)IObuff, IOSIZE, (char *)s, a1, a2);
|
vim_snprintf((char *)IObuff, IOSIZE, (char *)s, a1, a2);
|
||||||
#else
|
|
||||||
vim_snprintf((char *)IObuff, IOSIZE, (char *)s, (long_u)a1, (long_u)a2);
|
|
||||||
#endif
|
|
||||||
return emsg(IObuff);
|
return emsg(IObuff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -26,7 +26,6 @@
|
|||||||
# define GdkEventKey int
|
# define GdkEventKey int
|
||||||
# define XImage int
|
# define XImage int
|
||||||
|
|
||||||
# if !defined MESSAGE_FILE || defined(HAVE_STDARG_H)
|
|
||||||
/* These prototypes cannot be produced automatically and conflict with
|
/* These prototypes cannot be produced automatically and conflict with
|
||||||
* the old-style prototypes in message.c. */
|
* the old-style prototypes in message.c. */
|
||||||
int
|
int
|
||||||
@@ -41,10 +40,7 @@ vim_snprintf_add(char *, size_t, char *, ...);
|
|||||||
int
|
int
|
||||||
vim_snprintf(char *, size_t, char *, ...);
|
vim_snprintf(char *, size_t, char *, ...);
|
||||||
|
|
||||||
# if defined(HAVE_STDARG_H)
|
|
||||||
int vim_vsnprintf(char *str, size_t str_m, char *fmt, va_list ap, typval_T *tvs);
|
int vim_vsnprintf(char *str, size_t str_m, char *fmt, va_list ap, typval_T *tvs);
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#ifndef HAVE_STRPBRK /* not generated automatically from misc2.c */
|
#ifndef HAVE_STRPBRK /* not generated automatically from misc2.c */
|
||||||
char_u *vim_strpbrk(char_u *s, char_u *charset);
|
char_u *vim_strpbrk(char_u *s, char_u *charset);
|
||||||
|
@@ -140,9 +140,7 @@ typedef unsigned long u8char_T; /* long should be 32 bits or more */
|
|||||||
#ifdef HAVE_WCTYPE_H
|
#ifdef HAVE_WCTYPE_H
|
||||||
# include <wctype.h>
|
# include <wctype.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_STDARG_H
|
#include <stdarg.h>
|
||||||
# include <stdarg.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(HAVE_SYS_SELECT_H) && \
|
#if defined(HAVE_SYS_SELECT_H) && \
|
||||||
(!defined(HAVE_SYS_TIME_H) || defined(SYS_SELECT_WITH_SYS_TIME))
|
(!defined(HAVE_SYS_TIME_H) || defined(SYS_SELECT_WITH_SYS_TIME))
|
||||||
|
Reference in New Issue
Block a user