File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3131// Warnings! Located here so they will appear just once in the build output.
3232//
3333
34+ // static_warning works like a static_assert but only emits a (messy) warning.
35+ #ifdef __GNUC__
36+ namespace mfwarn {
37+ struct true_type {};
38+ struct false_type {};
39+ template <int test> struct converter : public true_type {};
40+ template <> struct converter <0 > : public false_type {};
41+ }
42+ #define static_warning (cond, msg ) \
43+ struct CAT (static_warning, __LINE__) { \
44+ void _ (::mfwarn::false_type const &) __attribute__ ((deprecated (msg))) {}; \
45+ void _ (::mfwarn::true_type const &) {}; \
46+ CAT (static_warning, __LINE__)() {_ (::mfwarn::converter<(cond)>());} \
47+ }
48+ #else
49+ #define static_warning (...)
50+ #endif
51+
3452#if ENABLED(MARLIN_DEV_MODE)
3553 #warning "WARNING! Disable MARLIN_DEV_MODE for the final build!"
3654 #ifdef __LONG_MAX__
You canβt perform that action at this time.
0 commit comments