// These tests are primarily to ensure the macros compile without // causing any funny business. // TODO: does not compile with glibc #include #include #include #include #ifndef __GLIBC__ __deprecated #endif static void legacy(void) {} #ifndef __GLIBC__ __deprecatedNote("Sometimes deletes user's home (oops); use foobar") #endif static void legacy_notes(void) {} #ifndef __GLIBC__ __nodiscard #endif static uint8_t the_answer(void) { return 42; } // GCC bug /* #pragma GCC diagnostic push */ /* #pragma GCC diagnostic ignored "-Wattributes" */ /* __noreturn */ /* static void foobar(void) { */ // The test suite isn't picking up noreturn in the headers for exit, abort // Those functions (and this test) works fine in both Redox itself and Linux // Using _Exit instead works for the tests in CI. Why? I dunno. /* _Exit(0); */ /* } */ /* #pragma GCC diagnostic pop */ int main(void) { #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" legacy(); legacy_notes(); #pragma GCC diagnostic pop const int answer = the_answer(); char buf[40] = {0}; sprintf(buf, "Hey, -Werror, I'm using answer: %d\n", answer); /* foobar(); */ return 0; }