libc: add clang FORTIFY support

This patch adds clang-style FORTIFY to Bionic. For more information on
FORTIFY, please see https://goo.gl/8HS2dW . This implementation works
for versions of clang that don't support diagnose_if, so please see the
"without diagnose_if" sections. We plan to swap to a diagnose_if-based
FORTIFY later this year (since it doesn't really add any features; it
just simplifies the implementation a lot, and it gives us much prettier
diagnostics)

Bug: 32073964
Test: Builds on angler, bullhead, marlin, sailfish. Bionic CTS tests
pass on Angler and Bullhead.

Change-Id: I607aecbeee81529709b1eee7bef5b0836151eb2b
diff --git a/tests/Android.mk b/tests/Android.mk
index b65b456..24ff7f2 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -77,7 +77,7 @@
 LOCAL_MODULE := bionic-compile-time-tests-g++
 LOCAL_CPPFLAGS := -Wall
 # Disable color diagnostics so the warnings output matches the source
-LOCAL_CPPFLAGS +=  -fdiagnostics-color=never
+LOCAL_CPPFLAGS += -fdiagnostics-color=never
 LOCAL_SRC_FILES := fortify_compilation_test.cpp
 include $(BUILD_STATIC_LIBRARY)
 
@@ -95,11 +95,8 @@
 LOCAL_CLANG := true
 LOCAL_MODULE := bionic-compile-time-tests-clang++
 LOCAL_CPPFLAGS := -Wall
-# Disable color diagnostics so the warnings output matches the source
-LOCAL_CPPFLAGS += -fno-color-diagnostics
-# FileCheck will error if there aren't any CLANG: lines in the file, but there
-# don't appear to be any cases where clang _does_ emit warnings for sn?printf :(
-LOCAL_SRC_FILES :=
+LOCAL_CPPFLAGS += -fno-color-diagnostics -ferror-limit=10000
+LOCAL_SRC_FILES := fortify_compilation_test.cpp
 include $(BUILD_STATIC_LIBRARY)
 
 endif # linux-x86