]> Savannah Git Hosting - gnulib.git/commitdiff
Fix compilation errors in test-math-c++.cc on FreeBSD 12.2/arm64.
authorBruno Haible <bruno@clisp.org>
Wed, 2 Dec 2020 20:15:21 +0000 (21:15 +0100)
committerBruno Haible <bruno@clisp.org>
Wed, 2 Dec 2020 21:05:57 +0000 (22:05 +0100)
* lib/math.in.h (_GL_INCLUDING_MATH_H): New macro, to work around
recursive self-include problem on FreeBSD 12.2 in C++ mode.

ChangeLog
lib/math.in.h

index b32f1909cdd453166e3d0e06551a82571d25c00a..ae48d2dcdb46188ab1a243097ac6088224102cd1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+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.
+
 2020-12-02  Bruno Haible  <bruno@clisp.org>
 
        spawn-pipe: Allow caller to specify directory for the subprocess.
index a0202716b9437f1589b62a2c15d809c145597c5d..1d7b7031c43afde50857707b93eb3f90ba5a5d4f 100644 (file)
 #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 */