summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2019-01-25 02:00:06 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2019-01-25 02:00:06 +0000
commitf79ac796ca6326648311669eebe001379c315b17 (patch)
tree4859e16d034ec773ead6a20e30c9b23044cb2b20
parenta8157ad1c4de350a86b68f7b02662b2d9ba597d8 (diff)
downloadmpfr-f79ac796ca6326648311669eebe001379c315b17.tar.gz
[configure.ac] By default (i.e. if CFLAGS is not already set), if
the compiler is GCC not in C++ mode, add the -Wc++-compat warning since we expect the code to compile with a C++ compiler. [acinclude.m4,tests/trint.c] Fixed C++ compatibility issues detected thanks to this option used with -Werror. (merged changesets r13406-13408 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/4.0@13409 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--acinclude.m46
-rw-r--r--configure.ac2
-rw-r--r--tests/trint.c8
3 files changed, 9 insertions, 7 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index f17018e54..5cc1df4c6 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -919,11 +919,13 @@ else
/* "before" is 16 bytes to ensure there's no padding between it and "x".
We're not expecting any "long double" bigger than 16 bytes or with
alignment requirements stricter than 16 bytes. */
-struct {
+typedef struct {
char before[16];
long double x;
char after[8];
-} foo = {
+} foo_t;
+
+foo_t foo = {
{ '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
'\001', '\043', '\105', '\147', '\211', '\253', '\315', '\357' },
-123456789.0,
diff --git a/configure.ac b/configure.ac
index 661e0c876..2f8ae8fd3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -447,7 +447,7 @@ error
#endif
]], [[]])],[
AC_MSG_RESULT(no)
- CFLAGS="-Wmissing-prototypes $CFLAGS"
+ CFLAGS="-Wmissing-prototypes -Wc++-compat $CFLAGS"
],[
AC_MSG_RESULT(yes)
CFLAGS="-Wmissing-declarations -Wno-sign-compare $CFLAGS"
diff --git a/tests/trint.c b/tests/trint.c
index fbf599b1c..fd2a45ca2 100644
--- a/tests/trint.c
+++ b/tests/trint.c
@@ -337,12 +337,12 @@ test_fct (double (*f)(double), int (*g)(), char *s, mpfr_rnd_t r)
mpfr_clear (yy);
}
-#define TEST_FCT(F) test_fct (&F, &mpfr_##F, #F, r)
+#define TEST_FCT(F) test_fct (&F, &mpfr_##F, #F, (mpfr_rnd_t) r)
static void
test_against_libc (void)
{
- mpfr_rnd_t r = MPFR_RNDN;
+ int r = MPFR_RNDN;
(void) r; /* avoid a warning by using r */
#if HAVE_ROUND
@@ -359,8 +359,8 @@ test_against_libc (void)
#endif
#if HAVE_NEARBYINT
for (r = 0; r < MPFR_RND_MAX ; r++)
- if (mpfr_set_machine_rnd_mode (r) == 0)
- test_fct (&nearbyint, &mpfr_rint, "rint", r);
+ if (mpfr_set_machine_rnd_mode ((mpfr_rnd_t) r) == 0)
+ test_fct (&nearbyint, &mpfr_rint, "rint", (mpfr_rnd_t) r);
#endif
}