[beast: 6/16] BSE: use static_assert instead of a Rapicorn macro
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast: 6/16] BSE: use static_assert instead of a Rapicorn macro
- Date: Sat, 30 Sep 2017 01:03:12 +0000 (UTC)
commit 144a321ff3039e5077c3f30778036dfb9b83eade
Author: Tim Janik <timj gnu org>
Date: Mon Sep 18 22:03:46 2017 +0200
BSE: use static_assert instead of a Rapicorn macro
Signed-off-by: Tim Janik <timj gnu org>
bse/bseblockutils.hh | 24 ++++++++++++------------
bse/bsecxxmodule.cc | 34 +++++++++++++++++-----------------
bse/bseloader-aiff.cc | 2 +-
bse/gsldatacache.cc | 2 +-
bse/gsldatahandle-mad.cc | 2 +-
docs/doxygen.cfg | 2 +-
6 files changed, 33 insertions(+), 33 deletions(-)
---
diff --git a/bse/bseblockutils.hh b/bse/bseblockutils.hh
index db58c2f..68935ab 100644
--- a/bse/bseblockutils.hh
+++ b/bse/bseblockutils.hh
@@ -174,8 +174,8 @@ Block::fill (guint n_values,
float *values,
float value)
{
- RAPICORN_STATIC_ASSERT (sizeof (float) == 4);
- RAPICORN_STATIC_ASSERT (sizeof (wchar_t) == 4);
+ static_assert (sizeof (float) == 4, "");
+ static_assert (sizeof (wchar_t) == 4, "");
const union { float f; guint32 vuint32; } u = { value };
wmemset ((wchar_t*) values, u.vuint32, n_values);
}
@@ -185,7 +185,7 @@ Block::fill (guint n_values,
guint32 *values,
guint32 value)
{
- RAPICORN_STATIC_ASSERT (sizeof (wchar_t) == 4);
+ static_assert (sizeof (wchar_t) == 4, "");
wmemset ((wchar_t*) values, value, n_values);
}
@@ -194,7 +194,7 @@ Block::copy (guint n_values,
guint32 *values,
const guint32 *ivalues)
{
- RAPICORN_STATIC_ASSERT (sizeof (wchar_t) == 4);
+ static_assert (sizeof (wchar_t) == 4, "");
wmemcpy ((wchar_t*) values, (const wchar_t*) ivalues, n_values);
}
@@ -203,8 +203,8 @@ Block::copy (guint n_values,
gfloat *values,
const gfloat *ivalues)
{
- RAPICORN_STATIC_ASSERT (sizeof (float) == 4);
- RAPICORN_STATIC_ASSERT (sizeof (wchar_t) == 4);
+ static_assert (sizeof (float) == 4, "");
+ static_assert (sizeof (wchar_t) == 4, "");
wmemcpy ((wchar_t*) values, (const wchar_t*) ivalues, n_values);
}
@@ -217,7 +217,7 @@ bse_block_fill_uint32 (guint n_values,
guint32 *values,
guint32 vuint32)
{
- RAPICORN_STATIC_ASSERT (sizeof (wchar_t) == 4);
+ static_assert (sizeof (wchar_t) == 4, "");
wmemset ((wchar_t*) values, vuint32, n_values);
}
@@ -226,9 +226,9 @@ bse_block_fill_float (guint n_values,
float *values,
const float value)
{
- RAPICORN_STATIC_ASSERT (sizeof (float) == 4);
+ static_assert (sizeof (float) == 4, "");
const union { float f; guint32 vuint32; } u = { value };
- RAPICORN_STATIC_ASSERT (sizeof (wchar_t) == 4);
+ static_assert (sizeof (wchar_t) == 4, "");
wmemset ((wchar_t*) values, u.vuint32, n_values);
}
@@ -237,7 +237,7 @@ bse_block_copy_uint32 (guint n_values,
guint32 *values,
const guint32 *ivalues)
{
- RAPICORN_STATIC_ASSERT (sizeof (wchar_t) == 4);
+ static_assert (sizeof (wchar_t) == 4, "");
wmemcpy ((wchar_t*) values, (const wchar_t*) ivalues, n_values);
}
@@ -246,8 +246,8 @@ bse_block_copy_float (guint n_values,
gfloat *values,
const gfloat *ivalues)
{
- RAPICORN_STATIC_ASSERT (sizeof (float) == 4);
- RAPICORN_STATIC_ASSERT (sizeof (wchar_t) == 4);
+ static_assert (sizeof (float) == 4, "");
+ static_assert (sizeof (wchar_t) == 4, "");
wmemcpy ((wchar_t*) values, (const wchar_t*) ivalues, n_values);
}
// == C++ Implementations ==
diff --git a/bse/bsecxxmodule.cc b/bse/bsecxxmodule.cc
index 1c34f1b..2b3980c 100644
--- a/bse/bsecxxmodule.cc
+++ b/bse/bsecxxmodule.cc
@@ -75,23 +75,23 @@ SynthesisModule::set_module (BseModule *engine_module)
intern_module = engine_module;
/* assert validity of the above casts */
- RAPICORN_STATIC_ASSERT (sizeof (JStream) == sizeof (BseJStream));
- RAPICORN_STATIC_ASSERT (offsetof (JStream, values) == offsetof (BseJStream, values));
- RAPICORN_STATIC_ASSERT (sizeof (((JStream*)0)->values) == sizeof (((BseJStream*)0)->values));
- RAPICORN_STATIC_ASSERT (offsetof (JStream, n_connections) == offsetof (BseJStream, n_connections));
- RAPICORN_STATIC_ASSERT (sizeof (((JStream*)0)->n_connections) == sizeof (((BseJStream*)0)->n_connections));
- RAPICORN_STATIC_ASSERT (offsetof (JStream, jcount) == offsetof (BseJStream, jcount));
- RAPICORN_STATIC_ASSERT (sizeof (((JStream*)0)->jcount) == sizeof (((BseJStream*)0)->jcount));
- RAPICORN_STATIC_ASSERT (sizeof (IStream) == sizeof (BseIStream));
- RAPICORN_STATIC_ASSERT (offsetof (IStream, values) == offsetof (BseIStream, values));
- RAPICORN_STATIC_ASSERT (sizeof (((IStream*)0)->values) == sizeof (((BseIStream*)0)->values));
- RAPICORN_STATIC_ASSERT (offsetof (IStream, connected) == offsetof (BseIStream, connected));
- RAPICORN_STATIC_ASSERT (sizeof (((IStream*)0)->connected) == sizeof (((BseIStream*)0)->connected));
- RAPICORN_STATIC_ASSERT (sizeof (OStream) == sizeof (BseOStream));
- RAPICORN_STATIC_ASSERT (offsetof (OStream, values) == offsetof (BseOStream, values));
- RAPICORN_STATIC_ASSERT (sizeof (((OStream*)0)->values) == sizeof (((BseOStream*)0)->values));
- RAPICORN_STATIC_ASSERT (offsetof (OStream, connected) == offsetof (BseOStream, connected));
- RAPICORN_STATIC_ASSERT (sizeof (((OStream*)0)->connected) == sizeof (((BseOStream*)0)->connected));
+ static_assert (sizeof (JStream) == sizeof (BseJStream), "");
+ static_assert (offsetof (JStream, values) == offsetof (BseJStream, values), "");
+ static_assert (sizeof (((JStream*)0)->values) == sizeof (((BseJStream*)0)->values), "");
+ static_assert (offsetof (JStream, n_connections) == offsetof (BseJStream, n_connections), "");
+ static_assert (sizeof (((JStream*)0)->n_connections) == sizeof (((BseJStream*)0)->n_connections), "");
+ static_assert (offsetof (JStream, jcount) == offsetof (BseJStream, jcount), "");
+ static_assert (sizeof (((JStream*)0)->jcount) == sizeof (((BseJStream*)0)->jcount), "");
+ static_assert (sizeof (IStream) == sizeof (BseIStream), "");
+ static_assert (offsetof (IStream, values) == offsetof (BseIStream, values), "");
+ static_assert (sizeof (((IStream*)0)->values) == sizeof (((BseIStream*)0)->values), "");
+ static_assert (offsetof (IStream, connected) == offsetof (BseIStream, connected), "");
+ static_assert (sizeof (((IStream*)0)->connected) == sizeof (((BseIStream*)0)->connected), "");
+ static_assert (sizeof (OStream) == sizeof (BseOStream), "");
+ static_assert (offsetof (OStream, values) == offsetof (BseOStream, values), "");
+ static_assert (sizeof (((OStream*)0)->values) == sizeof (((BseOStream*)0)->values), "");
+ static_assert (offsetof (OStream, connected) == offsetof (BseOStream, connected), "");
+ static_assert (sizeof (((OStream*)0)->connected) == sizeof (((BseOStream*)0)->connected), "");
}
void
SynthesisModule::ostream_set (uint ostream_index,
diff --git a/bse/bseloader-aiff.cc b/bse/bseloader-aiff.cc
index 4e069ad..cae034c 100644
--- a/bse/bseloader-aiff.cc
+++ b/bse/bseloader-aiff.cc
@@ -207,7 +207,7 @@ aiff_read_inst (int fd,
guint32 chunk_size)
{
int r;
- RAPICORN_STATIC_ASSERT (sizeof (afile->instrument) == 20);
+ static_assert (sizeof (afile->instrument) == 20, "");
if (chunk_size < 20)
return Bse::Error::FORMAT_INVALID;
do
diff --git a/bse/gsldatacache.cc b/bse/gsldatacache.cc
index f95feab..276cb3f 100644
--- a/bse/gsldatacache.cc
+++ b/bse/gsldatacache.cc
@@ -57,7 +57,7 @@ _gsl_init_data_caches (void)
static gboolean initialized = FALSE;
assert_return (initialized == FALSE);
initialized++;
- RAPICORN_STATIC_ASSERT (AGE_EPSILON < LOW_PERSISTENCY_RESIDENT_SET);
+ static_assert (AGE_EPSILON < LOW_PERSISTENCY_RESIDENT_SET, "");
}
GslDataCache*
gsl_data_cache_new (GslDataHandle *dhandle,
diff --git a/bse/gsldatahandle-mad.cc b/bse/gsldatahandle-mad.cc
index 1593a53..1e50325 100644
--- a/bse/gsldatahandle-mad.cc
+++ b/bse/gsldatahandle-mad.cc
@@ -15,7 +15,7 @@
#define MDEBUG(...) Bse::debug ("mad", __VA_ARGS__)
-RAPICORN_STATIC_ASSERT (BSE_HAVE_LIBMAD > 0); // ensure we can use libmad
+static_assert (BSE_HAVE_LIBMAD > 0, ""); // ensure we can use libmad
#if BSE_HAVE_LIBMAD
#include <mad.h>
diff --git a/docs/doxygen.cfg b/docs/doxygen.cfg
index 9fb8f93..b7c1e70 100644
--- a/docs/doxygen.cfg
+++ b/docs/doxygen.cfg
@@ -45,7 +45,7 @@ ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = YES
PREDEFINED = DOXYGEN BSE_CONVENIENCE __SIZEOF_LONG__=8
-PREDEFINED += static_assert(x,y)= RAPICORN_STATIC_ASSERT(x)= RAPICORN_STARTUP_ASSERT(x)=
+PREDEFINED += static_assert(x,y)= RAPICORN_STARTUP_ASSERT(x)=
PREDEFINED += "record=struct" "sequence=struct" "RAPICORN_PIXBUF_TYPE=Pixbuf" "G_BEGIN_DECLS=" "G_END_DECLS="
PREDEFINED += "__attribute__(x)=" RAPICORN_CONST= RAPICORN_NORETURN= RAPICORN_NOINLINE= RAPICORN_PRINTF(x,y)=
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]