diff --git a/compiler/DirectedGraph/DirectedGraphAlgorythm.hh b/compiler/DirectedGraph/DirectedGraphAlgorythm.hh index bf547a829e..947aba1272 100644 --- a/compiler/DirectedGraph/DirectedGraphAlgorythm.hh +++ b/compiler/DirectedGraph/DirectedGraphAlgorythm.hh @@ -670,7 +670,6 @@ inline std::list recschedule(const digraph& G) return P; } - /******************************************************************************* ******************************************************************************** diff --git a/compiler/generator/rust/rust_code_container.cpp b/compiler/generator/rust/rust_code_container.cpp index 4afdac07bc..451ea988bc 100644 --- a/compiler/generator/rust/rust_code_container.cpp +++ b/compiler/generator/rust/rust_code_container.cpp @@ -246,7 +246,7 @@ void RustCodeContainer::produceClass() // Missing math functions // See: https://users.rust-lang.org/t/analog-of-c-std-remainder/59670 - if (gGlobal->gFloatSize == 1) { + if (gGlobal->gFloatSize == 1 && !gGlobal->gRustNoLibm) { *fOut << "mod ffi {"; tab(n + 1, *fOut); *fOut << "use std::os::raw::c_float;"; @@ -283,7 +283,7 @@ void RustCodeContainer::produceClass() *fOut << "fn remainder_f32(a: f32, b: f32) -> f32 { let n = (a/b).round(); a - b*n }"; tab(n, *fOut); */ - } else if (gGlobal->gFloatSize == 2) { + } else if (gGlobal->gFloatSize == 2 && !gGlobal->gRustNoLibm) { *fOut << "mod ffi {"; tab(n + 1, *fOut); *fOut << "use std::os::raw::{c_double};"; diff --git a/compiler/global.cpp b/compiler/global.cpp index bb1fff6a8f..5b1a7deea8 100644 --- a/compiler/global.cpp +++ b/compiler/global.cpp @@ -449,6 +449,7 @@ void global::reset() gUIMacroSwitch = false; gRustNoTraitSwitch = false; + gRustNoLibm = false; gDumpNorm = -1; gFTZMode = 0; @@ -1258,7 +1259,7 @@ bool global::processCmdline(int argc, const char* argv[]) i += 2; } else if (isCmd(argv[i], "-style", "--svgstyle")) { - gGlobal->gStyleFile = argv[i + 1]; + gStyleFile = argv[i + 1]; i += 2; } else if (isCmd(argv[i], "-f", "--fold") && (i + 1 < argc)) { @@ -1370,6 +1371,10 @@ bool global::processCmdline(int argc, const char* argv[]) gRustNoTraitSwitch = true; i += 1; + } else if (isCmd(argv[i], "-rnlm", "--rust-no-libm")) { + gRustNoLibm = true; + i += 1; + } else if (isCmd(argv[i], "-t", "--timeout") && (i + 1 < argc)) { gTimeout = std::atoi(argv[i + 1]); i += 2; @@ -1654,7 +1659,7 @@ bool global::processCmdline(int argc, const char* argv[]) } if (gMemoryManager >= 1) { - gGlobal->gWaveformInDSP = true; + gWaveformInDSP = true; } // ======================== @@ -1662,7 +1667,11 @@ bool global::processCmdline(int argc, const char* argv[]) // ======================== if (gRustNoTraitSwitch && gOutputLang != "rust") { - throw faustexception("ERROR : '-rnt' option can only be used with rust\n"); + throw faustexception("ERROR : '-rnt' option can only be used with 'rust' backend\n"); + } + + if (gRustNoLibm && gOutputLang != "rust") { + throw faustexception("ERROR : '-rnlm' option can only be used with 'rust' backend\n"); } if (!gRustNoTraitSwitch && gInPlace && gOutputLang == "rust") { @@ -2124,10 +2133,6 @@ string global::printHelp() << "-uim --user-interface-macros add user interface macro definitions to the " "output code." << endl; - sstr << tab - << "-rnt --rust-no-faustdsp-trait (Rust only) Don't generate FaustDsp trait " - "implmentation." - << endl; sstr << tab << "-xml generate an XML description file." << endl; sstr << tab << "-json generate a JSON description file." @@ -2380,6 +2385,14 @@ string global::printHelp() << "-ni --narrowing-iterations number of iterations before stopping " "narrowing in signal bounding." << endl; + sstr << tab + << "-rnt --rust-no-faustdsp-trait (Rust only) Don't generate FaustDsp trait " + "implmentation." + << endl; + sstr << tab + << "-rnlm --rust-no-libm (Rust only) Don't generate FFI calls to libm." + << endl; + #endif #ifndef EMCC sstr << endl << "Block diagram options:" << line; diff --git a/compiler/global.hh b/compiler/global.hh index c27a1c7807..6acff0599d 100644 --- a/compiler/global.hh +++ b/compiler/global.hh @@ -141,6 +141,7 @@ struct global { bool gInlineArchSwitch; // -i option bool gUIMacroSwitch; // -uim option bool gRustNoTraitSwitch; // -rnt option + bool gRustNoLibm; // -rnlm option int gDumpNorm; // -norm option bool gMathExceptions; // -me option, whether to check math functions domains bool gLocalCausalityCheck; // -lcc option, when true trigs local causality errors (negative diff --git a/compiler/tlib/tree.hh b/compiler/tlib/tree.hh index eabcee300f..d2fe921eea 100644 --- a/compiler/tlib/tree.hh +++ b/compiler/tlib/tree.hh @@ -93,7 +93,7 @@ struct less { bool operator()(const CTree* lhs, const CTree* rhs) const; }; -} +} // namespace std /** * A CTree = (Node x [CTree]) is the association of a content Node and a list of subtrees @@ -210,7 +210,7 @@ inline bool less::operator()(const CTree* lhs, const CTree* rhs) const { return lhs->serial() < rhs->serial(); } -}; +}; // namespace std //---------------------------------API--------------------------------------- // To build trees