Bionic: Always use fortified versions of FD_X macros

When compiling on/for at least Lollipop, always use the fortified
versions of FD_X macros. This works around side-effect issues (which
are explicitly called out in the specification) and generally
increases robustness of code.

Bug: 77986327
Test: mmma bionic
Test: m
Test: bionic_unit_tests
Change-Id: I9096c6872770e46ba5ab64e7375ff83fc0518e07
diff --git a/libc/include/sys/cdefs.h b/libc/include/sys/cdefs.h
index 5760689..201f40a 100644
--- a/libc/include/sys/cdefs.h
+++ b/libc/include/sys/cdefs.h
@@ -289,14 +289,22 @@
 #  endif
 #endif
 
+// As we move some FORTIFY checks to be always on, __bos needs to be
+// always available.
 #if defined(__BIONIC_FORTIFY)
 #  if _FORTIFY_SOURCE == 2
 #    define __bos_level 1
 #  else
 #    define __bos_level 0
 #  endif
-#  define __bosn(s, n) __builtin_object_size((s), (n))
-#  define __bos(s) __bosn((s), __bos_level)
+#else
+#  define __bos_level 0
+#endif
+
+#define __bosn(s, n) __builtin_object_size((s), (n))
+#define __bos(s) __bosn((s), __bos_level)
+
+#if defined(__BIONIC_FORTIFY)
 #  define __bos0(s) __bosn((s), 0)
 #  if defined(__clang__)
 #    define __pass_object_size_n(n) __attribute__((pass_object_size(n)))