mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 11:56:10 +08:00
include/cxx/cmath: Use toolchain <cmath> with toolchain libm.
When CONFIG_LIBM_TOOLCHAIN is enabled, include_next the toolchain\n<c\+\+>/cmath wrapper instead of importing symbols from the NuttX\ncmath shim. This avoids include-order recursion and lets libstdc\+\+\nresolve std::abs/std::acos/... against the matching toolchain C\nmath.h declarations.\n\nKeep the existing NuttX cmath namespace path unchanged for non-\ntoolchain libm configurations. Signed-off-by: aviralgarg05 <gargaviral99@gmail.com>
This commit is contained in:
+12
-1
@@ -30,7 +30,16 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
#include <nuttx/compiler.h>
|
#include <nuttx/compiler.h>
|
||||||
|
|
||||||
#include <math.h>
|
#if defined(CONFIG_LIBM_TOOLCHAIN)
|
||||||
|
/* In toolchain libm mode, use toolchain <cmath> so it can include_next the
|
||||||
|
* matching C math.h header and populate std::* consistently.
|
||||||
|
*/
|
||||||
|
|
||||||
|
# include_next <cmath>
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
# include <math.h>
|
||||||
|
|
||||||
#undef signbit
|
#undef signbit
|
||||||
#undef fpclassify
|
#undef fpclassify
|
||||||
@@ -222,4 +231,6 @@ namespace std
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // __INCLUDE_CXX_CMATH
|
#endif // __INCLUDE_CXX_CMATH
|
||||||
|
|||||||
Reference in New Issue
Block a user