Update library/constant_time_impl.h

Co-authored-by: Dave Rodgman <dave.rodgman@arm.com>
Signed-off-by: Matthias Schulz <140500342+mschulz-at-hilscher@users.noreply.github.com>
diff --git a/library/constant_time_impl.h b/library/constant_time_impl.h
index 821e7cf..08b2f6d 100644
--- a/library/constant_time_impl.h
+++ b/library/constant_time_impl.h
@@ -546,7 +546,7 @@
     return (mbedtls_ct_condition_t) (~x);
 }
 
-#if __GNUC__ > 4
+#if defined(MBEDTLS_COMPILER_IS_GCC) && (__GNUC__ > 4)
 /* Restore warnings for -Wredundant-decls on gcc */
     #pragma GCC diagnostic pop
 #endif