From 4fb3704c25726a29b5af658f3137794cdf5cf01c Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 15 Oct 2008 15:29:38 +0200 Subject: expr: remove --bignum and --no-bignum options * doc/coreutils.texi (expr invocation): Remove the --bignum and --no-bignum options. They weren't really needed, and they broke longstanding (albeit nonportable) scripts. * src/expr.c: Don't include . Include "inttostr.h", "long-options.h", "verify.h". Check at compile-time that size_t fits in unsigned long int, as the code assumes this in several places. (HAVE_GMP): Define to 0 if not defined, for convenience. (mpz_t, mpz_clear, mpz_init_set_ui, mpz_init_set_str, mpz_add): (mpz_sub, mpz_mul, mpz_tdiv_q, mpz_tdiv_r, mpz_get_str, mpz_sgn): (mpz_fits_ulong_p, mpz_get_ui, mpz_out_str): Supply substitutes when !HAVE_GMP, which work well enough for expr's purposes. (mp_integer): Remove. All integers are gmp, if gmp is available. (struct valinfo): Remove 'z' member; no longer needed. The 'i' member is always of type mpz_t. (enum arithmetic_mode, MP_NEVER, MP_ALWAYS, MP_AUTO, mode): Remove; no longer needed. (usage): Remove documentation of --bignum and --no-bignum. (integer_overflow): Abort if error misbehaves, to pacify GCC. Restore old message on arithmetic overflow, to be conservative. (die): Omit exit_status parameter; not needed (is always EXPR_FAILURE). (string_too_long, USE_BIGNUM, NO_USE_BIGNUM, long_options): Remove; no longer needed. (main): Don't use getopt_long; this breaks old nonportable scripts. (int_value): Arg is unsigned, in case we have strings whose length exceeds LONG_MAX (!). (int_value, freev, printv, null, tostring, toarith): (eval6, eval4, eval3): Always use mpz_ functions, to simplify the code. (substr_value): Remove; no longer needed. (getsize): Simplify the API: one arg rather than 3. Don't assume unsigned long int fits in size_t. (promote, domult, dodivide, doadd): Remove; no longer needed. * tests/misc/expr: Don't use --bignum to test for bignum support. Instead, use big numbers to test this. --- doc/coreutils.texi | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'doc') diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 183e070bf..64598705d 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -11154,22 +11154,12 @@ may be used for grouping in the usual manner. You must quote parentheses and many operators to avoid the shell evaluating them, however. -By default, @command{expr} performs operations using native arithmetic -types, but if a numeric overflow occurs and @command{expr} was built -with support for the GNU MP library, @command{expr}, it -uses arbitrary-precision arithmetic. +When built with support for the GNU MP library, @command{expr} uses +arbitrary-precision arithmetic; otherwise, it uses native arithmetic +types and may fail due to arithmetic overflow. -Apart from @option{--help} and @option{--version} (@pxref{Common -options}), the following options are supported: - -@table @samp -@item --bignum -Perform arithmetic operations using unlimited precision via the GNU MP library. -@item --no-bignum -Use only limited-precision native operations. -In the event of numeric overflow, @command{expr} fails, -even if GNU MP is available. -@end table +The only options are @option{--help} and @option{--version}. @xref{Common +options}. Options must precede operands. @cindex exit status of @command{expr} Exit status: -- cgit v1.2.3-54-g00ecf