Index: extensions/app_diameap/diameap_tls.h
===================================================================
--- extensions/app_diameap/diameap_tls.h	(revision 1033)
+++ extensions/app_diameap/diameap_tls.h	(revision 1034)
@@ -40,10 +40,26 @@
 #define DIAMEAP_TLS_H_
 
+ #if defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 405
+# define GCC_DIAG_DO_PRAGMA(x) _Pragma (#x)
+# define GCC_DIAG_PRAGMA(x) GCC_DIAG_DO_PRAGMA(GCC diagnostic x)
+# if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406
+#  define GCC_DIAG_OFF(x) GCC_DIAG_PRAGMA(push) \
+     GCC_DIAG_PRAGMA(ignored x)
+#  define GCC_DIAG_ON(x) GCC_DIAG_PRAGMA(pop)
+# else
+#  define GCC_DIAG_OFF(x) GCC_DIAG_PRAGMA(ignored x)
+#  define GCC_DIAG_ON(x)  GCC_DIAG_PRAGMA(warning x)
+# endif
+#else
+# define GCC_DIAG_OFF(x)
+# define GCC_DIAG_ON(x)
+#endif
+
+
 #include "diameap_defs.h"
 #include <gnutls/gnutls.h>
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+GCC_DIAG_OFF("-Wdeprecated-declarations")
 #include <gcrypt.h>
-#pragma GCC diagnostic pop
+GCC_DIAG_ON("-Wdeprecated-declarations")
 #include <errno.h>
 #include <pthread.h>
Index: extensions/app_diameap/libcrypt.h
===================================================================
--- extensions/app_diameap/libcrypt.h	(revision 1033)
+++ extensions/app_diameap/libcrypt.h	(revision 1034)
@@ -40,12 +40,12 @@
 #define LIBCRYPT_H_
 
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+/* EAP-TLS*/
+#include "diameap_tls.h"
+
+GCC_DIAG_OFF("-Wdeprecated-declarations")
 #include <gcrypt.h>
-#pragma GCC diagnostic pop
+GCC_DIAG_ON("-Wdeprecated-declarations")
 #include <stdio.h>
 
-/* EAP-TLS*/
-#include "diameap_tls.h"
 
 
Index: extensions/app_diameap/plugins/eap_md5/eap_md5.c
===================================================================
--- extensions/app_diameap/plugins/eap_md5/eap_md5.c	(revision 1033)
+++ extensions/app_diameap/plugins/eap_md5/eap_md5.c	(revision 1034)
@@ -38,8 +38,7 @@
 
 #include "../../plugins.h"
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+GCC_DIAG_OFF("-Wdeprecated-declarations")
 #include <gcrypt.h>
-#pragma GCC diagnostic pop
+GCC_DIAG_ON("-Wdeprecated-declarations")
 
 #define CHALLENGE_LEN	16
Index: extensions/app_sip/app_sip.h
===================================================================
--- extensions/app_sip/app_sip.h	(revision 1033)
+++ extensions/app_sip/app_sip.h	(revision 1034)
@@ -39,8 +39,7 @@
 #include <stdlib.h>
 #include <stdio.h>
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+GCC_DIAG_OFF("-Wdeprecated-declarations")
 #include <gcrypt.h>
-#pragma GCC diagnostic pop
+GCC_DIAG_ON("-Wdeprecated-declarations")
 #include <string.h>
 #include <mysql.h>
Index: extensions/test_sip/test_sip.h
===================================================================
--- extensions/test_sip/test_sip.h	(revision 1033)
+++ extensions/test_sip/test_sip.h	(revision 1034)
@@ -39,8 +39,7 @@
 #include <stdlib.h>
 #include <stdio.h>
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+GCC_DIAG_OFF("-Wdeprecated-declarations")
 #include <gcrypt.h>
-#pragma GCC diagnostic pop
+GCC_DIAG_ON("-Wdeprecated-declarations")
 #include <string.h>
 #include <mysql.h>
Index: include/freeDiameter/libfdproto.h
===================================================================
--- include/freeDiameter/libfdproto.h	(revision 1033)
+++ include/freeDiameter/libfdproto.h	(revision 1034)
@@ -89,4 +89,21 @@
 #define _ATTRIBUTE_PRINTFLIKE_(_f,_v) __attribute__ ((format (printf, _f, _v)))
 #endif /* SWIG */
+
+/* Remove some deprecated warnings from some gnutls versions, when possible */
+#if defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 405
+# define GCC_DIAG_DO_PRAGMA(x) _Pragma (#x)
+# define GCC_DIAG_PRAGMA(x) GCC_DIAG_DO_PRAGMA(GCC diagnostic x)
+# if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406
+#  define GCC_DIAG_OFF(x) GCC_DIAG_PRAGMA(push) \
+     GCC_DIAG_PRAGMA(ignored x)
+#  define GCC_DIAG_ON(x) GCC_DIAG_PRAGMA(pop)
+# else
+#  define GCC_DIAG_OFF(x) GCC_DIAG_PRAGMA(ignored x)
+#  define GCC_DIAG_ON(x)  GCC_DIAG_PRAGMA(warning x)
+# endif
+#else
+# define GCC_DIAG_OFF(x)
+# define GCC_DIAG_ON(x)
+#endif
 
 /*============================================================*/
Index: libfdcore/config.c
===================================================================
--- libfdcore/config.c	(revision 1033)
+++ libfdcore/config.c	(revision 1034)
@@ -227,6 +227,5 @@
 
 #ifndef GNUTLS_VERSION_300
-# pragma GCC diagnostic push
-# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+GCC_DIAG_OFF("-Wdeprecated-declarations")
 #endif /* !GNUTLS_VERSION_300 */
 /* Parse the configuration file (using the yacc parser) */
@@ -600,5 +599,5 @@
 }
 #ifndef GNUTLS_VERSION_300
-# pragma GCC diagnostic pop
+GCC_DIAG_ON("-Wdeprecated-declarations")
 #endif /* !GNUTLS_VERSION_300 */
 
Index: libfdcore/core.c
===================================================================
--- libfdcore/core.c	(revision 1033)
+++ libfdcore/core.c	(revision 1034)
@@ -36,8 +36,7 @@
 #include "fdcore-internal.h"
 
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+GCC_DIAG_OFF("-Wdeprecated-declarations")
 #include <gcrypt.h>
-#pragma GCC diagnostic pop
+GCC_DIAG_ON("-Wdeprecated-declarations")
 
 /* The static configuration structure */
Index: libfdcore/sctps.c
===================================================================
--- libfdcore/sctps.c	(revision 1033)
+++ libfdcore/sctps.c	(revision 1034)
@@ -231,6 +231,5 @@
 /* Set the parameters of a session to use the appropriate fifo and stream information */
 #ifndef GNUTLS_VERSION_300
-# pragma GCC diagnostic push
-# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+GCC_DIAG_OFF("-Wdeprecated-declarations")
 #endif /* !GNUTLS_VERSION_300 */
 static void set_sess_transport(gnutls_session_t session, struct sctps_ctx *ctx)
@@ -252,5 +251,5 @@
 }
 #ifndef GNUTLS_VERSION_300
-# pragma GCC diagnostic pop
+GCC_DIAG_ON("-Wdeprecated-declarations")
 #endif /* !GNUTLS_VERSION_300 */
 
Index: tests/tests.h
===================================================================
--- tests/tests.h	(revision 1033)
+++ tests/tests.h	(revision 1034)
@@ -47,8 +47,7 @@
 #include <pthread.h>
 #include <errno.h>
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+GCC_DIAG_OFF("-Wdeprecated-declarations")
 #include <gcrypt.h>
-#pragma GCC diagnostic pop
+GCC_DIAG_ON("-Wdeprecated-declarations")
 
 /* Test timeout duration, unless -n is passed on the command line */
