diff --git a/LibC/assert.h b/LibC/assert.h index 36be4b57f0..9420363bba 100644 --- a/LibC/assert.h +++ b/LibC/assert.h @@ -4,7 +4,7 @@ __BEGIN_DECLS -[[noreturn]] void __assertion_failed(const char* msg, const char* file, unsigned line, const char* func); +__attribute__((noreturn)) void __assertion_failed(const char* msg, const char* file, unsigned line, const char* func); #define assert(expr) ((expr) ? (void)0 : __assertion_failed(#expr, __FILE__, __LINE__, __PRETTY_FUNCTION__)) #define CRASH() do { asm volatile("ud2"); } while(0) diff --git a/LibC/ctype.h b/LibC/ctype.h index f3ac9d2218..41178f5cb4 100644 --- a/LibC/ctype.h +++ b/LibC/ctype.h @@ -4,41 +4,41 @@ __BEGIN_DECLS -[[gnu::always_inline]] inline int isascii(int ch) +ALWAYS_INLINE int isascii(int ch) { return (ch & ~0x7f) == 0; } -[[gnu::always_inline]] inline int isspace(int ch) +ALWAYS_INLINE int isspace(int ch) { return ch == ' ' || ch == '\f' || ch == '\n' || ch == '\r' || ch == '\t' || ch == '\v'; } -[[gnu::always_inline]] inline int islower(int c) +ALWAYS_INLINE int islower(int c) { return c >= 'a' && c <= 'z'; } -[[gnu::always_inline]] inline int isupper(int c) +ALWAYS_INLINE int isupper(int c) { return c >= 'A' && c <= 'Z'; } -[[gnu::always_inline]] inline int tolower(int c) +ALWAYS_INLINE int tolower(int c) { if (isupper(c)) return c | 0x20; return c; } -[[gnu::always_inline]] inline int toupper(int c) +ALWAYS_INLINE int toupper(int c) { if (islower(c)) return c & ~0x20; return c; } -[[gnu::always_inline]] inline int isdigit(int c) +ALWAYS_INLINE int isdigit(int c) { return c >= '0' && c <= '9'; } diff --git a/LibC/stdlib.h b/LibC/stdlib.h index 064ce160f6..efca85b68c 100644 --- a/LibC/stdlib.h +++ b/LibC/stdlib.h @@ -9,16 +9,16 @@ __BEGIN_DECLS #define EXIT_FAILURE 1 #define MB_CUR_MAX 1 -[[gnu::malloc, gnu::alloc_size(1)]] void* malloc(size_t); -[[gnu::malloc, gnu::alloc_size(1, 2)]] void* calloc(size_t nmemb, size_t); +__attribute__((malloc)) __attribute__((alloc_size(1))) void* malloc(size_t); +__attribute__((malloc)) __attribute__((alloc_size(1, 2))) void* calloc(size_t nmemb, size_t); void free(void*); void* realloc(void *ptr, size_t); char* getenv(const char* name); int atoi(const char*); long atol(const char*); void qsort(void* base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)); -[[noreturn]] void exit(int status); -[[noreturn]] void abort(); +__attribute__((noreturn)) void exit(int status); +__attribute__((noreturn)) void abort(); char* ptsname(int fd); int ptsname_r(int fd, char* buffer, size_t); int abs(int); diff --git a/LibC/sys/cdefs.h b/LibC/sys/cdefs.h index 9fcd9b1682..0d558557fd 100644 --- a/LibC/sys/cdefs.h +++ b/LibC/sys/cdefs.h @@ -2,6 +2,8 @@ #define _POSIX_VERSION 200809L +#define ALWAYS_INLINE inline __attribute__((always_inline)) + #ifdef __cplusplus #define __BEGIN_DECLS extern "C" { #define __END_DECLS }