Skip to content

Commit

Permalink
Remove __GMP_PROTO and _PROTO crap from the MPIR source code
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianGladman committed Feb 25, 2018
1 parent 2e8e950 commit c7567b5
Show file tree
Hide file tree
Showing 56 changed files with 1,382 additions and 1,520 deletions.
823 changes: 408 additions & 415 deletions gmp-h.in

Large diffs are not rendered by default.

619 changes: 307 additions & 312 deletions gmp-impl.h

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions longlong_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ MA 02110-1301, USA. */
hppa. */

#define mpn_umul_ppmm __MPN(umul_ppmm)
extern UWtype mpn_umul_ppmm _PROTO ((UWtype *, UWtype, UWtype));
extern UWtype mpn_umul_ppmm(UWtype *, UWtype, UWtype);

#if ! defined (umul_ppmm) && HAVE_NATIVE_mpn_umul_ppmm \
&& ! defined (LONGLONG_STANDALONE)
Expand All @@ -53,7 +53,7 @@ extern UWtype mpn_umul_ppmm _PROTO ((UWtype *, UWtype, UWtype));
#endif

#define mpn_umul_ppmm_r __MPN(umul_ppmm_r)
extern UWtype mpn_umul_ppmm_r _PROTO ((UWtype, UWtype, UWtype *));
extern UWtype mpn_umul_ppmm_r(UWtype, UWtype, UWtype *);

#if ! defined (umul_ppmm) && HAVE_NATIVE_mpn_umul_ppmm_r \
&& ! defined (LONGLONG_STANDALONE)
Expand All @@ -66,7 +66,7 @@ extern UWtype mpn_umul_ppmm_r _PROTO ((UWtype, UWtype, UWtype *));
#endif

#define mpn_udiv_qrnnd __MPN(udiv_qrnnd)
extern UWtype mpn_udiv_qrnnd _PROTO ((UWtype *, UWtype, UWtype, UWtype));
extern UWtype mpn_udiv_qrnnd(UWtype *, UWtype, UWtype, UWtype);

#if ! defined (udiv_qrnnd) && HAVE_NATIVE_mpn_udiv_qrnnd \
&& ! defined (LONGLONG_STANDALONE)
Expand All @@ -80,7 +80,7 @@ extern UWtype mpn_udiv_qrnnd _PROTO ((UWtype *, UWtype, UWtype, UWtype));
#endif

#define mpn_udiv_qrnnd_r __MPN(udiv_qrnnd_r)
extern UWtype mpn_udiv_qrnnd_r _PROTO ((UWtype, UWtype, UWtype, UWtype *));
extern UWtype mpn_udiv_qrnnd_r(UWtype, UWtype, UWtype, UWtype *);

#if ! defined (udiv_qrnnd) && HAVE_NATIVE_mpn_udiv_qrnnd_r \
&& ! defined (LONGLONG_STANDALONE)
Expand Down
8 changes: 0 additions & 8 deletions longlong_pre.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,6 @@ MA 02110-1301, USA. */
#define __MPN(x) __##x
#endif

#ifndef _PROTO
#if (__STDC__-0) || defined (__cplusplus) || defined( _MSC_VER )
#define _PROTO(x) x
#else
#define _PROTO(x) ()
#endif
#endif

/* Define auxiliary asm macros.
1) umul_ppmm(high_prod, low_prod, multipler, multiplicand) multiplies two
Expand Down
7 changes: 3 additions & 4 deletions memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ MA 02110-1301, USA. */
#include "gmp-impl.h"


void * (*__gmp_allocate_func) _PROTO ((size_t)) = __gmp_default_allocate;
void * (*__gmp_reallocate_func) _PROTO ((void *, size_t, size_t))
= __gmp_default_reallocate;
void (*__gmp_free_func) _PROTO ((void *, size_t)) = __gmp_default_free;
void * (*__gmp_allocate_func)(size_t) = __gmp_default_allocate;
void * (*__gmp_reallocate_func)(void *, size_t, size_t) = __gmp_default_reallocate;
void (*__gmp_free_func)(void *, size_t) = __gmp_default_free;


/* Default allocation functions. In case of failure to allocate/reallocate
Expand Down
2 changes: 1 addition & 1 deletion mpf/ceilfloor.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ MA 02110-1301, USA. */
Notice the use of prec+1 ensures mpf_ceil and mpf_floor are equivalent to
mpf_set if u is already an integer. */

static void __gmpf_ceil_or_floor _PROTO ((REGPARM_2_1 (mpf_ptr r, mpf_srcptr u, int dir))) REGPARM_ATTR (1);
static void __gmpf_ceil_or_floor(REGPARM_2_1 (mpf_ptr r, mpf_srcptr u, int dir)) REGPARM_ATTR (1);
#define mpf_ceil_or_floor(r,u,dir) __gmpf_ceil_or_floor (REGPARM_2_1 (r, u, dir))

REGPARM_ATTR (1) static void
Expand Down
4 changes: 2 additions & 2 deletions mpn/alpha/longlong_inc.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ MA 02110-1301, USA. */

#if ! defined (count_leading_zeros) && ! defined (LONGLONG_STANDALONE)
#if HAVE_ATTRIBUTE_CONST
long __MPN(count_leading_zeros) _PROTO ((UDItype)) __attribute__ ((const));
long __MPN(count_leading_zeros)(UDItype) __attribute__ ((const));
#else
long __MPN(count_leading_zeros) _PROTO ((UDItype));
long __MPN(count_leading_zeros)(UDItype);
#endif
#define count_leading_zeros(count, x) \
((count) = __MPN(count_leading_zeros) (x))
Expand Down
2 changes: 1 addition & 1 deletion mpn/arm/longlong_inc.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ MA 02110-1301, USA. */
(q) = __MPN(udiv_qrnnd) (&__r, (n1), (n0), (d)); \
(r) = __r; \
} while (0)
extern UWtype __MPN(udiv_qrnnd) _PROTO ((UWtype *, UWtype, UWtype, UWtype));
extern UWtype __MPN(udiv_qrnnd)(UWtype *, UWtype, UWtype, UWtype);
#endif /* LONGLONG_STANDALONE */
#endif

Expand Down
2 changes: 1 addition & 1 deletion mpn/generic/random2.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
#include "mpir.h"
#include "gmp-impl.h"

static void gmp_rrandomb __GMP_PROTO((mp_ptr, gmp_randstate_t, mp_bitcnt_t));
static void gmp_rrandomb(mp_ptr, gmp_randstate_t, mp_bitcnt_t);

/* Ask _gmp_rand for 32 bits per call unless that's more than a limb can hold.
Thus, we get the same random number sequence in the common cases.
Expand Down
2 changes: 1 addition & 1 deletion mpn/generic/rrandom.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Boston, MA 02110-1301, USA.
#include "mpir.h"
#include "gmp-impl.h"

static void gmp_rrandomb _PROTO ((mp_ptr rp, gmp_randstate_t rstate, mpir_ui nbits));
static void gmp_rrandomb(mp_ptr rp, gmp_randstate_t rstate, mpir_ui nbits);

/* Ask _gmp_rand for 32 bits per call unless that's more than a limb can hold.
Thus, we get the same random number sequence in the common cases.
Expand Down
2 changes: 1 addition & 1 deletion mpn/sparc32/longlong_inc.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ MA 02110-1301, USA. */
(q) = __MPN(udiv_qrnnd) (&__r, (n1), (n0), (d)); \
(r) = __r; \
} while (0)
extern UWtype __MPN(udiv_qrnnd) _PROTO ((UWtype *, UWtype, UWtype, UWtype));
extern UWtype __MPN(udiv_qrnnd)(UWtype *, UWtype, UWtype, UWtype);
#endif /* LONGLONG_STANDALONE */
#endif /* udiv_qrnnd */

Expand Down
2 changes: 1 addition & 1 deletion mpn/x86/fat/fat.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ MA 02110-1301, USA. */
#define TRACE(x)

/* fat_entry.asm */
long __gmpn_cpuid __GMP_PROTO ((char dst[12], int id));
long __gmpn_cpuid(char dst[12], int id);

struct cpuvec_t __gmpn_cpuvec = {
__MPN(add_err1_n_init),
Expand Down
2 changes: 1 addition & 1 deletion mpn/x86_64/fat/fat.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ MA 02110-1301, USA. */
#define TRACE(x)

/* fat_entry.asm */
long __gmpn_cpuid __GMP_PROTO ((char dst[12], int id));
long __gmpn_cpuid(char dst[12], int id);

struct cpuvec_t __gmpn_cpuvec = {
__MPN(add_err1_n_init),
Expand Down
2 changes: 1 addition & 1 deletion mpn/x86_64w/fat/fat.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ MA 02110-1301, USA. */
#define TRACE(x)

/* fat_entry.asm */
long __gmpn_cpuid __GMP_PROTO ((char dst[12], int id));
long __gmpn_cpuid(char dst[12], int id);

struct cpuvec_t __gmpn_cpuvec = {
__MPN(add_err1_n_init),
Expand Down
4 changes: 2 additions & 2 deletions mpq/aors.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ MA 02110-1301, USA. */
#include "gmp-impl.h"


static void __gmpq_aors _PROTO ((REGPARM_3_1 (mpq_ptr w, mpq_srcptr x, mpq_srcptr y, void (*fun) _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr))))) REGPARM_ATTR (1);
static void __gmpq_aors(REGPARM_3_1 (mpq_ptr w, mpq_srcptr x, mpq_srcptr y, void (*fun)(mpz_ptr, mpz_srcptr, mpz_srcptr))) REGPARM_ATTR (1);
#define mpq_aors(w,x,y,fun) __gmpq_aors (REGPARM_3_1 (w, x, y, fun))

REGPARM_ATTR (1) static void
mpq_aors (mpq_ptr rop, mpq_srcptr op1, mpq_srcptr op2,
void (*fun) _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)))
void (*fun)(mpz_ptr, mpz_srcptr, mpz_srcptr))
{
mpz_t gcd;
mpz_t tmp1, tmp2;
Expand Down
2 changes: 1 addition & 1 deletion mpz/aorsmul.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ MA 02110-1301, USA. */
The sign of w is retained for the result, unless the absolute value
submul underflows, in which case it flips. */

static void __gmpz_aorsmul _PROTO ((REGPARM_3_1 (mpz_ptr w, mpz_srcptr x, mpz_srcptr y, mp_size_t sub))) REGPARM_ATTR (1);
static void __gmpz_aorsmul(REGPARM_3_1 (mpz_ptr w, mpz_srcptr x, mpz_srcptr y, mp_size_t sub)) REGPARM_ATTR (1);
#define mpz_aorsmul(w,x,y,sub) __gmpz_aorsmul (REGPARM_3_1 (w, x, y, sub))

REGPARM_ATTR (1) static void
Expand Down
2 changes: 1 addition & 1 deletion mpz/cfdiv_q_2exp.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ MA 02110-1301, USA. */

/* dir==1 for ceil, dir==-1 for floor */

static void __gmpz_cfdiv_q_2exp _PROTO ((REGPARM_3_1 (mpz_ptr w, mpz_srcptr u, mp_bitcnt_t cnt, int dir))) REGPARM_ATTR (1);
static void __gmpz_cfdiv_q_2exp(REGPARM_3_1 (mpz_ptr w, mpz_srcptr u, mp_bitcnt_t cnt, int dir)) REGPARM_ATTR (1);
#define cfdiv_q_2exp(w,u,cnt,dir) __gmpz_cfdiv_q_2exp (REGPARM_3_1 (w,u,cnt,dir))

REGPARM_ATTR (1) static void
Expand Down
2 changes: 1 addition & 1 deletion mpz/cfdiv_r_2exp.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ MA 02110-1301, USA. */

/* dir==1 for ceil, dir==-1 for floor */

static void __gmpz_cfdiv_r_2exp _PROTO ((REGPARM_3_1 (mpz_ptr w, mpz_srcptr u, mp_bitcnt_t cnt, int dir))) REGPARM_ATTR (1);
static void __gmpz_cfdiv_r_2exp(REGPARM_3_1 (mpz_ptr w, mpz_srcptr u, mp_bitcnt_t cnt, int dir)) REGPARM_ATTR (1);
#define cfdiv_r_2exp(w,u,cnt,dir) __gmpz_cfdiv_r_2exp (REGPARM_3_1 (w, u, cnt, dir))

REGPARM_ATTR (1) static void
Expand Down
4 changes: 2 additions & 2 deletions mpz/perfpow.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ MA 02110-1301, USA. */
#include "gmp-impl.h"
#include "longlong.h"

static mpir_ui gcd _PROTO ((mpir_ui a, mpir_ui b));
static int isprime _PROTO ((mpir_ui t));
static mpir_ui gcd(mpir_ui a, mpir_ui b);
static int isprime(mpir_ui t);

static const unsigned short primes[] =
{ 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53,
Expand Down
2 changes: 1 addition & 1 deletion mpz/pprime_p.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ MA 02110-1301, USA. */
#include "gmp-impl.h"
#include "longlong.h"

static int isprime _PROTO ((mpir_ui t));
static int isprime(mpir_ui t);


/* MPN_MOD_OR_MODEXACT_1_ODD can be used instead of mpn_mod_1 for the trial
Expand Down
2 changes: 1 addition & 1 deletion mpz/rrandomb.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
#include "mpir.h"
#include "gmp-impl.h"

static void gmp_rrandomb _PROTO ((mp_ptr rp, gmp_randstate_t rstate, mp_bitcnt_t nbits));
static void gmp_rrandomb(mp_ptr rp, gmp_randstate_t rstate, mp_bitcnt_t nbits);

void
mpz_rrandomb (mpz_ptr x, gmp_randstate_t rstate, mp_bitcnt_t nbits)
Expand Down
2 changes: 1 addition & 1 deletion msvc/output_params.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(set ldir=lib_mpir_gc\)
(set ldir=lib_mpir_skylake_avx\)
(set libr=lib)
(set plat=x64)
(set conf=Release)
2 changes: 1 addition & 1 deletion printf/printffuns.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ MA 02110-1301, USA. */

/* SunOS 4 stdio.h doesn't provide a prototype for this */
#if ! HAVE_DECL_VFPRINTF
int vfprintf _PROTO ((FILE *fp, const char *fmt, va_list ap));
int vfprintf(FILE *fp, const char *fmt, va_list ap);
#endif


Expand Down
2 changes: 1 addition & 1 deletion randlc2x.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ randclear_lc (gmp_randstate_t rstate)
(*__gmp_free_func) (p, sizeof (gmp_rand_lc_struct));
}

static void randiset_lc __GMP_PROTO ((gmp_randstate_ptr dst, gmp_randstate_srcptr src));
static void randiset_lc(gmp_randstate_ptr dst, gmp_randstate_srcptr src);

static const gmp_randfnptr_t Linear_Congruential_Generator = {
randseed_lc,
Expand Down
2 changes: 1 addition & 1 deletion randmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ __gmp_randclear_mt (gmp_randstate_t rstate)
sizeof (gmp_rand_mt_struct));
}

void __gmp_randiset_mt __GMP_PROTO ((gmp_randstate_ptr dst, gmp_randstate_srcptr src));
void __gmp_randiset_mt(gmp_randstate_ptr dst, gmp_randstate_srcptr src);

static const gmp_randfnptr_t Mersenne_Twister_Generator_Noseed = {
NULL,
Expand Down
8 changes: 4 additions & 4 deletions randmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ typedef struct
} gmp_rand_mt_struct;


void __gmp_mt_recalc_buffer __GMP_PROTO ((gmp_uint_least32_t *));
void __gmp_randget_mt __GMP_PROTO ((gmp_randstate_t, mp_ptr, mpir_ui));
void __gmp_randclear_mt __GMP_PROTO ((gmp_randstate_t rstate));
void __gmp_randiset_mt __GMP_PROTO ((gmp_randstate_ptr, gmp_randstate_srcptr));
void __gmp_mt_recalc_buffer(gmp_uint_least32_t *);
void __gmp_randget_mt(gmp_randstate_t, mp_ptr, mpir_ui);
void __gmp_randclear_mt(gmp_randstate_t rstate);
void __gmp_randiset_mt(gmp_randstate_ptr, gmp_randstate_srcptr);
6 changes: 3 additions & 3 deletions scanf/fscanffuns.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ MA 02110-1301, USA. */

/* SunOS 4 stdio.h doesn't provide prototypes for these */
#if ! HAVE_DECL_FGETC
int fgetc _PROTO ((FILE *fp));
int fgetc(FILE *fp);
#endif
#if ! HAVE_DECL_FSCANF
int fscanf _PROTO ((FILE *fp, const char *fmt, ...));
int fscanf(FILE *fp, const char *fmt, ...);
#endif
#if ! HAVE_DECL_UNGETC
int ungetc _PROTO ((int c, FILE *fp));
int ungetc(int c, FILE *fp);
#endif


Expand Down
6 changes: 3 additions & 3 deletions tests/devel/try.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,15 +287,15 @@ struct each_t fun = { "Fun" };

#define SRC_SIZE(n) ((n) == 1 && tr->size2 ? size2 : size)

void validate_fail _PROTO ((void));
void validate_fail(void);


#if HAVE_TRY_NEW_C
#include "try-new.c"
#endif


typedef mp_limb_t (*tryfun_t) _PROTO ((ANYARGS));
typedef mp_limb_t (*tryfun_t)(ANYARGS);

struct try_t {
char retval;
Expand Down Expand Up @@ -373,7 +373,7 @@ struct try_t {
tryfun_t reference;
const char *reference_name;

void (*validate) _PROTO ((void));
void (*validate)(void);
const char *validate_name;
};

Expand Down
4 changes: 2 additions & 2 deletions tests/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ tests_rand_end (void)


/* Only used if CPU calling conventions checking is available. */
mp_limb_t (*calling_conventions_function) _PROTO ((ANYARGS));
mp_limb_t (*calling_conventions_function)(ANYARGS);


/* Return p advanced to the next multiple of "align" bytes. "align" must be
Expand Down Expand Up @@ -396,7 +396,7 @@ urandom (gmp_randstate_t rands)

/* Call (*func)() with various random number generators. */
void
call_rand_algs (void (*func) __GMP_PROTO ((const char *, gmp_randstate_ptr)))
call_rand_algs (void (*func)(const char *, gmp_randstate_ptr))
{
gmp_randstate_t rstate;
mpz_t a;
Expand Down
2 changes: 1 addition & 1 deletion tests/misc/t-scanf.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ MA 02110-1301, USA. */

int option_libc_scanf = 0;

typedef int (*fun_t) _PROTO ((const char *, const char *, void *, void *));
typedef int (*fun_t)(const char *, const char *, void *, void *);


/* This problem was seen on powerpc7450-apple-darwin7.0.0, sscanf returns 0
Expand Down
14 changes: 7 additions & 7 deletions tests/mpf/reuse.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ main (void)
#define EXPO 32
#endif

void dump_abort _PROTO ((char *name, mpf_t res1, mpf_t res2));
void dump_abort(char *name, mpf_t res1, mpf_t res2);

typedef void (*dss_func) _PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr));
typedef void (*dss_func)(mpf_ptr, mpf_srcptr, mpf_srcptr);

dss_func dss_funcs[] =
{
Expand All @@ -66,7 +66,7 @@ char *dss_func_names[] =
"mpf_div", "mpf_add", "mpf_mul", "mpf_sub",
};

typedef void (*dsi_func) _PROTO ((mpf_ptr, mpf_srcptr, mpir_ui));
typedef void (*dsi_func)(mpf_ptr, mpf_srcptr, mpir_ui);

dsi_func dsi_funcs[] =
{
Expand All @@ -80,7 +80,7 @@ char *dsi_func_names[] =
"mpf_mul_2exp", "mpf_div_2exp"
};

typedef void (*dis_func) _PROTO ((mpf_ptr, mpir_ui, mpf_srcptr));
typedef void (*dis_func)(mpf_ptr, mpir_ui, mpf_srcptr);

dis_func dis_funcs[] =
{
Expand Down Expand Up @@ -206,9 +206,9 @@ dump_abort (char *name, mpf_t res1, mpf_t res2)
}

#if 0
void mpf_abs _PROTO ((mpf_ptr, mpf_srcptr));
void mpf_sqrt _PROTO ((mpf_ptr, mpf_srcptr));
void mpf_neg _PROTO ((mpf_ptr, mpf_srcptr));
void mpf_abs (mpf_ptr, mpf_srcptr);
void mpf_sqrt (mpf_ptr, mpf_srcptr);
void mpf_neg (mpf_ptr, mpf_srcptr);
#endif

#endif /* ! DLL_EXPORT */
5 changes: 2 additions & 3 deletions tests/mpn/t-aors_1.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@ MA 02110-1301, USA.
got, data[i].want, data[i].size); \
} while (0)

typedef mp_limb_t (*mpn_aors_1_t)
_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
mpn_aors_1_t fudge _PROTO ((mpn_aors_1_t));
typedef mp_limb_t (*mpn_aors_1_t)(mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
mpn_aors_1_t fudge(mpn_aors_1_t);


void
Expand Down
Loading

0 comments on commit c7567b5

Please sign in to comment.