SpectMorph vs. RAPICORN_CONVENIENCE



   Hi!

When I try to build a recent SpectMorph against a recent BEAST, I've seen many
error messages related to the assert, assert_unreached, assert_return, ...
macros used in BEAST and Rapicorn. I've picked a few messages, so you can get
the idea:

  CXX      smaudio.lo
In file included from /usr/local/beast/include/beast-0.9/sfi/sfitypes.hh:5:0,
                 from /usr/local/beast/include/beast-0.9/sfi/sficomport.hh:5,
                 from /usr/local/beast/include/beast-0.9/sfi/sfi.hh:22,
                 from /usr/local/beast/include/beast-0.9/bse/bsedefs.hh:8,
                 from /usr/local/beast/include/beast-0.9/bse/bsetype.hh:5,
                 from /usr/local/beast/include/beast-0.9/bse/bseparam.hh:5,
                 from /usr/local/beast/include/beast-0.9/bse/bseobject.hh:5,
                 from /usr/local/beast/include/beast-0.9/bse/bseitem.hh:5,
                 from /usr/local/beast/include/beast-0.9/bse/bsesource.hh:4,
                 from /usr/local/beast/include/beast-0.9/bse/bsecxxbase.hh:5,
                 from /usr/local/beast/include/beast-0.9/bse/bsecxxmodule.hh:5,
                 from /usr/local/beast/include/beast-0.9/bse/bsecxxplugin.hh:5,
                 from smaudio.hh:7,
                 from smaudio.cc:3:
/usr/local/beast/include/beast-0.9/sfi/glib-extra.hh: In function 'void g_bit_matrix_change(GBitMatrix*, 
guint, guint, gboolean)':
/usr/local/beast/include/beast-0.9/sfi/glib-extra.hh:174:67: error: 'assert_return' was not declared in this 
scope
   assert_return (matrix && x < matrix->width && y < matrix->height);
                                                                   ^
In file included from /usr/local/beast/include/beast-0.9/sfi/sfi.hh:39:0,
                 from /usr/local/beast/include/beast-0.9/bse/bsedefs.hh:8,
                 from /usr/local/beast/include/beast-0.9/bse/bsetype.hh:5,
                 from /usr/local/beast/include/beast-0.9/bse/bseparam.hh:5,
                 from /usr/local/beast/include/beast-0.9/bse/bseobject.hh:5,
                 from /usr/local/beast/include/beast-0.9/bse/bseitem.hh:5,
                 from /usr/local/beast/include/beast-0.9/bse/bsesource.hh:4,
                 from /usr/local/beast/include/beast-0.9/bse/bsecxxbase.hh:5,
                 from /usr/local/beast/include/beast-0.9/bse/bsecxxmodule.hh:5,
                 from /usr/local/beast/include/beast-0.9/bse/bsecxxplugin.hh:5,
                 from smaudio.hh:7,
                 from smaudio.cc:3:
/usr/local/beast/include/beast-0.9/sfi/sfivisitors.hh: In function 'const std::vector<_GParamSpec*>& 
Bse::sfi_pspecs_fields_from_accessor_visitable(Visitable&)':
/usr/local/beast/include/beast-0.9/sfi/sfivisitors.hh:359:29: error: there are no arguments to 'assert' that 
depend on a template parameter, so a declaration of 'assert' must be available [-fpermissive]
   assert (success && pspecsp);
                             ^
[...]

/usr/local/beast/include/beast-0.9/bse/gsldatautils.hh: In function 'guint 
gsl_conv_from_float_clip(GslWaveFormatType, guint, const gfloat*, gpointer, guint)':
/usr/local/beast/include/beast-0.9/bse/gsldatautils.hh:607:25: error: 'assert_unreached' was not declared in 
this scope
       assert_unreached ();

[...]

Now these headers do not cause trouble within BEAST / Rapicorn itself, because
these are compiled with -DRAPICORN_CONVENIENCE. However this is not an option for
SpectMorph: I tried compiling with -DRAPICORN_CONVENIENCE, and got this errors:

  CXX      smaudio.lo
In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/qglobal.h:1083:0,
                 from /usr/include/x86_64-linux-gnu/qt5/QtCore/qmutex.h:37,
                 from /usr/include/x86_64-linux-gnu/qt5/QtCore/QMutex:1,
                 from smleakdebugger.hh:8,
                 from smaudio.cc:7:
/usr/include/x86_64-linux-gnu/qt5/QtCore/qlogging.h:93:10: error: expected unqualified-id before 'do'
     void critical(const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
          ^
/usr/include/x86_64-linux-gnu/qt5/QtCore/qlogging.h:93:165: error: expected unqualified-id before 'while'
     void critical(const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);

The corresponding source code is is Qt5:
                                                                                                              
                                                       ^
class Q_CORE_EXPORT QMessageLogger
{
    [...]
public:
    [...]
    void critical(const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
    [...]

For fixing this, I suggest replacing usages of all RAPICORN_CONVENIENCE macros
by their long names, whenever they are used in rapicorn or beast header files
(*.hh). These functions would be affected:

#ifdef RAPICORN_CONVENIENCE
#define assert_unreached RAPICORN_ASSERT_UNREACHED  ///< Shorthand for RAPICORN_ASSERT_UNREACHED() if 
RAPICORN_CONVENIENCE is defined.
#define assert_return    RAPICORN_ASSERT_RETURN     ///< Shorthand for RAPICORN_ASSERT_RETURN() if 
RAPICORN_CONVENIENCE is defined.
#define fatal            RAPICORN_FATAL             ///< Shorthand for RAPICORN_FATAL() if 
RAPICORN_CONVENIENCE is defined.
#define critical_unless  RAPICORN_CRITICAL_UNLESS   ///< Shorthand for RAPICORN_CRITICAL_UNLESS() if 
RAPICORN_CONVENIENCE is defined.
#define critical         RAPICORN_CRITICAL          ///< Shorthand for RAPICORN_CRITICAL() if 
RAPICORN_CONVENIENCE is defined.
#define STARTUP_ASSERT   RAPICORN_STARTUP_ASSERT    ///< Shorthand for RAPICORN_STARTUP_ASSERT() if 
RAPICORN_CONVENIENCE is defined.
#define STATIC_ASSERT    RAPICORN_STATIC_ASSERT     ///< Shorthand for RAPICORN_STATIC_ASSERT() if 
RAPICORN_CONVENIENCE is defined.
#endif // RAPICORN_CONVENIENCE

I volunteer to create a patch for that.

   Cu... Stefan
-- 
Stefan Westerfeld, http://space.twc.de/~stefan


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]