db-move: moved xdg-desktop-portal-gnome from [testing] to [extra] (x86_64)
[arch-packages.git] / libmpc / repos / core-x86_64 / mpc-fix-includes.patch
blob7e41eba576643551b8a1e1fd5fd97738b2bda871
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
5 stdio.h is included
7 ---
8 src/mpc.h | 2 +-
9 1 file changed, 1 insertion(+), 1 deletion(-)
11 diff --git a/src/mpc.h b/src/mpc.h
12 index bb1334f..31c7990 100644
13 --- a/src/mpc.h
14 +++ b/src/mpc.h
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);
20 #endif
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,
24 int64_t exp);
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,
30 unsigned long int e);
31 --
32 2.39.0
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
39 ---
40 src/mpc-impl.h | 2 ++
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
49 --- a/src/mpc-impl.h
50 +++ b/src/mpc-impl.h
51 @@ -27,7 +27,9 @@ along with this program. If not, see http://www.gnu.org/licenses/ .
52 #ifdef HAVE_STDLIB_H
53 #include <stdlib.h>
54 #endif
55 +#ifndef DONT_INCLUDE_STDIO
56 #include <stdio.h>
57 +#endif
58 #include "mpc.h"
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/ .
79 #define __MPC_TESTS_H
81 #include "config.h"
82 +#ifndef DONT_INCLUDE_STDIO
83 #include <stdio.h>
84 +#endif
85 #include <ctype.h>
86 #include <stdlib.h>
87 #include <inttypes.h> /* for the PRIi64 format modifier */
88 diff --git a/tests/tdummy.c b/tests/tdummy.c
89 new file mode 100644
90 index 0000000..23072f5
91 --- /dev/null
92 +++ b/tests/tdummy.c
93 @@ -0,0 +1,33 @@
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
108 +more details.
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"
117 +int
118 +main (void)
120 + test_start ();
122 + test_end ();
124 + return 0;
128 2.39.0
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);
155 +#endif
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
164 /* file functions */
165 typedef struct {
166 char *pathname;
167 @@ -339,6 +342,7 @@ void tpl_read_mpc (mpc_datafile_context_t* datafile_context,
168 mpc_data_t* z);
169 void tpl_read_mpc_rnd (mpc_datafile_context_t* datafile_context,
170 mpc_rnd_t* rnd);
171 +#endif
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);
176 2.39.0
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.
191 NEWS | 4 ++++
192 src/balls.c | 2 ++
193 src/mpc-impl.h | 3 ---
194 src/radius.c | 4 +++-
195 tests/teta.c | 2 +-
196 5 files changed, 10 insertions(+), 5 deletions(-)
198 diff --git a/NEWS b/NEWS
199 index ef6ff8b..c113262 100644
200 --- a/NEWS
201 +++ b/NEWS
202 @@ -1,3 +1,7 @@
203 +Changes in version 1.3.1, released in December 2022:
204 + - Bug fix: It is again possible to include mpc.h without including
205 + stdio.h.
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
212 --- a/src/balls.c
213 +++ b/src/balls.c
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);
224 fprintf (f, "\n");
226 +#endif
229 void
230 diff --git a/src/mpc-impl.h b/src/mpc-impl.h
231 index a915751..3f46121 100644
232 --- a/src/mpc-impl.h
233 +++ b/src/mpc-impl.h
234 @@ -27,9 +27,6 @@ along with this program. If not, see http://www.gnu.org/licenses/ .
235 #ifdef HAVE_STDLIB_H
236 #include <stdlib.h>
237 #endif
238 -#ifndef DONT_INCLUDE_STDIO
239 -#include <stdio.h>
240 -#endif
241 #include "mpc.h"
244 diff --git a/src/radius.c b/src/radius.c
245 index 98ae8d5..88c7d71 100644
246 --- a/src/radius.c
247 +++ b/src/radius.c
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/ .
252 -#include <stdio.h>
253 #include <math.h>
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)
264 if (mpcr_inf_p (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));
269 +#endif
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
275 --- a/tests/teta.c
276 +++ b/tests/teta.c
277 @@ -19,7 +19,7 @@ along with this program. If not, see http://www.gnu.org/licenses/ .
280 #include <math.h>
281 -#include "mpc-impl.h"
282 +#include "mpc-tests.h"
284 static void
285 mpcb_j_err (mpcb_ptr j, mpc_srcptr z, unsigned long int err_re,
287 2.39.0
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
296 mpc.h.
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
310 #include "config.h"
311 -#ifndef DONT_INCLUDE_STDIO
312 #include <stdio.h>
313 -#endif
314 #include <ctype.h>
315 #include <stdlib.h>
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);
329 -#endif
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
338 /* file functions */
339 typedef struct {
340 char *pathname;
341 @@ -342,7 +337,6 @@ void tpl_read_mpc (mpc_datafile_context_t* datafile_context,
342 mpc_data_t* z);
343 void tpl_read_mpc_rnd (mpc_datafile_context_t* datafile_context,
344 mpc_rnd_t* rnd);
345 -#endif
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
351 --- a/tests/tdummy.c
352 +++ b/tests/tdummy.c
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"
359 +#include "mpc.h"
362 main (void)
364 - test_start ();
366 - test_end ();
368 return 0;
372 2.39.0
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.
383 src/balls.c | 1 +
384 src/eta.c | 1 +
385 2 files changed, 2 insertions(+)
387 diff --git a/src/balls.c b/src/balls.c
388 index 03a44a8..a18d37f 100644
389 --- a/src/balls.c
390 +++ b/src/balls.c
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
401 --- a/src/eta.c
402 +++ b/src/eta.c
403 @@ -19,6 +19,7 @@ along with this program. If not, see http://www.gnu.org/licenses/ .
406 #include <math.h>
407 +#include <limits.h> /* for CHAR_BIT */
408 #include "mpc-impl.h"
410 static void
412 2.39.0