diff --git a/libc/Makefile b/libc/Makefile index ede4fc3a..a2bd6c7e 100644 --- a/libc/Makefile +++ b/libc/Makefile @@ -10,7 +10,7 @@ endif CPUDIR:=$(CPU) CPPINCLUDES=-I preproc -CPPFLAGS=-DLIBC_LIBRARY $(CPPINCLUDES) +CPPFLAGS=-D__is_sortix_libc=1 $(CPPINCLUDES) FLAGS=-Wall -Wextra $(OPTLEVEL) CFLAGS=-std=gnu99 CXXFLAGS=-std=gnu++11 -fno-exceptions -fno-rtti diff --git a/libc/include/features.h b/libc/include/features.h index 1f2dd038..f4fd6611 100644 --- a/libc/include/features.h +++ b/libc/include/features.h @@ -52,7 +52,7 @@ #endif /* Sortix system components implicitly use the native API. */ -#if defined(LIBC_LIBRARY) || defined(SORTIX_KERNEL) +#if __is_sortix_libc || defined(SORTIX_KERNEL) #define _SORTIX_SOURCE 1 #endif @@ -90,7 +90,7 @@ #endif /* Provide the restrict keyword when building the C library. */ -#if !__HAS_RESTRICT && defined(LIBC_LIBRARY) +#if !__HAS_RESTRICT && defined(__is_sortix_libc) #define restrict __restrict #undef __HAS_RESTRICT #define __HAS_RESTRICT 2 diff --git a/libc/include/stdint.h b/libc/include/stdint.h index 437d83a8..23528829 100644 --- a/libc/include/stdint.h +++ b/libc/include/stdint.h @@ -32,7 +32,7 @@ __BEGIN_DECLS /* Only define these constant macros in C++ if requested. */ #if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) || \ - defined(LIBC_LIBRARY) || defined(SORTIX_KERNEL) /* TODO: HACK! */ + defined(__is_sortix_libc) || defined(SORTIX_KERNEL) /* TODO: HACK! */ #define INT8_C(c) __INT8_C(c) #define INT16_C(c) __INT16_C(c) @@ -51,7 +51,7 @@ __BEGIN_DECLS /* Only define these limit macros in C++ if requested. */ #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) || \ - defined(LIBC_LIBRARY) || defined(SORTIX_KERNEL) /* TODO: HACK! */ + defined(__is_sortix_libc) || defined(SORTIX_KERNEL) /* TODO: HACK! */ #define INT8_MIN __INT8_MIN #define INT16_MIN __INT16_MIN diff --git a/libc/include/stdio.h b/libc/include/stdio.h index 493e6093..370e8e5a 100644 --- a/libc/include/stdio.h +++ b/libc/include/stdio.h @@ -177,7 +177,7 @@ int fcloseall(void); int fshutdown(FILE* fp); int fpipe(FILE* pipes[2]); /* Internally used by standard library. */ -#if defined(LIBC_LIBRARY) +#if defined(__is_sortix_libc) extern FILE* _firstfile; #endif #endif diff --git a/sortix/include/sortix/__/types.h b/sortix/include/sortix/__/types.h index e89cb510..7e6bde0e 100644 --- a/sortix/include/sortix/__/types.h +++ b/sortix/include/sortix/__/types.h @@ -57,10 +57,10 @@ typedef int __ssize_t; typedef __uintptr_t __timer_t; typedef __SIZE_TYPE__ __socklen_t; -#if defined(SORTIX_KERNEL) || defined(LIBC_LIBRARY) +#if defined(SORTIX_KERNEL) || defined(__is_sortix_libc) #define OFF_MIN __OFF_MIN #endif -#if defined(SORTIX_KERNEL) || defined(LIBC_LIBRARY) +#if defined(SORTIX_KERNEL) || defined(__is_sortix_libc) #define OFF_MAX __OFF_MAX #endif