Files
RedBear-OS/tests/features.c
T
Red Bear OS 1b3e94a20d Red Bear OS relibc baseline
From release 0.1.0 pre-patched archive.
This includes all Red Bear modifications previously maintained
as patches in local/patches/relibc/.
2026-06-27 09:19:26 +03:00

51 lines
1.3 KiB
C

// These tests are primarily to ensure the macros compile without
// causing any funny business.
// TODO: does not compile with glibc
#include <features.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#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;
}