2014-03-01 01:35:24 +00:00
|
|
|
/*=============================================================================
|
2019-01-07 08:47:17 +00:00
|
|
|
Copyright (c) 2011-2019 Bolero MURAKAMI
|
2014-03-01 01:35:24 +00:00
|
|
|
https://github.com/bolero-MURAKAMI/Sprout
|
|
|
|
|
|
|
|
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
=============================================================================*/
|
|
|
|
#ifndef SPROUT_STATIC_WARNING_HPP
|
|
|
|
#define SPROUT_STATIC_WARNING_HPP
|
|
|
|
|
|
|
|
#include <sprout/config.hpp>
|
|
|
|
|
|
|
|
namespace sprout {
|
|
|
|
//
|
|
|
|
// static_warning
|
|
|
|
//
|
|
|
|
template<bool C>
|
|
|
|
struct static_warning;
|
|
|
|
template<>
|
|
|
|
struct static_warning<true> {
|
|
|
|
template<typename Message>
|
|
|
|
static void warn() {}
|
|
|
|
};
|
2016-04-04 17:49:50 +00:00
|
|
|
template<>
|
2014-03-01 01:35:24 +00:00
|
|
|
struct static_warning<false> {
|
|
|
|
template<typename Message>
|
|
|
|
static void warn() {
|
|
|
|
Message static_warning_failed;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
} // namespace sprout
|
|
|
|
|
|
|
|
//
|
|
|
|
// SPROUT_STATIC_WARNING
|
|
|
|
//
|
2014-08-14 13:55:49 +00:00
|
|
|
#define SPROUT_STATIC_WARNING_IMPL_2(COND, MSG, LINE) \
|
|
|
|
struct sprout_static_warning_line_ ## LINE { \
|
|
|
|
struct MSG {}; \
|
|
|
|
sprout_static_warning_line_ ## LINE() { \
|
|
|
|
::sprout::static_warning<(COND)>:: \
|
|
|
|
warn<void***** (MSG::*****)()>(); \
|
2014-03-01 01:35:24 +00:00
|
|
|
} \
|
|
|
|
}
|
2014-08-14 13:55:49 +00:00
|
|
|
#define SPROUT_STATIC_WARNING_IMPL(COND, MSG) \
|
|
|
|
SPROUT_STATIC_WARNING_IMPL_2(COND, MSG, __LINE__)
|
|
|
|
#define SPROUT_STATIC_WARNING(COND) \
|
|
|
|
SPROUT_STATIC_WARNING_IMPL(COND, static_warning_failed)
|
2014-03-01 01:35:24 +00:00
|
|
|
|
|
|
|
#endif // #ifndef SPROUT_STATIC_WARNING_HPP
|