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:
aviralgarg05
2026-02-09 23:58:53 +05:30
committed by Xiang Xiao
parent 37152f7a34
commit 2820444284
+12 -1
View File
@@ -30,7 +30,16 @@
#include <nuttx/config.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 fpclassify
@@ -222,4 +231,6 @@ namespace std
}
#endif
#endif // __INCLUDE_CXX_CMATH