diff --git a/fw/coroutine.h b/fw/coroutine.h index 9e6af9e..7a79a10 100644 --- a/fw/coroutine.h +++ b/fw/coroutine.h @@ -113,6 +113,18 @@ */ +#if defined(__GNUC__) && !defined(__STRICT_ANSI__) + // GCC: the extension is always present unless strict ANSI mode is forced. + // (Even with -pedantic it still works, just warns.) + #define HAVE_LABELS_AS_VALUES 1 +#elif __has_extension(c_labels_as_values) + #define HAVE_LABELS_AS_VALUES 1 +#else + #define HAVE_LABELS_AS_VALUES 0 +#endif + +_Static_assert(HAVE_LABELS_AS_VALUES, "This library requires the GNU C 'labels as values' extension"); + // Useful macros #define CORO_CONCAT2(s1, s2) s1##s2 #define CORO_CONCAT(s1, s2) CORO_CONCAT2(s1, s2) diff --git a/fw/main.c b/fw/main.c index c6aba2a..4f1112a 100644 --- a/fw/main.c +++ b/fw/main.c @@ -10,6 +10,7 @@ #include "sc7a20.h" #include "pd.h" #include "fpmath.h" +#include "coroutine.h" // constants