From a962231a9ca985cfa2ba513c01028872af62b115 Mon Sep 17 00:00:00 2001 From: Stephane Letz Date: Fri, 18 Nov 2022 11:41:26 +0100 Subject: [PATCH] [NEW] Add a -wall option to print all warnings generated while compiling the code. Set version to 2.54.0. --- COPYING.txt | 2 +- Makefile | 2 +- architecture/faust/dsp/cmajorpatch-dsp.h | 1 + architecture/faust/dsp/dsp.h | 1 + architecture/faust/dsp/interpreter-dsp.h | 3 +++ .../faust/dsp/interpreter-machine-dsp.h | 5 ++++- architecture/faust/dsp/llvm-dsp-c.h | 9 +++++++++ architecture/faust/dsp/llvm-dsp.h | 5 ++++- architecture/faust/dsp/llvm-machine-dsp.h | 3 +++ architecture/faust/dsp/poly-dsp.h | 15 ++++++++------- architecture/faust/dsp/wasm-dsp.h | 5 ++++- architecture/faust/export.h | 2 +- build/CMakeLists.txt | 2 +- build/MakeRelease.bat | 2 +- build/Makefile | 2 +- compiler/README.md | 6 ++++-- compiler/dsp_factory.hh | 18 +++++++++++++----- compiler/generator/export.cpp | 10 ++++++++-- .../interpreter/interpreter_dsp_aux.hh | 2 ++ compiler/generator/llvm/llvm_dsp_aux.cpp | 19 +++++++++++++++++++ compiler/generator/llvm/llvm_dsp_aux.hh | 3 +++ compiler/generator/wasm/wasm_dsp_aux.cpp | 8 ++++++++ compiler/generator/wasm/wasm_dsp_aux.hh | 3 +++ compiler/global.cpp | 3 +++ compiler/global.hh | 18 +++++++++++------- compiler/libcode.cpp | 13 +++++++++---- compiler/main.cpp | 12 ++++++++++++ compiler/transform/sigPromotion.cpp | 17 +++++++++-------- compiler/transform/treeTraversal.hh | 2 +- documentation/compiler/Doxyfile | 2 +- documentation/libfaust/Doxyfile | 2 +- documentation/libfaustremote/Doxyfile | 2 +- documentation/man/README.md | 6 ++++-- documentation/man/man-header.txt | 2 +- documentation/man/man1/faust.1 | 6 ++++-- tests/impulse-tests/Makefile | 3 ++- tests/interp-tests/interp-test.cpp | 18 ++++++++++++++++++ tests/llvm-tests/llvm-test.cpp | 19 +++++++++++++++++++ windows/faust.rc | 8 ++++---- windows/faustdll.rc | 8 ++++---- 40 files changed, 207 insertions(+), 62 deletions(-) diff --git a/COPYING.txt b/COPYING.txt index 475a18e469..616068a6f7 100644 --- a/COPYING.txt +++ b/COPYING.txt @@ -1,4 +1,4 @@ - FAUST compiler, Version 2.53.4 + FAUST compiler, Version 2.54.0 Copyright (C) 2003-2019 GRAME, Centre National de Creation Musicale --------------------------------------------------------------------- This program is free software; you can redistribute it and/or modify diff --git a/Makefile b/Makefile index 3f1b753cbf..e6c27930f3 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -version := 2.53.4 +version := 2.54.0 system ?= $(shell uname -s) diff --git a/architecture/faust/dsp/cmajorpatch-dsp.h b/architecture/faust/dsp/cmajorpatch-dsp.h index bd1401704c..0ce36ef075 100644 --- a/architecture/faust/dsp/cmajorpatch-dsp.h +++ b/architecture/faust/dsp/cmajorpatch-dsp.h @@ -244,6 +244,7 @@ class cmajor_dsp_factory : public dsp_factory { virtual std::string getCompileOptions() { return ""; } virtual std::vector getLibraryList() { return {}; } virtual std::vector getIncludePathnames() { return {}; } + virtual std::vector getWarningMessages() { return {}; } virtual cmajorpatch_dsp* createDSPInstance() { diff --git a/architecture/faust/dsp/dsp.h b/architecture/faust/dsp/dsp.h index 2c2e4ebc39..543d787f3f 100644 --- a/architecture/faust/dsp/dsp.h +++ b/architecture/faust/dsp/dsp.h @@ -225,6 +225,7 @@ class FAUST_API dsp_factory { virtual std::string getCompileOptions() = 0; virtual std::vector getLibraryList() = 0; virtual std::vector getIncludePathnames() = 0; + virtual std::vector getWarningMessages() = 0; virtual dsp* createDSPInstance() = 0; diff --git a/architecture/faust/dsp/interpreter-dsp.h b/architecture/faust/dsp/interpreter-dsp.h index 419e1c21c3..99782512bb 100644 --- a/architecture/faust/dsp/interpreter-dsp.h +++ b/architecture/faust/dsp/interpreter-dsp.h @@ -122,6 +122,9 @@ class LIBFAUST_API interpreter_dsp_factory : public dsp_factory { /* Get the list of all used includes */ std::vector getIncludePathnames(); + /* Get warning messages list for a given compilation */ + std::vector getWarningMessages(); + /* Create a new DSP instance, to be deleted with C++ 'delete' */ interpreter_dsp* createDSPInstance(); diff --git a/architecture/faust/dsp/interpreter-machine-dsp.h b/architecture/faust/dsp/interpreter-machine-dsp.h index 0b1f06b466..75308f4e11 100644 --- a/architecture/faust/dsp/interpreter-machine-dsp.h +++ b/architecture/faust/dsp/interpreter-machine-dsp.h @@ -119,7 +119,10 @@ class LIBFAUST_API interpreter_dsp_factory : public dsp_factory { /* Get the list of all used includes */ std::vector getIncludePathnames(); - + + /* Get warning messages list for a given compilation */ + std::vector getWarningMessages(); + /* Create a new DSP instance, to be deleted with C++ 'delete' */ interpreter_dsp* createDSPInstance(); diff --git a/architecture/faust/dsp/llvm-dsp-c.h b/architecture/faust/dsp/llvm-dsp-c.h index 0b8e6a4502..40af071ec3 100644 --- a/architecture/faust/dsp/llvm-dsp-c.h +++ b/architecture/faust/dsp/llvm-dsp-c.h @@ -251,6 +251,15 @@ extern "C" */ LIBFAUST_API const char** getCDSPFactoryIncludePathnames(llvm_dsp_factory* factory); + /** + * Get warning messages list for a given compilation as a null-terminated array. + * + * @param factory - the DSP factory. + * + * @return the warning messages list (the array and it's content has to be deleted by the caller using freeCMemory). + */ + LIBFAUST_API const char** getCWarningMessages(llvm_dsp_factory* factory); + /** * Delete all Faust DSP factories kept in the library cache. Beware: all kept factory pointers (in local variables...) thus become invalid. */ diff --git a/architecture/faust/dsp/llvm-dsp.h b/architecture/faust/dsp/llvm-dsp.h index ca737d3233..c9c2c98404 100644 --- a/architecture/faust/dsp/llvm-dsp.h +++ b/architecture/faust/dsp/llvm-dsp.h @@ -108,7 +108,7 @@ class LIBFAUST_API llvm_dsp_factory : public dsp_factory { */ std::string getName(); - /* Return factory LLVM target (like 'i386-apple-macosx10.6.0:opteron')*/ + /* Return factory LLVM target (like 'i386-apple-macosx10.6.0:opteron') */ std::string getTarget(); /* Return factory SHA key */ @@ -125,6 +125,9 @@ class LIBFAUST_API llvm_dsp_factory : public dsp_factory { /* Get the list of all used includes */ std::vector getIncludePathnames(); + + /* Get warning messages list for a given compilation */ + std::vector getWarningMessages(); /* Create a new DSP instance, to be deleted with C++ 'delete' */ llvm_dsp* createDSPInstance(); diff --git a/architecture/faust/dsp/llvm-machine-dsp.h b/architecture/faust/dsp/llvm-machine-dsp.h index 55d9934c34..be1538cb3c 100644 --- a/architecture/faust/dsp/llvm-machine-dsp.h +++ b/architecture/faust/dsp/llvm-machine-dsp.h @@ -118,6 +118,9 @@ class LIBFAUST_API llvm_dsp_factory : public dsp_factory { /* Get the list of all used includes */ std::vector getIncludePathnames(); + /* Get warning messages list for a given compilation */ + std::vector getWarningMessages(); + /* Create a new DSP instance, to be deleted with C++ 'delete' */ llvm_dsp* createDSPInstance(); diff --git a/architecture/faust/dsp/poly-dsp.h b/architecture/faust/dsp/poly-dsp.h index 663c76d90d..b0fda0fd5c 100644 --- a/architecture/faust/dsp/poly-dsp.h +++ b/architecture/faust/dsp/poly-dsp.h @@ -996,13 +996,14 @@ struct dsp_poly_factory : public dsp_factory { virtual ~dsp_poly_factory() {} - virtual std::string getName() { return fProcessFactory->getName(); } - virtual std::string getSHAKey() { return fProcessFactory->getSHAKey(); } - virtual std::string getDSPCode() { return fProcessFactory->getDSPCode(); } - virtual std::string getCompileOptions() { return fProcessFactory->getCompileOptions(); } - virtual std::vector getLibraryList() { return fProcessFactory->getLibraryList(); } - virtual std::vector getIncludePathnames() { return fProcessFactory->getIncludePathnames(); } - + std::string getName() { return fProcessFactory->getName(); } + std::string getSHAKey() { return fProcessFactory->getSHAKey(); } + std::string getDSPCode() { return fProcessFactory->getDSPCode(); } + std::string getCompileOptions() { return fProcessFactory->getCompileOptions(); } + std::vector getLibraryList() { return fProcessFactory->getLibraryList(); } + std::vector getIncludePathnames() { return fProcessFactory->getIncludePathnames(); } + std::vector getWarningMessages() { return fProcessFactory->getWarningMessages(); } + std::string getEffectCode(const std::string& dsp_content) { std::stringstream effect_code; diff --git a/architecture/faust/dsp/wasm-dsp.h b/architecture/faust/dsp/wasm-dsp.h index 7529628ace..4d3e5fbab8 100644 --- a/architecture/faust/dsp/wasm-dsp.h +++ b/architecture/faust/dsp/wasm-dsp.h @@ -113,7 +113,10 @@ class LIFAUST_API wasm_dsp_factory : public dsp_factory { /* Get the list of all used includes */ std::vector getIncludePathnames(); - + + /* Get warning messages list for a given compilation */ + std::vector getWarningMessages(); + /* Create a new DSP instance, to be deleted with C++ 'delete' */ wasm_dsp* createDSPInstance(); diff --git a/architecture/faust/export.h b/architecture/faust/export.h index bb5cc32e47..d1fc18aa39 100644 --- a/architecture/faust/export.h +++ b/architecture/faust/export.h @@ -25,7 +25,7 @@ #ifndef __export__ #define __export__ -#define FAUSTVERSION "2.53.4" +#define FAUSTVERSION "2.54.0" // Use FAUST_API for code that is part of the external API but is also compiled in faust and libfaust // Use LIBFAUST_API for code that is compiled in faust and libfaust diff --git a/build/CMakeLists.txt b/build/CMakeLists.txt index 6139a1b836..6c5e733b67 100644 --- a/build/CMakeLists.txt +++ b/build/CMakeLists.txt @@ -3,7 +3,7 @@ project (faust) ####################################### # versions management -set (VERSION 2.53.4) +set (VERSION 2.54.0) macro (get_major_minor_patch version) string( REGEX REPLACE "([0-9]*)\\.([0-9]*)\\.([0-9]*)" "\\1" VERSION_MAJOR ${version} ) string( REGEX REPLACE "([0-9]*)\\.([0-9]*)\\.([0-9]*)" "\\2" VERSION_MINOR ${version} ) diff --git a/build/MakeRelease.bat b/build/MakeRelease.bat index 1f851d4713..4d59e4d50c 100644 --- a/build/MakeRelease.bat +++ b/build/MakeRelease.bat @@ -3,7 +3,7 @@ echo off IF [%1]==[] GOTO USAGE IF NOT EXIST %1 GOTO USAGE -SET VERSION=2.53.4 +SET VERSION=2.54.0 SET BUILD=%1 SET FAUSTGENVERSION=1.62 SET FAUSTLIVE=../../faustlive diff --git a/build/Makefile b/build/Makefile index 55f0119602..2a35f35f73 100644 --- a/build/Makefile +++ b/build/Makefile @@ -11,7 +11,7 @@ system := $(shell echo $(system) | grep MINGW > /dev/null && echo MINGW || echo # output directories FAUSTDIR ?= faustdir IOSDIR := iosdir -VERSION := 2.53.4 +VERSION := 2.54.0 #=============================================================== # current generator and backends diff --git a/compiler/README.md b/compiler/README.md index 06e01ab70e..36e9fe30b2 100644 --- a/compiler/README.md +++ b/compiler/README.md @@ -1,4 +1,4 @@ -% man(1) Version 2.53.4 (18-November-2022) | Faust man page +% man(1) Version 2.54.0 (18-November-2022) | Faust man page NAME ==== @@ -201,12 +201,14 @@ Debug options: **-norm** **--normalized-form** print signals in normalized form and exit. - **-ct** **--check-table** check rtable/rwtable index range and generate safe access code. + **-ct** **--check-table** check rtable/rwtable index range and generate safe access code (0/1: 1 by default). **-me** **--math-exceptions** check / for 0 as denominator and remainder, fmod, sqrt, log10, log, acos, asin functions domain. **-sts** **--strict-select** generate strict code for 'selectX' even for stateless branches (both are computed). + **-wall** **--warning-all** print all warnings. + Information options: --------------------------------------- diff --git a/compiler/dsp_factory.hh b/compiler/dsp_factory.hh index b504268dfd..dd320eeee3 100644 --- a/compiler/dsp_factory.hh +++ b/compiler/dsp_factory.hh @@ -25,6 +25,7 @@ #include #include #include +#include #include "faust/export.h" #include "faust/gui/CInterface.h" @@ -36,6 +37,8 @@ #define COMPILATION_OPTIONS_KEY "compile_options" #define COMPILATION_OPTIONS "declare compile_options " +extern std::vector gWarningMessages; + /* In order to better separate compilation and execution for dynamic backends (LLVM, Interpreter, WebAssembly). A dsp_factory_base* object will either be generated by the compiler from a dsp, @@ -60,7 +63,9 @@ struct dsp_factory_base { virtual void setDSPCode(const std::string& code) = 0; virtual std::string getCompileOptions() = 0; - + + virtual std::vector getWarningMessages() = 0; + virtual dsp* createDSPInstance(dsp_factory* factory) = 0; virtual void setMemoryManager(dsp_memory_manager* manager) = 0; @@ -79,9 +84,10 @@ struct dsp_factory_base { class dsp_factory_imp : public dsp_factory_base { protected: - std::string fName; - std::string fSHAKey; - std::string fExpandedDSP; + std::string fName; + std::string fSHAKey; + std::string fExpandedDSP; + dsp_memory_manager* fManager; public: @@ -116,7 +122,9 @@ class dsp_factory_imp : public dsp_factory_base { void setDSPCode(const std::string& code) { fExpandedDSP = code; } virtual std::string getCompileOptions() { return ""; }; - + + virtual std::vector getWarningMessages() { return gWarningMessages; } + virtual dsp* createDSPInstance(dsp_factory* factory) { faustassert(false); diff --git a/compiler/generator/export.cpp b/compiler/generator/export.cpp index 6a05da6540..30e4c0fad0 100644 --- a/compiler/generator/export.cpp +++ b/compiler/generator/export.cpp @@ -20,9 +20,17 @@ ************************************************************************/ #include +#include #include "faust/export.h" +/* + Global outside of the global context, compiled here + to be defined in libfaust and libfaustmachine libraries. +*/ +std::vector gWarningMessages; +bool gAllWarning = false; + // External libfaust API extern "C" LIBFAUST_API const char* getCLibFaustVersion() @@ -36,7 +44,6 @@ extern "C" LIBFAUST_API const char* getCLibFaustVersion() } /* - Regular C++ exceptions are deactivated when compiled with 'emcc' since adding them (using Emscripten runtime mechanism) practically doubles the size of the generated wasm library. @@ -47,7 +54,6 @@ extern "C" LIBFAUST_API const char* getCLibFaustVersion() - a regular JS exception is triggered and catched on JS side - the actual exception message is retrieved on JS side using 'getErrorAfterException' - and finally global context cleanup is done from JS side using 'cleanupAfterException' - */ #ifdef EMCC diff --git a/compiler/generator/interpreter/interpreter_dsp_aux.hh b/compiler/generator/interpreter/interpreter_dsp_aux.hh index 46ca0acb40..ebba699343 100644 --- a/compiler/generator/interpreter/interpreter_dsp_aux.hh +++ b/compiler/generator/interpreter/interpreter_dsp_aux.hh @@ -890,6 +890,8 @@ class LIBFAUST_API interpreter_dsp_factory : public dsp_factory, public faust_sm void setDSPCode(std::string code) { fFactory->setDSPCode(code); } std::string getCompileOptions() { return fFactory->getCompileOptions(); } + + std::vector getWarningMessages() { return fFactory->getWarningMessages(); } interpreter_dsp* createDSPInstance(); diff --git a/compiler/generator/llvm/llvm_dsp_aux.cpp b/compiler/generator/llvm/llvm_dsp_aux.cpp index 660aae92e3..dc6de8619b 100644 --- a/compiler/generator/llvm/llvm_dsp_aux.cpp +++ b/compiler/generator/llvm/llvm_dsp_aux.cpp @@ -740,6 +740,25 @@ LIBFAUST_API const char** getCDSPFactoryIncludePathnames(llvm_dsp_factory* facto return nullptr; } } + +LIBFAUST_API const char** getCWarningMessages(llvm_dsp_factory* factory) +{ + if (factory) { + vector include_list1 = factory->getWarningMessages(); + const char** include_list2 = (const char**)malloc(sizeof(char*) * (include_list1.size() + 1)); + + size_t i; + for (i = 0; i < include_list1.size(); i++) { + include_list2[i] = strdup(include_list1[i].c_str()); + } + + // Last element is NULL + include_list2[i] = nullptr; + return include_list2; + } else { + return nullptr; + } +} LIBFAUST_API char* getCDSPFactoryCompileOptions(llvm_dsp_factory* factory) { diff --git a/compiler/generator/llvm/llvm_dsp_aux.hh b/compiler/generator/llvm/llvm_dsp_aux.hh index 3155908cc9..8616a51a6d 100644 --- a/compiler/generator/llvm/llvm_dsp_aux.hh +++ b/compiler/generator/llvm/llvm_dsp_aux.hh @@ -273,6 +273,7 @@ class LIBFAUST_API llvm_dsp_factory : public dsp_factory, public faust_smartable std::vector getLibraryList() { return fFactory->getLibraryList(); } std::vector getIncludePathnames() { return fFactory->getIncludePathnames(); } + std::vector getWarningMessages() { return fFactory->getWarningMessages(); } std::string getTarget() { return fFactory->getTarget(); } @@ -370,6 +371,8 @@ LIBFAUST_API const char** getCDSPFactoryLibraryList(llvm_dsp_factory* factory); LIBFAUST_API const char** getCDSPFactoryIncludePathnames(llvm_dsp_factory* factory); +LIBFAUST_API const char** getCWarningMessages(llvm_dsp_factory* factory); + LIBFAUST_API char* getCDSPFactoryCompileOptions(llvm_dsp_factory* factory); LIBFAUST_API void deleteAllCDSPFactories(); diff --git a/compiler/generator/wasm/wasm_dsp_aux.cpp b/compiler/generator/wasm/wasm_dsp_aux.cpp index 7d63d88f09..449ed7a6cb 100644 --- a/compiler/generator/wasm/wasm_dsp_aux.cpp +++ b/compiler/generator/wasm/wasm_dsp_aux.cpp @@ -494,15 +494,22 @@ LIBFAUST_API string wasm_dsp_factory::getCompileOptions() { return fDecoder->getCompileOptions(); } + LIBFAUST_API vector wasm_dsp_factory::getLibraryList() { return fDecoder->getLibraryList(); } + LIBFAUST_API vector wasm_dsp_factory::getIncludePathnames() { return fDecoder->getIncludePathnames(); } +LIBFAUST_API vector wasm_dsp_factory::getWarningMessages() +{ + return gWarningMessages; +} + LIBFAUST_API void wasm_dsp_factory::setMemoryManager(dsp_memory_manager* manager) { } @@ -516,6 +523,7 @@ LIBFAUST_API void wasm_dsp_factory::write(ostream* out, bool binary, bool small) { fFactory->write(out, binary, small); } + LIBFAUST_API void wasm_dsp_factory::writeHelper(ostream* out, bool binary, bool small) { fFactory->writeHelper(out, binary, small); diff --git a/compiler/generator/wasm/wasm_dsp_aux.hh b/compiler/generator/wasm/wasm_dsp_aux.hh index eed1cdb139..4b341ef36a 100644 --- a/compiler/generator/wasm/wasm_dsp_aux.hh +++ b/compiler/generator/wasm/wasm_dsp_aux.hh @@ -318,6 +318,7 @@ class LIBFAUST_API wasm_dsp_factory : public dsp_factory, public faust_smartable JSONUIDecoderBase* fDecoder; int fInstance; // Index of wasm DSP instance MapUI fMapUI; + /* #ifdef EMCC SoundUI* fSoundUI; @@ -343,6 +344,8 @@ class LIBFAUST_API wasm_dsp_factory : public dsp_factory, public faust_smartable std::string getCompileOptions(); std::vector getLibraryList(); std::vector getIncludePathnames(); + + std::vector getWarningMessages(); JSONUIDecoderBase* getDecoder() { return fDecoder; } diff --git a/compiler/global.cpp b/compiler/global.cpp index 2b1c0fc114..ac6bab289e 100644 --- a/compiler/global.cpp +++ b/compiler/global.cpp @@ -339,6 +339,9 @@ global::global() : TABBER(1), gLoopDetector(1024, 400), gStackOverflowDetector(M // Part of the state that needs to be initialized between consecutive calls to Box/Signal API void global::reset() { + gAllWarning = false; + gWarningMessages.clear(); + gResult = nullptr; gExpandedDefList = nullptr; diff --git a/compiler/global.hh b/compiler/global.hh index 95ef82d22f..f47023a14f 100644 --- a/compiler/global.hh +++ b/compiler/global.hh @@ -74,6 +74,10 @@ struct comp_str { typedef map, comp_str> MetaDataSet; typedef map> FunMDSet; // foo -> {(file/foo/key,value)...} +// Global outside of the global context +extern vector gWarningMessages; +extern bool gAllWarning; + // Global singleton like compiler state struct global { @@ -217,12 +221,12 @@ struct global { set gDocAutodocKeySet; map gDocNoticeFlagMap; map gDocMathStringMap; - vector gDocVector; ///< Contains parsed trees: DOCTXT, DOCEQN, DOCDGM + vector gDocVector; //< Contains parsed trees: DOCTXT, DOCEQN, DOCDGM map gDocNoticeStringMap; set gDocNoticeKeySet; set gDocMathKeySet; - const char* gDocDevSuffix; ///< ".tex" (or .??? - used to choose output device) - string gCurrentDir; ///< Room to save current directory name + const char* gDocDevSuffix; //< ".tex" (or .??? - used to choose output device) + string gCurrentDir; //< Room to save current directory name string gLatexheaderfilename; struct tm gCompilationDate; int gFileNum; @@ -230,9 +234,9 @@ struct global { string gDocTextsDefaultFile; // Error handling - int gErrorCount; - string gErrorMessage; - Tabber TABBER; + int gErrorCount; + string gErrorMessage; + Tabber TABBER; // ------------ // boxppShared @@ -265,7 +269,7 @@ struct global { // Used in eval int gBoxSlotNumber; //counter for unique slot number - bool gCausality; // FIXME: global used as a parameter of typeAnnotation when true trigs causality errors (negative delay) + bool gCausality; // FIXME: global used as a parameter of typeAnnotation when true trigs causality errors (negative delay) // Properties Tree BOXTYPEPROP; diff --git a/compiler/libcode.cpp b/compiler/libcode.cpp index 3eb0134e59..c387ba12ff 100644 --- a/compiler/libcode.cpp +++ b/compiler/libcode.cpp @@ -705,7 +705,11 @@ static bool processCmdline(int argc, const char* argv[]) } else if (isCmd(argv[i], "-ct", "--check-table")) { gGlobal->gCheckTable = (std::atoi(argv[i + 1]) == 1); i += 2; - + + } else if (isCmd(argv[i], "-wall", "--warning-all")) { + gAllWarning = true; + i += 1; + } else if (isCmd(argv[i], "-me", "--math-exceptions")) { gGlobal->gMathExceptions = true; i += 1; @@ -1101,12 +1105,13 @@ static void printHelp() cout << tab << "-tg --task-graph print the internal task graph in dot format." << endl; cout << tab << "-sg --signal-graph print the internal signal graph in dot format." << endl; cout << tab << "-norm --normalized-form print signals in normalized form and exit." << endl; - cout << tab << "-ct --check-table check rtable/rwtable index range and generate safe access code." << endl; + cout << tab << "-ct --check-table check rtable/rwtable index range and generate safe access code (0/1: 1 by default)." << endl; cout << tab << "-me --math-exceptions check / for 0 as denominator and remainder, fmod, sqrt, log10, " "log, acos, asin functions domain." << endl; cout << tab << "-sts --strict-select generate strict code for 'selectX' even for stateless branches (both are computed)." << endl; + cout << tab << "-wall --warning-all print all warnings." << endl; cout << endl << "Information options:" << line; cout << tab << "-h --help print this help message." << endl; @@ -2420,7 +2425,7 @@ static void* createFactoryAux2(void* arg) } } }; - + try { CallContext* context = static_cast(arg); string name_app = context->fNameApp; @@ -2480,7 +2485,7 @@ dsp_factory_base* createFactory(const string& name_app, callFun(createFactoryAux1, &context); dsp_factory_base* factory = gGlobal->gDSPFactory; error_msg = gGlobal->gErrorMessage; - + global::destroy(); return factory; } diff --git a/compiler/main.cpp b/compiler/main.cpp index 647a025c03..f0704707e9 100644 --- a/compiler/main.cpp +++ b/compiler/main.cpp @@ -30,6 +30,7 @@ unsigned faust_alarm(unsigned seconds) #include #include "compatibility.hh" #include "dsp_factory.hh" +#include "global.hh" using namespace std; @@ -43,6 +44,17 @@ int main(int argc, const char* argv[]) { string error_msg; dsp_factory_base* factory = createFactory("FaustDSP", "", argc, argv, error_msg, true); + // Possibly print warnings + if (factory) { + vector warning_messages = factory->getWarningMessages(); + if (gAllWarning && warning_messages.size() > 0) { + cerr << endl << "===== Warnings ======" << endl; + for (const auto& it : warning_messages) { + cerr << it << endl; + } + cerr << "=====================" << endl; + } + } delete factory; if (error_msg == "") { return EXIT_SUCCESS; diff --git a/compiler/transform/sigPromotion.cpp b/compiler/transform/sigPromotion.cpp index ae925cf25e..4365f735e8 100644 --- a/compiler/transform/sigPromotion.cpp +++ b/compiler/transform/sigPromotion.cpp @@ -402,10 +402,9 @@ Tree SignalTablePromotion::safeSigRDTbl(Tree sig, Tree tb, Tree size, Tree idx) interval idx_i = getCertifiedSigType(idx)->getInterval(); if (idx_i.lo < 0 || idx_i.hi >= tree2int(size)) { stringstream error; - error << "WARNING : RDTbl read index [" << idx_i.lo << ":" <getInterval(); if (idx_i.lo < 0 || idx_i.hi >= tree2int(size)) { stringstream error; - error << "WARNING : WRTbl read index [" << idx_i.lo << ":" <getCompileOptions() << endl; + printList(factory->getWarningMessages()); + deleteInterpreterDSPFactory(factory); + } + cout << "=============================\n"; cout << "Test readInterpreterDSPFactoryFromBitcodeFile\n"; { diff --git a/tests/llvm-tests/llvm-test.cpp b/tests/llvm-tests/llvm-test.cpp index 77a26bdd98..c37d5ced64 100644 --- a/tests/llvm-tests/llvm-test.cpp +++ b/tests/llvm-tests/llvm-test.cpp @@ -164,6 +164,25 @@ static void Test(const char* dspFileAux) deleteDSPFactory(factory); } + + cout << "=============================\n"; + cout << "Test createDSPFactoryFromString with getWarningMessages\n"; + { + const char* argv[8]; + int argc = 0; + argv[argc++] = "-wall"; + argv[argc] = nullptr; // NULL terminated argv + string code = "process = rwtable(10, 10.0, idx, _, idx) with { idx = +(1)~_; };"; + llvm_dsp_factory* factory = createDSPFactoryFromString("FaustDSP", code, argc, argv, JIT_TARGET, error_msg, -1); + if (!factory) { + cerr << "Cannot create factory : " << error_msg; + exit(EXIT_FAILURE); + } + cout << "getCompileOptions " << factory->getCompileOptions() << endl; + printList(factory->getWarningMessages()); + deleteDSPFactory(factory); + } + cout << "=============================\n"; cout << "Test createDSPFactoryFromString with registerForeignFunction\n"; { diff --git a/windows/faust.rc b/windows/faust.rc index 0660eb750e..79e2aa7884 100644 --- a/windows/faust.rc +++ b/windows/faust.rc @@ -51,8 +51,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,53,4,0 - PRODUCTVERSION 2,53,4,0 + FILEVERSION 2,54,0,0 + PRODUCTVERSION 2,54,0,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -68,12 +68,12 @@ BEGIN BLOCK "040c04b0" BEGIN VALUE "FileDescription", "Faust compiler" - VALUE "FileVersion", "2, 53, 4, 0" + VALUE "FileVersion", "2, 54, 0, 0" VALUE "InternalName", "Faust" VALUE "LegalCopyright", "Copyright (C) 2009-2019 - Grame" VALUE "OriginalFilename", "faust.exe" VALUE "ProductName", "Faust" - VALUE "ProductVersion", "2, 53, 4, 0" + VALUE "ProductVersion", "2, 54, 0, 0" END END BLOCK "VarFileInfo" diff --git a/windows/faustdll.rc b/windows/faustdll.rc index 0660eb750e..79e2aa7884 100644 --- a/windows/faustdll.rc +++ b/windows/faustdll.rc @@ -51,8 +51,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,53,4,0 - PRODUCTVERSION 2,53,4,0 + FILEVERSION 2,54,0,0 + PRODUCTVERSION 2,54,0,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -68,12 +68,12 @@ BEGIN BLOCK "040c04b0" BEGIN VALUE "FileDescription", "Faust compiler" - VALUE "FileVersion", "2, 53, 4, 0" + VALUE "FileVersion", "2, 54, 0, 0" VALUE "InternalName", "Faust" VALUE "LegalCopyright", "Copyright (C) 2009-2019 - Grame" VALUE "OriginalFilename", "faust.exe" VALUE "ProductName", "Faust" - VALUE "ProductVersion", "2, 53, 4, 0" + VALUE "ProductVersion", "2, 54, 0, 0" END END BLOCK "VarFileInfo"