🧑💻 "static_warning"
This commit is contained in:
parent
a3c78c4510
commit
0829a511f0
|
@ -31,6 +31,24 @@
|
||||||
// Warnings! Located here so they will appear just once in the build output.
|
// Warnings! Located here so they will appear just once in the build output.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
// static_warning works like a static_assert but only emits a (messy) warning.
|
||||||
|
#ifdef __GNUC__
|
||||||
|
namespace mfwarn {
|
||||||
|
struct true_type {};
|
||||||
|
struct false_type {};
|
||||||
|
template <int test> struct converter : public true_type {};
|
||||||
|
template <> struct converter<0> : public false_type {};
|
||||||
|
}
|
||||||
|
#define static_warning(cond, msg) \
|
||||||
|
struct CAT(static_warning, __LINE__) { \
|
||||||
|
void _(::mfwarn::false_type const&) __attribute__((deprecated(msg))) {}; \
|
||||||
|
void _(::mfwarn::true_type const&) {}; \
|
||||||
|
CAT(static_warning, __LINE__)() {_(::mfwarn::converter<(cond)>());} \
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#define static_warning(...)
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ENABLED(MARLIN_DEV_MODE)
|
#if ENABLED(MARLIN_DEV_MODE)
|
||||||
#warning "WARNING! Disable MARLIN_DEV_MODE for the final build!"
|
#warning "WARNING! Disable MARLIN_DEV_MODE for the final build!"
|
||||||
#ifdef __LONG_MAX__
|
#ifdef __LONG_MAX__
|
||||||
|
|
Loading…
Reference in a new issue