GH-93207: Remove HAVE_STDARG_PROTOTYPES configure check for stdarg.h (#93215)

This commit is contained in:
Kumar Aditya 2022-05-27 17:00:45 +05:30 committed by GitHub
parent ddc4a782d3
commit cb04a09d2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 9 additions and 171 deletions

View File

@ -144,6 +144,11 @@ Changes in the Python API
Build Changes
=============
* ``va_start()`` with two parameters, like ``va_start(args, format),``
is now required to build Python.
``va_start()`` is no longer called with a single parameter.
(Contributed by Kumar Aditya in :gh:`93207`.)
C API Changes
=============

View File

@ -0,0 +1,3 @@
``va_start()`` with two parameters, like ``va_start(args, format),``
is now required to build Python. ``va_start()`` is no longer called with a single parameter.
Patch by Kumar Aditya.

View File

@ -2643,11 +2643,7 @@ task_set_error_soon(TaskObj *task, PyObject *et, const char *format, ...)
PyObject* msg;
va_list vargs;
#ifdef HAVE_STDARG_PROTOTYPES
va_start(vargs, format);
#else
va_start(vargs);
#endif
msg = PyUnicode_FromFormatV(format, vargs);
va_end(vargs);

View File

@ -255,11 +255,7 @@ _setException(PyObject *exc, const char* altmsg, ...)
const char *lib, *func, *reason;
va_list vargs;
#ifdef HAVE_STDARG_PROTOTYPES
va_start(vargs, altmsg);
#else
va_start(vargs);
#endif
if (!errcode) {
if (altmsg == NULL) {
PyErr_SetString(exc, "no reason supplied");

View File

@ -377,11 +377,7 @@ PyBytes_FromFormat(const char *format, ...)
PyObject* ret;
va_list vargs;
#ifdef HAVE_STDARG_PROTOTYPES
va_start(vargs, format);
#else
va_start(vargs);
#endif
ret = PyBytes_FromFormatV(format, vargs);
va_end(vargs);
return ret;

View File

@ -3816,11 +3816,7 @@ _PyErr_TrySetFromCause(const char *format, ...)
Py_DECREF(tb);
}
#ifdef HAVE_STDARG_PROTOTYPES
va_start(vargs, format);
#else
va_start(vargs);
#endif
msg_prefix = PyUnicode_FromFormatV(format, vargs);
va_end(vargs);
if (msg_prefix == NULL) {

View File

@ -2708,11 +2708,7 @@ PyUnicode_FromFormat(const char *format, ...)
PyObject* ret;
va_list vargs;
#ifdef HAVE_STDARG_PROTOTYPES
va_start(vargs, format);
#else
va_start(vargs);
#endif
ret = PyUnicode_FromFormatV(format, vargs);
va_end(vargs);
return ret;

View File

@ -569,9 +569,6 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
/* Define to 1 if you have the <signal.h> header file. */
#define HAVE_SIGNAL_H 1
/* Define if you have the <stdarg.h> prototypes. */
#define HAVE_STDARG_PROTOTYPES
/* Define if you have the <stddef.h> header file. */
#define HAVE_STDDEF_H 1

View File

@ -1105,11 +1105,7 @@ static int
syntaxerror(struct tok_state *tok, const char *format, ...)
{
va_list vargs;
#ifdef HAVE_STDARG_PROTOTYPES
va_start(vargs, format);
#else
va_start(vargs);
#endif
int ret = _syntaxerror_range(tok, format, -1, -1, vargs);
va_end(vargs);
return ret;
@ -1121,11 +1117,7 @@ syntaxerror_known_range(struct tok_state *tok,
const char *format, ...)
{
va_list vargs;
#ifdef HAVE_STDARG_PROTOTYPES
va_start(vargs, format);
#else
va_start(vargs);
#endif
int ret = _syntaxerror_range(tok, format, col_offset, end_col_offset, vargs);
va_end(vargs);
return ret;
@ -1146,11 +1138,7 @@ parser_warn(struct tok_state *tok, PyObject *category, const char *format, ...)
{
PyObject *errmsg;
va_list vargs;
#ifdef HAVE_STDARG_PROTOTYPES
va_start(vargs, format);
#else
va_start(vargs);
#endif
errmsg = PyUnicode_FromFormatV(format, vargs);
va_end(vargs);
if (!errmsg) {

View File

@ -1136,11 +1136,7 @@ PyErr_WarnFormat(PyObject *category, Py_ssize_t stack_level,
int res;
va_list vargs;
#ifdef HAVE_STDARG_PROTOTYPES
va_start(vargs, format);
#else
va_start(vargs);
#endif
res = _PyErr_WarnFormatV(NULL, category, stack_level, format, vargs);
va_end(vargs);
return res;
@ -1153,11 +1149,7 @@ _PyErr_WarnFormat(PyObject *source, PyObject *category, Py_ssize_t stack_level,
int res;
va_list vargs;
#ifdef HAVE_STDARG_PROTOTYPES
va_start(vargs, format);
#else
va_start(vargs);
#endif
res = _PyErr_WarnFormatV(source, category, stack_level, format, vargs);
va_end(vargs);
return res;
@ -1170,11 +1162,7 @@ PyErr_ResourceWarning(PyObject *source, Py_ssize_t stack_level,
int res;
va_list vargs;
#ifdef HAVE_STDARG_PROTOTYPES
va_start(vargs, format);
#else
va_start(vargs);
#endif
res = _PyErr_WarnFormatV(source, PyExc_ResourceWarning,
stack_level, format, vargs);
va_end(vargs);
@ -1274,11 +1262,7 @@ PyErr_WarnExplicitFormat(PyObject *category,
goto exit;
}
#ifdef HAVE_STDARG_PROTOTYPES
va_start(vargs, format);
#else
va_start(vargs);
#endif
message = PyUnicode_FromFormatV(format, vargs);
if (message != NULL) {
PyObject *res;

View File

@ -6094,11 +6094,7 @@ static int
compiler_error(struct compiler *c, const char *format, ...)
{
va_list vargs;
#ifdef HAVE_STDARG_PROTOTYPES
va_start(vargs, format);
#else
va_start(vargs);
#endif
PyObject *msg = PyUnicode_FromFormatV(format, vargs);
va_end(vargs);
if (msg == NULL) {
@ -6131,11 +6127,7 @@ static int
compiler_warn(struct compiler *c, const char *format, ...)
{
va_list vargs;
#ifdef HAVE_STDARG_PROTOTYPES
va_start(vargs, format);
#else
va_start(vargs);
#endif
PyObject *msg = PyUnicode_FromFormatV(format, vargs);
va_end(vargs);
if (msg == NULL) {

View File

@ -688,11 +688,7 @@ _PyErr_FormatFromCauseTstate(PyThreadState *tstate, PyObject *exception,
const char *format, ...)
{
va_list vargs;
#ifdef HAVE_STDARG_PROTOTYPES
va_start(vargs, format);
#else
va_start(vargs);
#endif
_PyErr_FormatVFromCause(tstate, exception, format, vargs);
va_end(vargs);
return NULL;
@ -703,11 +699,7 @@ _PyErr_FormatFromCause(PyObject *exception, const char *format, ...)
{
PyThreadState *tstate = _PyThreadState_GET();
va_list vargs;
#ifdef HAVE_STDARG_PROTOTYPES
va_start(vargs, format);
#else
va_start(vargs);
#endif
_PyErr_FormatVFromCause(tstate, exception, format, vargs);
va_end(vargs);
return NULL;
@ -1096,11 +1088,7 @@ _PyErr_Format(PyThreadState *tstate, PyObject *exception,
const char *format, ...)
{
va_list vargs;
#ifdef HAVE_STDARG_PROTOTYPES
va_start(vargs, format);
#else
va_start(vargs);
#endif
_PyErr_FormatV(tstate, exception, format, vargs);
va_end(vargs);
return NULL;
@ -1112,11 +1100,7 @@ PyErr_Format(PyObject *exception, const char *format, ...)
{
PyThreadState *tstate = _PyThreadState_GET();
va_list vargs;
#ifdef HAVE_STDARG_PROTOTYPES
va_start(vargs, format);
#else
va_start(vargs);
#endif
_PyErr_FormatV(tstate, exception, format, vargs);
va_end(vargs);
return NULL;

View File

@ -2792,11 +2792,7 @@ PyArg_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t m
stack = _PyTuple_ITEMS(args);
nargs = PyTuple_GET_SIZE(args);
#ifdef HAVE_STDARG_PROTOTYPES
va_start(vargs, max);
#else
va_start(vargs);
#endif
retval = unpack_stack(stack, nargs, name, min, max, vargs);
va_end(vargs);
return retval;
@ -2809,11 +2805,7 @@ _PyArg_UnpackStack(PyObject *const *args, Py_ssize_t nargs, const char *name,
int retval;
va_list vargs;
#ifdef HAVE_STDARG_PROTOTYPES
va_start(vargs, max);
#else
va_start(vargs);
#endif
retval = unpack_stack(args, nargs, name, min, max, vargs);
va_end(vargs);
return retval;

View File

@ -496,11 +496,7 @@ _hamt_dump_format(_PyUnicodeWriter *writer, const char *format, ...)
int ret;
va_list vargs;
#ifdef HAVE_STDARG_PROTOTYPES
va_start(vargs, format);
#else
va_start(vargs);
#endif
msg = PyUnicode_FromFormatV(format, vargs);
va_end(vargs);

View File

@ -2838,11 +2838,7 @@ _Py_FatalErrorFormat(const char *func, const char *format, ...)
}
va_list vargs;
#ifdef HAVE_STDARG_PROTOTYPES
va_start(vargs, format);
#else
va_start(vargs);
#endif
vfprintf(stream, format, vargs);
va_end(vargs);

View File

@ -292,11 +292,7 @@ _PySys_Audit(PyThreadState *tstate, const char *event,
const char *argFormat, ...)
{
va_list vargs;
#ifdef HAVE_STDARG_PROTOTYPES
va_start(vargs, argFormat);
#else
va_start(vargs);
#endif
int res = sys_audit_tstate(tstate, event, argFormat, vargs);
va_end(vargs);
return res;
@ -307,11 +303,7 @@ PySys_Audit(const char *event, const char *argFormat, ...)
{
PyThreadState *tstate = _PyThreadState_GET();
va_list vargs;
#ifdef HAVE_STDARG_PROTOTYPES
va_start(vargs, argFormat);
#else
va_start(vargs);
#endif
int res = sys_audit_tstate(tstate, event, argFormat, vargs);
va_end(vargs);
return res;

46
configure generated vendored
View File

@ -18416,52 +18416,6 @@ if test "x$ac_cv_function_prototypes" = xyes; then :
$as_echo "#define HAVE_PROTOTYPES 1" >>confdefs.h
fi
works=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for variable length prototypes and stdarg.h" >&5
$as_echo_n "checking for variable length prototypes and stdarg.h... " >&6; }
if ${ac_cv_stdarg_prototypes+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdarg.h>
int foo(int x, ...) {
va_list va;
va_start(va, x);
va_arg(va, int);
va_arg(va, char *);
va_arg(va, double);
return 0;
}
int
main ()
{
return foo(10, "", 3.14);
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_stdarg_prototypes=yes
else
ac_cv_stdarg_prototypes=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_stdarg_prototypes" >&5
$as_echo "$ac_cv_stdarg_prototypes" >&6; }
if test "x$ac_cv_stdarg_prototypes" = xyes; then :
$as_echo "#define HAVE_STDARG_PROTOTYPES 1" >>confdefs.h
fi

View File

@ -1947,7 +1947,7 @@ AS_CASE([$ac_sys_system],
dnl build with WASM debug info if either Py_DEBUG is set or the target is
dnl node-debug or browser-debug.
AS_VAR_IF([Py_DEBUG], [yes], [wasm_debug=yes], [wasm_debug=no])
dnl Start with 20 MB and allow to grow
AS_VAR_APPEND([LDFLAGS_NODIST], [" -sALLOW_MEMORY_GROWTH -sTOTAL_MEMORY=20971520"])
@ -5022,27 +5022,6 @@ AS_VAR_IF([ac_cv_function_prototypes], [yes], [
[Define if your compiler supports function prototype])
])
works=no
AC_CACHE_CHECK([for variable length prototypes and stdarg.h], [ac_cv_stdarg_prototypes], [
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <stdarg.h>
int foo(int x, ...) {
va_list va;
va_start(va, x);
va_arg(va, int);
va_arg(va, char *);
va_arg(va, double);
return 0;
}
]], [[return foo(10, "", 3.14);]])],
[ac_cv_stdarg_prototypes=yes], [ac_cv_stdarg_prototypes=no])
])
AS_VAR_IF([ac_cv_stdarg_prototypes], [yes], [
AC_DEFINE(HAVE_STDARG_PROTOTYPES, 1,
[Define if your compiler supports variable length function prototypes
(e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h>])
])
# check for socketpair
PY_CHECK_FUNC([socketpair], [

View File

@ -1115,10 +1115,6 @@
/* Define if you have struct stat.st_mtimensec */
#undef HAVE_STAT_TV_NSEC2
/* Define if your compiler supports variable length function prototypes (e.g.
void fprintf(FILE *, char *, ...);) *and* <stdarg.h> */
#undef HAVE_STDARG_PROTOTYPES
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H