util/Cast: reimplement as template without macro

This commit is contained in:
Max Kellermann
2014-07-14 16:24:07 +02:00
parent f8da8b0261
commit 7a1f3177c9
3 changed files with 33 additions and 16 deletions

View File

@@ -152,19 +152,13 @@ public:
HttpdOutput(EventLoop &_loop);
~HttpdOutput();
#if GCC_CHECK_VERSION(4,6) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
#if defined(__clang__) || GCC_CHECK_VERSION(4,7)
constexpr
#endif
static constexpr HttpdOutput *Cast(AudioOutput *ao) {
return ContainerCast(ao, HttpdOutput, base);
static HttpdOutput *Cast(AudioOutput *ao) {
return &ContainerCast(*ao, &HttpdOutput::base);
}
#if GCC_CHECK_VERSION(4,6) || defined(__clang__)
#pragma GCC diagnostic pop
#endif
using DeferredMonitor::GetEventLoop;
bool Init(const config_param &param, Error &error);