Merge "Add a compile-time warning for malloc_usable_size() with _FORTIFY_SOURCE=3." into main am: da5c77dc03 am: 07ec41fef1

Original change: https://android-review.googlesource.com/c/platform/bionic/+/3539499

Change-Id: I8e172364d83546393bdbf450caf58a774a06ec49
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/libc/include/malloc.h b/libc/include/malloc.h
index ba68401..bb4916a 100644
--- a/libc/include/malloc.h
+++ b/libc/include/malloc.h
@@ -122,7 +122,11 @@
  * [malloc_usable_size(3)](https://man7.org/linux/man-pages/man3/malloc_usable_size.3.html)
  * returns the actual size of the given heap block.
  */
-__nodiscard size_t malloc_usable_size(const void* _Nullable __ptr);
+__nodiscard size_t malloc_usable_size(const void* _Nullable __ptr)
+#if defined(_FORTIFY_SOURCE)
+    __clang_error_if(_FORTIFY_SOURCE == 3, "malloc_usable_size() and _FORTIFY_SOURCE=3 are incompatible")
+#endif
+;
 
 #define __MALLINFO_BODY \
   /** Total number of non-mmapped bytes currently allocated from OS. */ \