[Gmp-commit] /var/hg/gmp: 4 new changesets
mercurial at gmplib.org
mercurial at gmplib.org
Sun Jan 19 13:46:13 UTC 2014
details: /var/hg/gmp/rev/6e2b974cc8dd
changeset: 16225:6e2b974cc8dd
user: Torbjorn Granlund <tege at gmplib.org>
date: Sun Jan 19 14:19:57 2014 +0100
description:
Undocument mpz_array_init.
details: /var/hg/gmp/rev/d4c30d831b7d
changeset: 16226:d4c30d831b7d
user: Torbjorn Granlund <tege at gmplib.org>
date: Sun Jan 19 14:35:25 2014 +0100
description:
Get rid of varargs code and references.
details: /var/hg/gmp/rev/cccdd557048e
changeset: 16227:cccdd557048e
user: Torbjorn Granlund <tege at gmplib.org>
date: Sun Jan 19 14:38:19 2014 +0100
description:
Suppress GMP_C_STDARG.
details: /var/hg/gmp/rev/b2faa9fedbdb
changeset: 16228:b2faa9fedbdb
user: Torbjorn Granlund <tege at gmplib.org>
date: Sun Jan 19 14:46:09 2014 +0100
description:
ChangeLog
diffstat:
ChangeLog | 9 ++++++-
acinclude.m4 | 49 +++++++++++++++++----------------------
configure.ac | 2 +-
demos/expr/README | 2 +-
demos/expr/expr-impl.h | 6 +----
doc/gmp.texi | 60 ++++--------------------------------------------
gmp-h.in | 10 +++----
mpf/clears.c | 18 --------------
mpf/inits.c | 18 --------------
mpq/clears.c | 18 --------------
mpq/inits.c | 18 --------------
mpz/clears.c | 18 --------------
mpz/inits.c | 18 --------------
printf/asprintf.c | 19 ---------------
printf/asprntffuns.c | 7 -----
printf/doprnt.c | 7 +----
printf/doprntf.c | 7 -----
printf/doprnti.c | 7 -----
printf/fprintf.c | 20 ----------------
printf/obprintf.c | 18 --------------
printf/obprntffuns.c | 5 ----
printf/obvprintf.c | 5 ----
printf/printf.c | 18 --------------
printf/printffuns.c | 7 -----
printf/repl-vsnprintf.c | 5 ----
printf/snprintf.c | 21 -----------------
printf/snprntffuns.c | 7 -----
printf/sprintf.c | 20 ----------------
printf/sprintffuns.c | 7 -----
printf/vasprintf.c | 7 -----
printf/vfprintf.c | 7 -----
printf/vprintf.c | 7 -----
printf/vsnprintf.c | 7 -----
printf/vsprintf.c | 7 -----
rand/rand.c | 25 +-------------------
scanf/doscan.c | 7 +----
scanf/fscanf.c | 20 ----------------
scanf/scanf.c | 18 --------------
scanf/sscanf.c | 20 ----------------
scanf/vfscanf.c | 7 -----
scanf/vscanf.c | 6 ----
scanf/vsscanf.c | 6 ----
tests/misc/t-printf.c | 32 --------------------------
tests/misc/t-scanf.c | 19 ---------------
44 files changed, 45 insertions(+), 576 deletions(-)
diffs (truncated from 1361 to 300 lines):
diff -r 8f9c58b1fcf5 -r b2faa9fedbdb ChangeLog
--- a/ChangeLog Sun Jan 19 13:39:26 2014 +0100
+++ b/ChangeLog Sun Jan 19 14:46:09 2014 +0100
@@ -1,6 +1,13 @@
2014-01-19 Torbjorn Granlund <tege at gmplib.org>
- * Use mpq_t in favour of MP_RAT.
+ * doc/gmp.texi: Undocument mpz_array_init.
+
+ * acinclude.m4 (GMP_C_STDARG): Comment out.
+ * configure.ac: Suppress GMP_C_STDARG invocation.
+
+ * Get rid of varargs code and references, many file affected.
+
+ * Use mpq_t in favour of MP_RAT, many mpq files affected.
* Get rid of BYTES_PER_MP_LIMB, most files affected.
diff -r 8f9c58b1fcf5 -r b2faa9fedbdb acinclude.m4
--- a/acinclude.m4 Sun Jan 19 13:39:26 2014 +0100
+++ b/acinclude.m4 Sun Jan 19 14:46:09 2014 +0100
@@ -3470,7 +3470,7 @@
dnl GMP_C_STDARG
dnl ------------
-dnl Test whether to use <stdarg.h> or <varargs.h>.
+dnl Test whether to use <stdarg.h>.
dnl
dnl Notice the AC_DEFINE here is HAVE_STDARG to avoid clashing with
dnl HAVE_STDARG_H which could arise from AC_CHECK_HEADERS.
@@ -3480,26 +3480,26 @@
dnl or very likely by the setups for _PROTO in gmp.h. On the other hand
dnl this test is nice and direct, being what we're going to actually use.
-AC_DEFUN([GMP_C_STDARG],
-[AC_CACHE_CHECK([whether <stdarg.h> exists and works],
- gmp_cv_c_stdarg,
-[AC_TRY_COMPILE(
-[#include <stdarg.h>
-int foo (int x, ...)
-{
- va_list ap;
- int y;
- va_start (ap, x);
- y = va_arg (ap, int);
- va_end (ap);
- return y;
-}],,
-gmp_cv_c_stdarg=yes, gmp_cv_c_stdarg=no)
-])
-if test $gmp_cv_c_stdarg = yes; then
- AC_DEFINE(HAVE_STDARG, 1, [Define to 1 if <stdarg.h> exists and works])
-fi
-])
+dnl AC_DEFUN([GMP_C_STDARG],
+dnl [AC_CACHE_CHECK([whether <stdarg.h> exists and works],
+dnl gmp_cv_c_stdarg,
+dnl [AC_TRY_COMPILE(
+dnl [#include <stdarg.h>
+dnl int foo (int x, ...)
+dnl {
+dnl va_list ap;
+dnl int y;
+dnl va_start (ap, x);
+dnl y = va_arg (ap, int);
+dnl va_end (ap);
+dnl return y;
+dnl }],,
+dnl gmp_cv_c_stdarg=yes, gmp_cv_c_stdarg=no)
+dnl ])
+dnl if test $gmp_cv_c_stdarg = yes; then
+dnl AC_DEFINE(HAVE_STDARG, 1, [Define to 1 if <stdarg.h> exists and works])
+dnl fi
+dnl ])
dnl GMP_FUNC_ALLOCA
@@ -3653,8 +3653,7 @@
dnl terminated result into the buffer.
AC_DEFUN([GMP_FUNC_VSNPRINTF],
-[AC_REQUIRE([GMP_C_STDARG])
-AC_CHECK_FUNC(vsnprintf,
+[AC_CHECK_FUNC(vsnprintf,
[gmp_vsnprintf_exists=yes],
[gmp_vsnprintf_exists=no])
if test "$gmp_vsnprintf_exists" = no; then
@@ -3668,11 +3667,7 @@
#include <string.h> /* for strcmp */
#include <stdio.h> /* for vsnprintf */
-#if HAVE_STDARG
#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
int
#if HAVE_STDARG
diff -r 8f9c58b1fcf5 -r b2faa9fedbdb configure.ac
--- a/configure.ac Sun Jan 19 13:39:26 2014 +0100
+++ b/configure.ac Sun Jan 19 14:46:09 2014 +0100
@@ -2666,7 +2666,7 @@
AC_C_RESTRICT
-GMP_C_STDARG
+# GMP_C_STDARG
GMP_C_ATTRIBUTE_CONST
GMP_C_ATTRIBUTE_MALLOC
GMP_C_ATTRIBUTE_MODE
diff -r 8f9c58b1fcf5 -r b2faa9fedbdb demos/expr/README
--- a/demos/expr/README Sun Jan 19 13:39:26 2014 +0100
+++ b/demos/expr/README Sun Jan 19 14:46:09 2014 +0100
@@ -90,7 +90,7 @@
White space, as indicated by <ctype.h> isspace(), is ignored except for the
purpose of separating tokens.
-Variables can be included in expressions by putting them in the varargs list
+Variables can be included in expressions by putting them in the stdarg list
after the string. "a", "b", "c" etc in the expression string designate
those values. For example,
diff -r 8f9c58b1fcf5 -r b2faa9fedbdb demos/expr/expr-impl.h
--- a/demos/expr/expr-impl.h Sun Jan 19 13:39:26 2014 +0100
+++ b/demos/expr/expr-impl.h Sun Jan 19 14:46:09 2014 +0100
@@ -26,12 +26,8 @@
|| (defined (__mips) && defined (_SYSTYPE_SVR4)) \
|| defined (_MSC_VER) \
|| defined (_WIN32)
-#define HAVE_STDARG 1
+
#include <stdarg.h>
-#else
-#define HAVE_STDARG 0
-#include <varargs.h>
-#endif
#include "expr.h"
diff -r 8f9c58b1fcf5 -r b2faa9fedbdb doc/gmp.texi
--- a/doc/gmp.texi Sun Jan 19 13:39:26 2014 +0100
+++ b/doc/gmp.texi Sun Jan 19 14:46:09 2014 +0100
@@ -1853,10 +1853,10 @@
@end example
@cindex @code{stdarg.h}
-Likewise @code{<stdarg.h>} (or @code{<varargs.h>}) is required for prototypes
-with @code{va_list} parameters, such as @code{gmp_vprintf}. And
- at code{<obstack.h>} for prototypes with @code{struct obstack} parameters, such
-as @code{gmp_obstack_printf}, when available.
+Likewise @code{<stdarg.h>} is required for prototypes with @code{va_list}
+parameters, such as @code{gmp_vprintf}. And @code{<obstack.h>} for prototypes
+with @code{struct obstack} parameters, such as @code{gmp_obstack_printf}, when
+available.
@cindex Libraries
@cindex Linking
@@ -4113,57 +4113,7 @@
applications will not need them.
@deftypefun void mpz_array_init (mpz_t @var{integer_array}, mp_size_t @var{array_size}, @w{mp_size_t @var{fixed_num_bits}})
-This is a special type of initialization. @strong{Fixed} space of
- at var{fixed_num_bits} is allocated to each of the @var{array_size} integers in
- at var{integer_array}. There is no way to free the storage allocated by this
-function. Don't call @code{mpz_clear}!
-
-The @var{integer_array} parameter is the first @code{mpz_t} in the array. For
-example,
-
- at example
-mpz_t arr[20000];
-mpz_array_init (arr[0], 20000, 512);
- at end example
-
- at c In case anyone's wondering, yes this parameter style is a bit anomalous,
- at c it'd probably be nicer if it was "arr" instead of "arr[0]". Obviously the
- at c two differ only in the declaration, not the pointer value, but changing is
- at c not possible since it'd provoke warnings or errors in existing sources.
-
-This function is only intended for programs that create a large number
-of integers and need to reduce memory usage by avoiding the overheads of
-allocating and reallocating lots of small blocks. In normal programs this
-function is not recommended.
-
-The space allocated to each integer by this function will not be automatically
-increased, unlike the normal @code{mpz_init}, so an application must ensure it
-is sufficient for any value stored. The following space requirements apply to
-various routines,
-
- at itemize @bullet
- at item
- at code{mpz_abs}, @code{mpz_neg}, @code{mpz_set}, @code{mpz_set_si} and
- at code{mpz_set_ui} need room for the value they store.
-
- at item
- at code{mpz_add}, @code{mpz_add_ui}, @code{mpz_sub} and @code{mpz_sub_ui} need
-room for the larger of the two operands, plus an extra
- at code{mp_bits_per_limb}.
-
- at item
- at code{mpz_mul}, @code{mpz_mul_ui} and @code{mpz_mul_si} need room for the sum
-of the number of bits in their operands, but each rounded up to a multiple of
- at code{mp_bits_per_limb}.
-
- at item
- at code{mpz_swap} can be used between two array variables, but not between an
-array and a normal variable.
- at end itemize
-
-For other functions, or if in doubt, the suggestion is to calculate in a
-regular @code{mpz_init} variable and copy the result to an array variable with
- at code{mpz_set}.
+ at strong{This is an obsolete function. Do not use it.}
@end deftypefun
@deftypefun {void *} _mpz_realloc (mpz_t @var{integer}, mp_size_t @var{new_alloc})
diff -r 8f9c58b1fcf5 -r b2faa9fedbdb gmp-h.in
--- a/gmp-h.in Sun Jan 19 13:39:26 2014 +0100
+++ b/gmp-h.in Sun Jan 19 14:46:09 2014 +0100
@@ -268,16 +268,14 @@
#define _GMP_H_HAVE_OBSTACK 1
#endif
-/* The prototypes for gmp_vprintf etc are provided only if va_list is
- available, via an application having included <stdarg.h> or <varargs.h>.
- Usually va_list is a typedef so can't be tested directly, but C99
- specifies that va_start is a macro (and it was normally a macro on past
- systems too), so look for that.
+/* The prototypes for gmp_vprintf etc are provided only if va_list is defined,
+ via an application having included <stdarg.h>. Usually va_list is a typedef
+ so can't be tested directly, but C99 specifies that va_start is a macro.
<stdio.h> will define some sort of va_list for vprintf and vfprintf, but
let's not bother trying to use that since it's not standard and since
application uses for gmp_vprintf etc will almost certainly require the
- whole <stdarg.h> or <varargs.h> anyway. */
+ whole <stdarg.h> anyway. */
#ifdef va_start
#define _GMP_H_HAVE_VA_LIST 1
diff -r 8f9c58b1fcf5 -r b2faa9fedbdb mpf/clears.c
--- a/mpf/clears.c Sun Jan 19 13:39:26 2014 +0100
+++ b/mpf/clears.c Sun Jan 19 14:46:09 2014 +0100
@@ -17,35 +17,17 @@
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */
-#include "config.h"
-
-#if HAVE_STDARG
#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
#include <stdio.h> /* for NULL */
#include "gmp.h"
#include "gmp-impl.h"
void
-#if HAVE_STDARG
mpf_clears (mpf_ptr x, ...)
-#else
-mpf_clears (va_alist)
- va_dcl
-#endif
{
va_list ap;
-#if HAVE_STDARG
va_start (ap, x);
-#else
- mpf_ptr x;
- va_start (ap);
- x = va_arg (ap, mpf_ptr);
-#endif
while (x != NULL)
{
diff -r 8f9c58b1fcf5 -r b2faa9fedbdb mpf/inits.c
--- a/mpf/inits.c Sun Jan 19 13:39:26 2014 +0100
+++ b/mpf/inits.c Sun Jan 19 14:46:09 2014 +0100
@@ -17,35 +17,17 @@
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */
-#include "config.h"
-
-#if HAVE_STDARG
#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
#include <stdio.h> /* for NULL */
#include "gmp.h"
#include "gmp-impl.h"
void
More information about the gmp-commit
mailing list