File tree 1 file changed +18
-0
lines changed
1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 31
31
// Warnings! Located here so they will appear just once in the build output.
32
32
//
33
33
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
+
34
52
#if ENABLED(MARLIN_DEV_MODE)
35
53
#warning "WARNING! Disable MARLIN_DEV_MODE for the final build!"
36
54
#ifdef __LONG_MAX__
You canβt perform that action at this time.
0 commit comments