1 From e944aa454e60cbff8ab4e8c70dd974083398378f Mon Sep 17 00:00:00 2001
2 From: Paul Zimmermann <Paul.Zimmermann@inria.fr>
3 Date: Sat, 10 Dec 2022 08:47:51 +0100
4 Subject: [PATCH 1/6] functions with FILE arguments should be defined only when
9 1 file changed, 1 insertion(+), 1 deletion(-)
11 diff --git a/src/mpc.h b/src/mpc.h
12 index bb1334f..31c7990 100644
15 @@ -270,6 +270,7 @@ __MPC_DECLSPEC long double _Complex mpc_get_ldc (mpc_srcptr, mpc_rnd_t);
16 __MPC_DECLSPEC int mpc_inp_str (mpc_ptr, FILE *, size_t *, int, mpc_rnd_t);
17 __MPC_DECLSPEC size_t mpc_out_str (FILE *, int, size_t, mpc_srcptr, mpc_rnd_t);
18 __MPC_DECLSPEC void mpcb_out_str (FILE *f, mpcb_srcptr);
19 +__MPC_DECLSPEC void mpcr_out_str (FILE *f, mpcr_srcptr r);
22 __MPC_DECLSPEC int mpcr_inf_p (mpcr_srcptr r);
23 @@ -284,7 +285,6 @@ __MPC_DECLSPEC void mpcr_set_ui64_2si64 (mpcr_ptr r, uint64_t mant,
25 __MPC_DECLSPEC void mpcr_max (mpcr_ptr r, mpcr_srcptr s, mpcr_srcptr t);
26 __MPC_DECLSPEC int64_t mpcr_get_exp (mpcr_srcptr r);
27 -__MPC_DECLSPEC void mpcr_out_str (FILE *f, mpcr_srcptr r);
28 __MPC_DECLSPEC void mpcr_mul (mpcr_ptr r, mpcr_srcptr s, mpcr_srcptr t);
29 __MPC_DECLSPEC void mpcr_mul_2ui (mpcr_ptr r, mpcr_srcptr s,
34 From c4ecee561ca9f93ee13e4d6295af8adc77e50208 Mon Sep 17 00:00:00 2001
35 From: Paul Zimmermann <Paul.Zimmermann@inria.fr>
36 Date: Mon, 12 Dec 2022 10:42:12 +0100
37 Subject: [PATCH 2/6] added test for case when stdio.h is not included
41 tests/Makefile.am | 2 +-
42 tests/mpc-tests.h | 2 ++
43 tests/tdummy.c | 33 +++++++++++++++++++++++++++++++++
44 4 files changed, 38 insertions(+), 1 deletion(-)
45 create mode 100644 tests/tdummy.c
47 diff --git a/src/mpc-impl.h b/src/mpc-impl.h
48 index 2b7bbb2..a915751 100644
51 @@ -27,7 +27,9 @@ along with this program. If not, see http://www.gnu.org/licenses/ .
55 +#ifndef DONT_INCLUDE_STDIO
61 diff --git a/tests/Makefile.am b/tests/Makefile.am
62 index f488bdb..2fe0813 100644
63 --- a/tests/Makefile.am
64 +++ b/tests/Makefile.am
65 @@ -45,7 +45,7 @@ check_PROGRAMS = tradius tballs teta \
66 treimref trootofunity \
67 tset tsin tsin_cos tsinh tsqr tsqrt tstrtoc tsub tsub_fr \
68 tsub_ui tsum tswap ttan ttanh tui_div tui_ui_sub \
69 - tget_version texceptions
70 + tget_version texceptions tdummy
72 check_LTLIBRARIES=libmpc-tests.la
73 libmpc_tests_la_SOURCES = mpc-tests.h check_data.c clear_parameters.c \
74 diff --git a/tests/mpc-tests.h b/tests/mpc-tests.h
75 index ecd10b7..57ac632 100644
76 --- a/tests/mpc-tests.h
77 +++ b/tests/mpc-tests.h
78 @@ -22,7 +22,9 @@ along with this program. If not, see http://www.gnu.org/licenses/ .
82 +#ifndef DONT_INCLUDE_STDIO
87 #include <inttypes.h> /* for the PRIi64 format modifier */
88 diff --git a/tests/tdummy.c b/tests/tdummy.c
90 index 0000000..23072f5
94 +/* tdummy -- test file when stdio.h is not included
96 +Copyright (C) 2022 INRIA
98 +This file is part of GNU MPC.
100 +GNU MPC is free software; you can redistribute it and/or modify it under
101 +the terms of the GNU Lesser General Public License as published by the
102 +Free Software Foundation; either version 3 of the License, or (at your
103 +option) any later version.
105 +GNU MPC is distributed in the hope that it will be useful, but WITHOUT ANY
106 +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
107 +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
110 +You should have received a copy of the GNU Lesser General Public License
111 +along with this program. If not, see http://www.gnu.org/licenses/ .
114 +#define DONT_INCLUDE_STDIO
115 +#include "mpc-tests.h"
130 From 3c582150facc14230a157e927d07ff2398ab5f3e Mon Sep 17 00:00:00 2001
131 From: Paul Zimmermann <Paul.Zimmermann@inria.fr>
132 Date: Mon, 12 Dec 2022 10:55:05 +0100
133 Subject: [PATCH 3/6] fixed last commit
136 tests/mpc-tests.h | 4 ++++
137 1 file changed, 4 insertions(+)
139 diff --git a/tests/mpc-tests.h b/tests/mpc-tests.h
140 index 57ac632..c6b5679 100644
141 --- a/tests/mpc-tests.h
142 +++ b/tests/mpc-tests.h
143 @@ -141,6 +141,7 @@ extern int same_mpc_value (mpc_ptr got, mpc_ptr ref,
144 known_signs_t known_signs);
146 /** READ FILE WITH TEST DATA SET **/
147 +#ifndef DONT_INCLUDE_STDIO
148 extern FILE * open_data_file (const char *file_name);
149 extern void close_data_file (FILE *fp);
151 @@ -155,6 +156,7 @@ extern size_t read_string (FILE *fp, char **buffer_ptr,
152 size_t buffer_length, const char *name);
153 extern void read_mpfr (FILE *fp, mpfr_ptr x, int *known_sign);
154 extern void read_mpc (FILE *fp, mpc_ptr z, known_signs_t *ks);
157 void set_mpfr_flags (int counter);
158 void check_mpfr_flags (int counter);
159 @@ -287,6 +289,7 @@ typedef struct {
160 void read_description (mpc_fun_param_t* param, const char *file);
161 const char* read_description_findname (mpc_param_t e);
163 +#ifndef DONT_INCLUDE_STDIO
167 @@ -339,6 +342,7 @@ void tpl_read_mpc (mpc_datafile_context_t* datafile_context,
169 void tpl_read_mpc_rnd (mpc_datafile_context_t* datafile_context,
173 int tpl_same_mpz_value (mpz_ptr n1, mpz_ptr n2);
174 int tpl_same_mpfr_value (mpfr_ptr x1, mpfr_ptr x2, int known_sign);
178 From 8cd19d81f3e2aebbd58d8204da8ada50e8e8dfc1 Mon Sep 17 00:00:00 2001
179 From: Andreas Enge <andreas.enge@inria.fr>
180 Date: Mon, 12 Dec 2022 11:23:40 +0100
181 Subject: [PATCH 4/6] Do not explicitly include stdio.h in mpc-impl.h.
183 Several files include it on their own for MPC_ASSERT.
185 * src/mpc-impl.h, src/radius.c: Do not include stdio.h.
186 * tests/teta.c: Include mpc-tests.h instead of mpc-impl.h.
187 * src/balls.c (mpcb_out_str, mpcr_out_str): Define only when
188 _GMP_H_HAVE_FILE is defined, in accordance with mpc.h.
189 * NEWS: Add entry for bug fix.
193 src/mpc-impl.h | 3 ---
194 src/radius.c | 4 +++-
196 5 files changed, 10 insertions(+), 5 deletions(-)
198 diff --git a/NEWS b/NEWS
199 index ef6ff8b..c113262 100644
203 +Changes in version 1.3.1, released in December 2022:
204 + - Bug fix: It is again possible to include mpc.h without including
207 Changes in version 1.3.0 ("Ipomoea batatas"), released in December 2022:
208 - New function: mpc_agm
209 - New rounding modes "away from zero", indicated by the letter "A" and
210 diff --git a/src/balls.c b/src/balls.c
211 index ecaecd5..03a44a8 100644
214 @@ -21,6 +21,7 @@ along with this program. If not, see http://www.gnu.org/licenses/ .
215 #include "mpc-impl.h"
218 +#ifdef _GMP_H_HAVE_FILE
219 void mpcb_out_str (FILE *f, mpcb_srcptr op)
221 mpc_out_str (f, 10, 0, op->c, MPC_RNDNN);
222 @@ -28,6 +29,7 @@ void mpcb_out_str (FILE *f, mpcb_srcptr op)
223 mpcr_out_str (f, op->r);
230 diff --git a/src/mpc-impl.h b/src/mpc-impl.h
231 index a915751..3f46121 100644
234 @@ -27,9 +27,6 @@ along with this program. If not, see http://www.gnu.org/licenses/ .
238 -#ifndef DONT_INCLUDE_STDIO
244 diff --git a/src/radius.c b/src/radius.c
245 index 98ae8d5..88c7d71 100644
248 @@ -18,7 +18,6 @@ You should have received a copy of the GNU Lesser General Public License
249 along with this program. If not, see http://www.gnu.org/licenses/ .
254 #include <inttypes.h> /* for the PRIi64 format modifier */
255 #include "mpc-impl.h"
256 @@ -405,6 +404,8 @@ int64_t mpcr_get_exp (mpcr_srcptr r)
257 return MPCR_EXP (r) + 31;
261 +#ifdef _GMP_H_HAVE_FILE
262 void mpcr_out_str (FILE *f, mpcr_srcptr r)
265 @@ -415,6 +416,7 @@ void mpcr_out_str (FILE *f, mpcr_srcptr r)
266 fprintf (f, "±(%" PRIi64 ", %" PRIi64 ")", MPCR_MANT (r), MPCR_EXP (r));
272 static void mpcr_mul_rnd (mpcr_ptr r, mpcr_srcptr s, mpcr_srcptr t,
273 diff --git a/tests/teta.c b/tests/teta.c
274 index 1154d66..a8bb317 100644
277 @@ -19,7 +19,7 @@ along with this program. If not, see http://www.gnu.org/licenses/ .
281 -#include "mpc-impl.h"
282 +#include "mpc-tests.h"
285 mpcb_j_err (mpcb_ptr j, mpc_srcptr z, unsigned long int err_re,
289 From 2bf963605442b2693c7adc06f37957984e0ced56 Mon Sep 17 00:00:00 2001
290 From: Andreas Enge <andreas.enge@inria.fr>
291 Date: Mon, 12 Dec 2022 11:46:31 +0100
292 Subject: [PATCH 5/6] Simplify tdummy test.
294 * tests/tdummy.c: Include mpc.h without stdio.h; the test always succeeds
295 at run time, but may fail during compilation if there is an error in
297 * tests/mpc-tests.h: Drop DONT_INCLUDE_STDIO macro.
299 tests/mpc-tests.h | 6 ------
300 tests/tdummy.c | 7 +------
301 2 files changed, 1 insertion(+), 12 deletions(-)
303 diff --git a/tests/mpc-tests.h b/tests/mpc-tests.h
304 index c6b5679..ecd10b7 100644
305 --- a/tests/mpc-tests.h
306 +++ b/tests/mpc-tests.h
307 @@ -22,9 +22,7 @@ along with this program. If not, see http://www.gnu.org/licenses/ .
308 #define __MPC_TESTS_H
311 -#ifndef DONT_INCLUDE_STDIO
316 #include <inttypes.h> /* for the PRIi64 format modifier */
317 @@ -141,7 +139,6 @@ extern int same_mpc_value (mpc_ptr got, mpc_ptr ref,
318 known_signs_t known_signs);
320 /** READ FILE WITH TEST DATA SET **/
321 -#ifndef DONT_INCLUDE_STDIO
322 extern FILE * open_data_file (const char *file_name);
323 extern void close_data_file (FILE *fp);
325 @@ -156,7 +153,6 @@ extern size_t read_string (FILE *fp, char **buffer_ptr,
326 size_t buffer_length, const char *name);
327 extern void read_mpfr (FILE *fp, mpfr_ptr x, int *known_sign);
328 extern void read_mpc (FILE *fp, mpc_ptr z, known_signs_t *ks);
331 void set_mpfr_flags (int counter);
332 void check_mpfr_flags (int counter);
333 @@ -289,7 +285,6 @@ typedef struct {
334 void read_description (mpc_fun_param_t* param, const char *file);
335 const char* read_description_findname (mpc_param_t e);
337 -#ifndef DONT_INCLUDE_STDIO
341 @@ -342,7 +337,6 @@ void tpl_read_mpc (mpc_datafile_context_t* datafile_context,
343 void tpl_read_mpc_rnd (mpc_datafile_context_t* datafile_context,
347 int tpl_same_mpz_value (mpz_ptr n1, mpz_ptr n2);
348 int tpl_same_mpfr_value (mpfr_ptr x1, mpfr_ptr x2, int known_sign);
349 diff --git a/tests/tdummy.c b/tests/tdummy.c
350 index 23072f5..e525609 100644
353 @@ -18,16 +18,11 @@ You should have received a copy of the GNU Lesser General Public License
354 along with this program. If not, see http://www.gnu.org/licenses/ .
357 -#define DONT_INCLUDE_STDIO
358 -#include "mpc-tests.h"
374 From 8fe31f02431b3680f09bf1346787276ddb2274a2 Mon Sep 17 00:00:00 2001
375 From: Andreas Enge <andreas.enge@inria.fr>
376 Date: Mon, 12 Dec 2022 15:30:57 +0100
377 Subject: [PATCH 6/6] Include header file.
379 This was detected by trying to compile with gmp-5.0.0 and mpfr-4.1.0.
381 * src/balls.c, src/eta.c: Include limits.h.
385 2 files changed, 2 insertions(+)
387 diff --git a/src/balls.c b/src/balls.c
388 index 03a44a8..a18d37f 100644
391 @@ -18,6 +18,7 @@ You should have received a copy of the GNU Lesser General Public License
392 along with this program. If not, see http://www.gnu.org/licenses/ .
395 +#include <limits.h> /* for CHAR_BIT */
396 #include "mpc-impl.h"
399 diff --git a/src/eta.c b/src/eta.c
400 index 7d397f0..0651e15 100644
403 @@ -19,6 +19,7 @@ along with this program. If not, see http://www.gnu.org/licenses/ .
407 +#include <limits.h> /* for CHAR_BIT */
408 #include "mpc-impl.h"