diff --git a/tests/test_opus_api.c b/tests/test_opus_api.c
index 1bc26ff0e3de11f45e2e60239199106a2a935dd5..76ae3b1641cc023a54197f9983cb774f6dac5565 100644
--- a/tests/test_opus_api.c
+++ b/tests/test_opus_api.c
@@ -49,6 +49,7 @@
 #include <stdlib.h>
 #include <stdint.h>
 #include <string.h>
+#include "arch.h"
 #include "../include/opus.h"
 #include "test_opus_common.h"
 
@@ -1167,7 +1168,7 @@ int test_repacketizer_api(void)
  * handling in our codebase, and the lack of thread saftey isn't an
  * issue here. We therefore disable the warning for this function.
  */
-#if defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 6
+#if defined(__GNUC_PREREQ) && __GNUC_PREREQ(4,6)
 /* Save the current warning settings */
 #pragma GCC diagnostic push
 #endif
@@ -1259,7 +1260,7 @@ int test_malloc_fail(void)
 }
 
 #ifdef MALLOC_FAIL
-#if defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 6
+#if defined(__GNUC_PREREQ) && __GNUC_PREREQ(4,6)
 /* Restore the previous warning settings */
 #pragma GCC diagnostic pop /* restore -Wdeprecated-declarations */
 #endif