Unit tests for formatting code, fix %%.

Also fix <signal.h> and <stdio.h> so they don't cause compiler warnings.

Change-Id: Ib1a746bf01de22d47dbd964de0e6af80a7c96303
diff --git a/libc/include/signal.h b/libc/include/signal.h
index 0770b0f..8c9b170 100644
--- a/libc/include/signal.h
+++ b/libc/include/signal.h
@@ -59,7 +59,7 @@
 
 static __inline__ int sigismember(const sigset_t* set, int signum) {
   int bit = signum - 1; // Signal numbers start at 1, but bit positions start at 0.
-  if (set == NULL || bit < 0 || bit >= 8*sizeof(sigset_t)) {
+  if (set == NULL || bit < 0 || bit >= (int) (8*sizeof(sigset_t))) {
     errno = EINVAL;
     return -1;
   }
@@ -69,7 +69,7 @@
 
 static __inline__ int sigaddset(sigset_t* set, int signum) {
   int bit = signum - 1; // Signal numbers start at 1, but bit positions start at 0.
-  if (set == NULL || bit < 0 || bit >= 8*sizeof(sigset_t)) {
+  if (set == NULL || bit < 0 || bit >= (int) (8*sizeof(sigset_t))) {
     errno = EINVAL;
     return -1;
   }
@@ -80,7 +80,7 @@
 
 static __inline__ int sigdelset(sigset_t* set, int signum) {
   int bit = signum - 1; // Signal numbers start at 1, but bit positions start at 0.
-  if (set == NULL || bit < 0 || bit >= 8*sizeof(sigset_t)) {
+  if (set == NULL || bit < 0 || bit >= (int) (8*sizeof(sigset_t))) {
     errno = EINVAL;
     return -1;
   }
diff --git a/libc/include/stdio.h b/libc/include/stdio.h
index cd04d9c..62882db 100644
--- a/libc/include/stdio.h
+++ b/libc/include/stdio.h
@@ -523,13 +523,13 @@
 
     // Compiler can prove, at compile time, that the passed in size
     // is always <= the actual object size. Don't call __fgets_chk
-    if (__builtin_constant_p(size) && (size <= bos)) {
+    if (__builtin_constant_p(size) && (size <= (int) bos)) {
         return __fgets_real(dest, size, stream);
     }
 
     // Compiler can prove, at compile time, that the passed in size
     // is always > the actual object size. Force a compiler error.
-    if (__builtin_constant_p(size) && (size > bos)) {
+    if (__builtin_constant_p(size) && (size > (int) bos)) {
         __fgets_too_big_error();
     }