Remove compiler warnings when building Bionic.

Also add missing declarations to misc. functions.
Fix clearerr() implementation (previous was broken).
Handle feature test macros like _POSIX_C_SOURCE properly.

Change-Id: Icdc973a6b9d550a166fc2545f727ea837fe800c4
diff --git a/libc/bionic/clearenv.c b/libc/bionic/clearenv.c
index ffc58d9..0f6f066 100644
--- a/libc/bionic/clearenv.c
+++ b/libc/bionic/clearenv.c
@@ -26,14 +26,17 @@
  * SUCH DAMAGE.
  */
 
+#include <stddef.h>
+
 extern char** environ;
 
 int clearenv(void)
 {
-	char **P = environ;
-	int offset;
+    char **P = environ;
 
-	for (P = &environ[offset]; *P; ++P)
-		*P = 0;
-        return 0;
+    if (P != NULL) {
+        for (; *P; ++P)
+            *P = NULL;
+    }
+    return 0;
 }