From 841f17b59aac1c6d273f7e053243e6aaf29dc3c4 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 29 Aug 2015 23:01:31 +0200 Subject: add _PORTABLE_SOURCE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- README | 9 +++++++++ include/alloca.h | 2 ++ include/assert.h | 2 ++ include/err.h | 2 ++ include/errno.h | 2 ++ 5 files changed, 17 insertions(+) diff --git a/README b/README index 9475965..35fe6d2 100644 --- a/README +++ b/README @@ -5,3 +5,12 @@ slibc does not aim to support C++, or any other language than C. Furthermore, it does not try to support older versions of C than C99. + +Macro definitions: + + _SLIBC_SOURCE -- Enable slibc extensions. + _GNU_SOURCE -- Enable glibc extensions (GNU extensions.) + _SLIBC_SUPPRESS_WARNINGS -- Suppress all #warning, this is primarily + intended to be used when compiling slibc. + _PORTABLE_SOURCE -- Unconditionally disable all extensions. + diff --git a/include/alloca.h b/include/alloca.h index fe70c36..76e027f 100644 --- a/include/alloca.h +++ b/include/alloca.h @@ -17,6 +17,7 @@ */ #ifndef _ALLOCA_H #define _ALLOCA_H +#ifndef _PORTABLE_SOURCE #include @@ -47,5 +48,6 @@ void* alloca(size_t size); +#endif #endif diff --git a/include/assert.h b/include/assert.h index 763b7b4..12d4678 100644 --- a/include/assert.h +++ b/include/assert.h @@ -58,6 +58,7 @@ #define static_assert _Static_assert +#ifndef _PORTABLE_SOURCE /** * Unless `NDEBUG` is defined, print an error message * and abort the process, if `errnum` is non-zero. @@ -90,6 +91,7 @@ */ void __assert_fail(const char* expression, int errnum, const char* file, int line, const char* func) __noreturn __GCC_ONLY(__attribute__((nonnull(3, 4, 5)))); +#endif diff --git a/include/err.h b/include/err.h index 9eb01f3..2599feb 100644 --- a/include/err.h +++ b/include/err.h @@ -17,6 +17,7 @@ */ #ifndef _ERR_H #define _ERR_H +#fifndef _PORTABLE_SOURCE #include #ifndef _SLIBC_SUPPRESS_WARNINGS @@ -116,4 +117,5 @@ void verrx(int status, const char* format, va_list args) #endif +#endif diff --git a/include/errno.h b/include/errno.h index 0b6232f..0415cfb 100644 --- a/include/errno.h +++ b/include/errno.h @@ -41,6 +41,7 @@ volatile int* __errno(void) __GCC_ONLY(__attribute__((__const__))); /* TODO not implemented */ +#ifndef _PORTABLE_SOURCE /** * This is the name that was used to invoke the program * running in the current process. This is the value @@ -74,6 +75,7 @@ extern char* program_invocation_name; /* TODO not implemented */ #if defined(_GNU_SOURCE) extern char* program_invocation_short_name; /* TODO not implemented */ #endif +#endif -- cgit v1.2.3-70-g09d2