[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Fix compilation errors in test-math-c++.cc on FreeBSD 12.2/arm64
From: |
Bruno Haible |
Subject: |
Fix compilation errors in test-math-c++.cc on FreeBSD 12.2/arm64 |
Date: |
Wed, 02 Dec 2020 22:50:24 +0100 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-193-generic; KDE/5.18.0; x86_64; ; ) |
On FreeBSD 12.2/arm64, when compiling a testdir of the POSIX modules
with C++ tests included, I get compilation errors in test-math-c++.cc.
The error flood starts with
In file included from ../../gltests/test-math-c++.cc:22:
In file included from ../gllib/math.h:27:
In file included from /usr/include/c++/v1/math.h:301:
In file included from ../gllib/stdlib.h:46:
In file included from ../gllib/sys/wait.h:28:
In file included from /usr/include/sys/wait.h:156:
In file included from ../gllib/sys/types.h:39:
In file included from /usr/include/sys/types.h:376:
In file included from ../gllib/sys/select.h:88:
In file included from ../gllib/sys/time.h:39:
In file included from /usr/include/sys/time.h:607:
In file included from ../gllib/sys/select.h:117:
In file included from ../gllib/signal.h:67:
In file included from ../gllib/pthread.h:56:
In file included from ../gllib/stdlib.h:28:
In file included from /usr/include/c++/v1/stdlib.h:100:
../gllib/math.h:740:19: error: no member named 'acosf' in the global namespace;
did you mean 'atof'?
This patch fixes it.
2020-12-02 Bruno Haible <bruno@clisp.org>
Fix compilation errors in test-math-c++.cc on FreeBSD 12.2/arm64.
* lib/math.in.h (_GL_INCLUDING_MATH_H): New macro, to work around
recursive self-include problem on FreeBSD 12.2 in C++ mode.
diff --git a/lib/math.in.h b/lib/math.in.h
index a020271..1d7b703 100644
--- a/lib/math.in.h
+++ b/lib/math.in.h
@@ -22,8 +22,23 @@
#endif
@PRAGMA_COLUMNS@
+#if defined _GL_INCLUDING_MATH_H
+/* Special invocation convention:
+ - On FreeBSD 12.2 we have a sequence of nested includes
+ <math.h> -> <stdlib.h> -> <sys/wait.h> -> <sys/types.h> -> <sys/select.h>
+ -> <signal.h> -> <pthread.h> -> <stdlib.h> -> <math.h>
+ In this situation, the functions are not yet declared, therefore we cannot
+ provide the C++ aliases. */
+
+#@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_MATH_H@
+
+#else
+/* Normal invocation convention. */
+
/* The include_next requires a split double-inclusion guard. */
+#define _GL_INCLUDING_MATH_H
#@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_MATH_H@
+#undef _GL_INCLUDING_MATH_H
#ifndef _@GUARD_PREFIX@_MATH_H
#define _@GUARD_PREFIX@_MATH_H
@@ -2601,4 +2616,5 @@ _GL_WARN_REAL_FLOATING_DECL (signbit);
_GL_INLINE_HEADER_END
#endif /* _@GUARD_PREFIX@_MATH_H */
+#endif /* _GL_INCLUDING_MATH_H */
#endif /* _@GUARD_PREFIX@_MATH_H */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Fix compilation errors in test-math-c++.cc on FreeBSD 12.2/arm64,
Bruno Haible <=