shithub: opus

Download patch

ref: ed90cdc36903796752a89a789ef21f38306f230f
parent: 657dea717ea4596a6fb98d42483a5e6cc86ebafd
author: Ralph Giles <[email protected]>
date: Fri Oct 28 02:55:30 EDT 2011

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.

--- a/tests/test_opus_api.c
+++ b/tests/test_opus_api.c
@@ -1160,6 +1160,14 @@
 }
 
 #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
 
@@ -1244,6 +1252,10 @@
    return cfgs;
 #endif
 }
+
+#ifdef MALLOC_FAIL
+#pragma GCC diagnostic pop /* restore -Wdeprecated-declarations */
+#endif
 
 int main(int _argc, char **_argv)
 {