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/pthread.c b/libc/bionic/pthread.c
index 8eee136..061cce1 100644
--- a/libc/bionic/pthread.c
+++ b/libc/bionic/pthread.c
@@ -48,6 +48,7 @@
 #include <sys/prctl.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <stdio.h>
 
 extern int  __pthread_clone(int (*fn)(void*), void *child_stack, int flags, void *arg);
 extern void _exit_with_stack_teardown(void * stackBase, int stackSize, int retCode);