Skip to content

Commit

Permalink
[NEW] Add a -wall option to print all warnings generated while compil…
Browse files Browse the repository at this point in the history
…ing the code. Set version to 2.54.0.
  • Loading branch information
sletz committed Nov 19, 2022
1 parent 275b37a commit a962231
Show file tree
Hide file tree
Showing 40 changed files with 207 additions and 62 deletions.
2 changes: 1 addition & 1 deletion 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
Expand Down
2 changes: 1 addition & 1 deletion Makefile
@@ -1,4 +1,4 @@
version := 2.53.4
version := 2.54.0

system ?= $(shell uname -s)

Expand Down
1 change: 1 addition & 0 deletions architecture/faust/dsp/cmajorpatch-dsp.h
Expand Up @@ -244,6 +244,7 @@ class cmajor_dsp_factory : public dsp_factory {
virtual std::string getCompileOptions() { return ""; }
virtual std::vector<std::string> getLibraryList() { return {}; }
virtual std::vector<std::string> getIncludePathnames() { return {}; }
virtual std::vector<std::string> getWarningMessages() { return {}; }

virtual cmajorpatch_dsp* createDSPInstance()
{
Expand Down
1 change: 1 addition & 0 deletions architecture/faust/dsp/dsp.h
Expand Up @@ -225,6 +225,7 @@ class FAUST_API dsp_factory {
virtual std::string getCompileOptions() = 0;
virtual std::vector<std::string> getLibraryList() = 0;
virtual std::vector<std::string> getIncludePathnames() = 0;
virtual std::vector<std::string> getWarningMessages() = 0;

virtual dsp* createDSPInstance() = 0;

Expand Down
3 changes: 3 additions & 0 deletions architecture/faust/dsp/interpreter-dsp.h
Expand Up @@ -122,6 +122,9 @@ class LIBFAUST_API interpreter_dsp_factory : public dsp_factory {
/* Get the list of all used includes */
std::vector<std::string> getIncludePathnames();

/* Get warning messages list for a given compilation */
std::vector<std::string> getWarningMessages();

/* Create a new DSP instance, to be deleted with C++ 'delete' */
interpreter_dsp* createDSPInstance();

Expand Down
5 changes: 4 additions & 1 deletion architecture/faust/dsp/interpreter-machine-dsp.h
Expand Up @@ -119,7 +119,10 @@ class LIBFAUST_API interpreter_dsp_factory : public dsp_factory {

/* Get the list of all used includes */
std::vector<std::string> getIncludePathnames();


/* Get warning messages list for a given compilation */
std::vector<std::string> getWarningMessages();

/* Create a new DSP instance, to be deleted with C++ 'delete' */
interpreter_dsp* createDSPInstance();

Expand Down
9 changes: 9 additions & 0 deletions architecture/faust/dsp/llvm-dsp-c.h
Expand Up @@ -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.
*/
Expand Down
5 changes: 4 additions & 1 deletion architecture/faust/dsp/llvm-dsp.h
Expand Up @@ -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 */
Expand All @@ -125,6 +125,9 @@ class LIBFAUST_API llvm_dsp_factory : public dsp_factory {

/* Get the list of all used includes */
std::vector<std::string> getIncludePathnames();

/* Get warning messages list for a given compilation */
std::vector<std::string> getWarningMessages();

/* Create a new DSP instance, to be deleted with C++ 'delete' */
llvm_dsp* createDSPInstance();
Expand Down
3 changes: 3 additions & 0 deletions architecture/faust/dsp/llvm-machine-dsp.h
Expand Up @@ -118,6 +118,9 @@ class LIBFAUST_API llvm_dsp_factory : public dsp_factory {
/* Get the list of all used includes */
std::vector<std::string> getIncludePathnames();

/* Get warning messages list for a given compilation */
std::vector<std::string> getWarningMessages();

/* Create a new DSP instance, to be deleted with C++ 'delete' */
llvm_dsp* createDSPInstance();

Expand Down
15 changes: 8 additions & 7 deletions architecture/faust/dsp/poly-dsp.h
Expand Up @@ -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<std::string> getLibraryList() { return fProcessFactory->getLibraryList(); }
virtual std::vector<std::string> 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<std::string> getLibraryList() { return fProcessFactory->getLibraryList(); }
std::vector<std::string> getIncludePathnames() { return fProcessFactory->getIncludePathnames(); }
std::vector<std::string> getWarningMessages() { return fProcessFactory->getWarningMessages(); }

std::string getEffectCode(const std::string& dsp_content)
{
std::stringstream effect_code;
Expand Down
5 changes: 4 additions & 1 deletion architecture/faust/dsp/wasm-dsp.h
Expand Up @@ -113,7 +113,10 @@ class LIFAUST_API wasm_dsp_factory : public dsp_factory {

/* Get the list of all used includes */
std::vector<std::string> getIncludePathnames();


/* Get warning messages list for a given compilation */
std::vector<std::string> getWarningMessages();

/* Create a new DSP instance, to be deleted with C++ 'delete' */
wasm_dsp* createDSPInstance();

Expand Down
2 changes: 1 addition & 1 deletion architecture/faust/export.h
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion build/CMakeLists.txt
Expand Up @@ -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} )
Expand Down
2 changes: 1 addition & 1 deletion build/MakeRelease.bat
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion build/Makefile
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions 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
====
Expand Down Expand Up @@ -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:
---------------------------------------
Expand Down
18 changes: 13 additions & 5 deletions compiler/dsp_factory.hh
Expand Up @@ -25,6 +25,7 @@
#include <string.h>
#include <ostream>
#include <string>
#include <vector>

#include "faust/export.h"
#include "faust/gui/CInterface.h"
Expand All @@ -36,6 +37,8 @@
#define COMPILATION_OPTIONS_KEY "compile_options"
#define COMPILATION_OPTIONS "declare compile_options "

extern std::vector<std::string> 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,
Expand All @@ -60,7 +63,9 @@ struct dsp_factory_base {
virtual void setDSPCode(const std::string& code) = 0;

virtual std::string getCompileOptions() = 0;


virtual std::vector<std::string> getWarningMessages() = 0;

virtual dsp* createDSPInstance(dsp_factory* factory) = 0;

virtual void setMemoryManager(dsp_memory_manager* manager) = 0;
Expand All @@ -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:
Expand Down Expand Up @@ -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<std::string> getWarningMessages() { return gWarningMessages; }

virtual dsp* createDSPInstance(dsp_factory* factory)
{
faustassert(false);
Expand Down
10 changes: 8 additions & 2 deletions compiler/generator/export.cpp
Expand Up @@ -20,9 +20,17 @@
************************************************************************/

#include <string>
#include <vector>

#include "faust/export.h"

/*
Global outside of the global context, compiled here
to be defined in libfaust and libfaustmachine libraries.
*/
std::vector<std::string> gWarningMessages;
bool gAllWarning = false;

// External libfaust API

extern "C" LIBFAUST_API const char* getCLibFaustVersion()
Expand All @@ -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.
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions compiler/generator/interpreter/interpreter_dsp_aux.hh
Expand Up @@ -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<std::string> getWarningMessages() { return fFactory->getWarningMessages(); }

interpreter_dsp* createDSPInstance();

Expand Down
19 changes: 19 additions & 0 deletions compiler/generator/llvm/llvm_dsp_aux.cpp
Expand Up @@ -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<string> 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)
{
Expand Down
3 changes: 3 additions & 0 deletions compiler/generator/llvm/llvm_dsp_aux.hh
Expand Up @@ -273,6 +273,7 @@ class LIBFAUST_API llvm_dsp_factory : public dsp_factory, public faust_smartable

std::vector<std::string> getLibraryList() { return fFactory->getLibraryList(); }
std::vector<std::string> getIncludePathnames() { return fFactory->getIncludePathnames(); }
std::vector<std::string> getWarningMessages() { return fFactory->getWarningMessages(); }

std::string getTarget() { return fFactory->getTarget(); }

Expand Down Expand Up @@ -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();
Expand Down
8 changes: 8 additions & 0 deletions compiler/generator/wasm/wasm_dsp_aux.cpp
Expand Up @@ -494,15 +494,22 @@ LIBFAUST_API string wasm_dsp_factory::getCompileOptions()
{
return fDecoder->getCompileOptions();
}

LIBFAUST_API vector<string> wasm_dsp_factory::getLibraryList()
{
return fDecoder->getLibraryList();
}

LIBFAUST_API vector<string> wasm_dsp_factory::getIncludePathnames()
{
return fDecoder->getIncludePathnames();
}

LIBFAUST_API vector<string> wasm_dsp_factory::getWarningMessages()
{
return gWarningMessages;
}

LIBFAUST_API void wasm_dsp_factory::setMemoryManager(dsp_memory_manager* manager)
{
}
Expand All @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions compiler/generator/wasm/wasm_dsp_aux.hh
Expand Up @@ -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;
Expand All @@ -343,6 +344,8 @@ class LIBFAUST_API wasm_dsp_factory : public dsp_factory, public faust_smartable
std::string getCompileOptions();
std::vector<std::string> getLibraryList();
std::vector<std::string> getIncludePathnames();

std::vector<std::string> getWarningMessages();

JSONUIDecoderBase* getDecoder() { return fDecoder; }

Expand Down
3 changes: 3 additions & 0 deletions compiler/global.cpp
Expand Up @@ -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;

Expand Down

0 comments on commit a962231

Please sign in to comment.