From ed90cdc36903796752a89a789ef21f38306f230f Mon Sep 17 00:00:00 2001
From: Ralph Giles <giles@thaumas.net>
Date: Fri, 28 Oct 2011 06:55:30 -0700
Subject: [PATCH] Disable the deprecated function warning on __malloc_hook.

This just works around the deprecation in glibc 2.14. I
do worry what will happen if they follow through and
remove it in 2.15.
---
 tests/test_opus_api.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/tests/test_opus_api.c b/tests/test_opus_api.c
index 6f91a796a..2a451e453 100644
--- a/tests/test_opus_api.c
+++ b/tests/test_opus_api.c
@@ -1160,6 +1160,14 @@ int test_repacketizer_api(void)
 }
 
 #ifdef MALLOC_FAIL
+/* GLIBC 2.14 declares __malloc_hook as deprecated, generating a warning
+ * under GCC. However, this is the cleanest way to test malloc failure
+ * handling in our codebase, and the lack of thread saftey isn't an
+ * issue here. We therefore disable the warning for this function.
+ */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
 typedef void *(*mhook)(size_t __size, __const __malloc_ptr_t);
 #endif
 
@@ -1245,6 +1253,10 @@ int test_malloc_fail(void)
 #endif
 }
 
+#ifdef MALLOC_FAIL
+#pragma GCC diagnostic pop /* restore -Wdeprecated-declarations */
+#endif
+
 int main(int _argc, char **_argv)
 {
    opus_int32 total;
-- 
GitLab