aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-08-29 23:01:31 +0200
committerMattias Andrée <maandree@operamail.com>2015-08-29 23:01:31 +0200
commit841f17b59aac1c6d273f7e053243e6aaf29dc3c4 (patch)
tree8189aa40f8b26d7a22529937235cd6b95615e90c
parentadd err.h + add _SLIBC_SUPPRESS_WARNINGS (diff)
downloadslibc-841f17b59aac1c6d273f7e053243e6aaf29dc3c4.tar.gz
slibc-841f17b59aac1c6d273f7e053243e6aaf29dc3c4.tar.bz2
slibc-841f17b59aac1c6d273f7e053243e6aaf29dc3c4.tar.xz
add _PORTABLE_SOURCE
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r--README9
-rw-r--r--include/alloca.h2
-rw-r--r--include/assert.h2
-rw-r--r--include/err.h2
-rw-r--r--include/errno.h2
5 files changed, 17 insertions, 0 deletions
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 <slibc/version.h>
@@ -48,4 +49,5 @@ 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 <slibc/version.h>
#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