From ba1a67d1a937145f50a316e3aba740bb9aa1331e Mon Sep 17 00:00:00 2001 From: laky241 Date: Tue, 21 Jan 2025 00:42:56 +0530 Subject: [PATCH] -i flag to languages --- compiler/global.cpp | 5 +++-- compiler/parser/enrobage.cpp | 9 +++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/compiler/global.cpp b/compiler/global.cpp index 82b7598a91..274028dbae 100644 --- a/compiler/global.cpp +++ b/compiler/global.cpp @@ -1661,8 +1661,9 @@ bool global::processCmdline(int argc, const char* argv[]) // Check options coherency // ======================== - if (gRustNoTraitSwitch && gOutputLang != "rust") { - throw faustexception("ERROR : '-rnt' option can only be used with rust\n"); + if (option_i && targetLang == "rust") { + std::cerr << "Warning: The -i flag has no effect when compiling to Rust." << std::endl; + option_i = false; // Disable the flag for Rust } if (!gRustNoTraitSwitch && gInPlace && gOutputLang == "rust") { diff --git a/compiler/parser/enrobage.cpp b/compiler/parser/enrobage.cpp index b631009d1b..3d3b0f4368 100644 --- a/compiler/parser/enrobage.cpp +++ b/compiler/parser/enrobage.cpp @@ -142,7 +142,12 @@ class myparser { /** * True if string s match '#include ' or include("/usr/local/share/faust/julia/fname") */ -static bool isFaustInclude(const string& line, string& fname) +static bool isFaustInclude(const string& line, string& fname, const string& targetLang){ + +if (targetLang == "rust") { + return false; + +} { myparser P(line); // C/C++ case @@ -154,7 +159,7 @@ static bool isFaustInclude(const string& line, string& fname) myparser Q(fname); return Q.parse("/usr/local/share/faust/julia"); } else { - return false; + return true; } }