bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/2] libgmp-mpq: Add tests.


From: Bruno Haible
Subject: Re: [PATCH 2/2] libgmp-mpq: Add tests.
Date: Thu, 29 Aug 2024 11:36:11 +0200

Hi Marc,

> +#ifndef MINI_GMP_LIMB_TYPE
> +/* Verify that the gmp.h header file was generated for the same
> +   machine word size as we are using.  */
> +static_assert (GMP_NUMB_BITS == sizeof (mp_limb_t) * CHAR_BIT);
> +#endif
> +
> +int
> +main ()
> +{
> +#ifndef MINI_GMP_LIMB_TYPE
> +  /* Verify that the gmp.h header file and the libgmp library come from
> +     the same GMP version.  */
> +  {
> +    char gmp_header_version[32];
> +    sprintf (gmp_header_version, "%d.%d.%d", __GNU_MP_VERSION,
> +             __GNU_MP_VERSION_MINOR, __GNU_MP_VERSION_PATCHLEVEL);
> +    if (strcmp (gmp_version, gmp_header_version) != 0)
> +      {
> +        char gmp_header_version2[32];
> +        if (__GNU_MP_VERSION_PATCHLEVEL > 0
> +            || (sprintf (gmp_header_version2, "%d.%d", __GNU_MP_VERSION,
> +                         __GNU_MP_VERSION_MINOR),
> +                strcmp (gmp_version, gmp_header_version2) != 0))
> +          {
> +            fprintf (stderr,
> +                     "gmp header version (%s) does not match gmp library 
> version (%s).\n",
> +                     gmp_header_version, gmp_version);
> +            exit (1);
> +          }
> +      }
> +  }
> +#endif

These verifications are already contained in test-libgmp-mpz.c.
Is it imaginable that test-libgmp-mpq.c and test-libgmp-mpz.c use a different
gmp.h? I don't think so.
Is it imaginable that test-libgmp-mpq.c and test-libgmp-mpz.c use a different
libgmp? I don't think so.
So, in test-libgmp-mpq.c these verifications are redundant. How about removing 
them?

Bruno






reply via email to

[Prev in Thread] Current Thread [Next in Thread]