Index: libfdcore/cnxctx.c
===================================================================
--- libfdcore/cnxctx.c	(revision 999)
+++ libfdcore/cnxctx.c	(revision 1027)
@@ -513,5 +513,5 @@
 int fd_cnx_getremoteeps(struct cnxctx * conn, struct fd_list * eps)
 {
-	TRACE_ENTRY("%p %p %p", conn, eps);
+	TRACE_ENTRY("%p %p", conn, eps);
 	CHECK_PARAMS(conn && eps);
 	
@@ -1210,5 +1210,5 @@
 					snprintf(buf+strlen(buf), sizeof(buf)-strlen(buf), "%02hhx", serial[j]);
 				}
-				fd_log_debug(buf);
+				fd_log_debug("%s", buf);
 			}
 
Index: libfdcore/config.c
===================================================================
--- libfdcore/config.c	(revision 1021)
+++ libfdcore/config.c	(revision 1027)
@@ -226,4 +226,7 @@
 #endif /* GNUTLS_VERSION_300 */
 
+#ifndef GNUTLS_VERSION_300
+# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif /* !GNUTLS_VERSION_300 */
 /* Parse the configuration file (using the yacc parser) */
 int fd_conf_parse()
@@ -474,8 +477,6 @@
 			unsigned int verify;
 			time_t now;
-			#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 			GNUTLS_TRACE( gnutls_certificate_get_x509_cas (fd_g_config->cnf_sec_data.credentials, &CA_list, (unsigned int *) &CA_list_length) );
 			GNUTLS_TRACE( gnutls_certificate_get_x509_crls (fd_g_config->cnf_sec_data.credentials, &CRL_list, (unsigned int *) &CRL_list_length) );
-			#pragma GCC diagnostic warning "-Wdeprecated-declarations"
 			CHECK_GNUTLS_DO( gnutls_x509_crt_list_verify(certs, cert_max, CA_list, CA_list_length, CRL_list, CRL_list_length, 0, &verify),
 				{
@@ -597,4 +598,7 @@
 	return 0;
 }
+#ifndef GNUTLS_VERSION_300
+# pragma GCC diagnostic pop "-Wdeprecated-declarations"
+#endif /* !GNUTLS_VERSION_300 */
 
 
Index: libfdcore/core.c
===================================================================
--- libfdcore/core.c	(revision 994)
+++ libfdcore/core.c	(revision 1027)
@@ -38,5 +38,5 @@
 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 #include <gcrypt.h>
-#pragma GCC diagnostic warning "-Wdeprecated-declarations"
+#pragma GCC diagnostic pop "-Wdeprecated-declarations"
 
 /* The static configuration structure */
Index: libfdcore/p_ce.c
===================================================================
--- libfdcore/p_ce.c	(revision 1010)
+++ libfdcore/p_ce.c	(revision 1027)
@@ -307,5 +307,5 @@
 							peer->p_hdr.info.pi_diamid, peer->p_hdr.info.pi_diamidlen, NULL)) {
 					TRACE_DEBUG(INFO, "Received a message with Origin-Host set to '%.*s' while expecting '%s'", 
-							hdr->avp_value->os.len, hdr->avp_value->os.data, peer->p_hdr.info.pi_diamid);
+							(int)hdr->avp_value->os.len, hdr->avp_value->os.data, peer->p_hdr.info.pi_diamid);
 					error->pei_errcode = "DIAMETER_AVP_NOT_ALLOWED";
 					error->pei_message = "Your Origin-Host value does not match my configuration.";
Index: libfdcore/p_out.c
===================================================================
--- libfdcore/p_out.c	(revision 1010)
+++ libfdcore/p_out.c	(revision 1027)
@@ -85,5 +85,5 @@
 		if (rcvon.tv_sec != 0 || rcvon.tv_nsec != 0) {
 			TS_DIFFERENCE( &delay, &rcvon, &senton);
-			fd_msg_log( FD_MSG_LOG_TIMING, cpy_for_logs_only, "Forwarded in %d.%06.6d sec", delay.tv_sec, delay.tv_nsec/1000);
+			fd_msg_log( FD_MSG_LOG_TIMING, cpy_for_logs_only, "Forwarded in %ld.%6.6ld sec", (long)delay.tv_sec, delay.tv_nsec/1000);
 		} else { /* We log the answer time only for answers generated locally */
 			if (!msg_is_a_req) {
@@ -94,5 +94,5 @@
 				(void) fd_msg_ts_get_recv(req, &reqrcvon);
 				TS_DIFFERENCE( &delay, &reqrcvon, &senton);
-				fd_msg_log( FD_MSG_LOG_TIMING, cpy_for_logs_only, "Answered in %d.%06.6d sec", delay.tv_sec, delay.tv_nsec/1000);
+				fd_msg_log( FD_MSG_LOG_TIMING, cpy_for_logs_only, "Answered in %ld.%6.6ld sec", (long)delay.tv_sec, delay.tv_nsec/1000);
 			}
 		}
Index: libfdcore/p_psm.c
===================================================================
--- libfdcore/p_psm.c	(revision 1010)
+++ libfdcore/p_psm.c	(revision 1027)
@@ -538,5 +538,5 @@
 				(void) fd_msg_ts_get_sent(req, &reqsent);
 				TS_DIFFERENCE( &delay, &reqsent, &rcvon );
-				fd_msg_log( FD_MSG_LOG_TIMING, msg, "Answer received in %d.%06.6d sec.", delay.tv_sec, delay.tv_nsec / 1000 );
+				fd_msg_log( FD_MSG_LOG_TIMING, msg, "Answer received in %ld.%6.6ld sec.", (long)delay.tv_sec, delay.tv_nsec / 1000 );
 			}
 		} else {
Index: libfdcore/peers.c
===================================================================
--- libfdcore/peers.c	(revision 1010)
+++ libfdcore/peers.c	(revision 1027)
@@ -424,18 +424,18 @@
 			snprintf(buf+strlen(buf), sizeof(buf)-strlen(buf), "\t['%s' %u]", peer->p_hdr.info.runtime.pir_prodname, peer->p_hdr.info.runtime.pir_firmrev);
 	}
-	fd_log_debug(buf);
+	fd_log_debug("%s", buf);
 	if (details > FULL) {
 		/* Dump all info */
 		fd_log_debug("\tEntry origin : %s", peer->p_dbgorig?: "not set");
-		fd_log_debug("\tConfig flags : %s%s%s%s%s - %s%s%s", 
-				peer->p_hdr.info.config.pic_flags.pro3 == PI_P3_DEFAULT ? "" :
-					(peer->p_hdr.info.config.pic_flags.pro3 == PI_P3_IP ? "IP." : "IPv6."),
-				peer->p_hdr.info.config.pic_flags.pro4 == PI_P4_DEFAULT ? "" :
-					(peer->p_hdr.info.config.pic_flags.pro4 == PI_P4_TCP ? "TCP." : "SCTP."),
-				peer->p_hdr.info.config.pic_flags.alg ? "PrefTCP." : "",
-				peer->p_hdr.info.config.pic_flags.sec & PI_SEC_NONE ? "NoTLSok" :"",
-				peer->p_hdr.info.config.pic_flags.sec & PI_SEC_TLS_OLD ? "OldTLS" :"",
-				peer->p_hdr.info.config.pic_flags.exp ? "Expire." : "",
-				peer->p_hdr.info.config.pic_flags.persist ? "Persist." : ""
+		fd_log_debug("\tConfig flags : %s%s%s - %s%s - %s%s", 
+				peer->p_hdr.info.config.pic_flags.pro3 == PI_P3_DEFAULT ? "." :
+					(peer->p_hdr.info.config.pic_flags.pro3 == PI_P3_IP ? "IP" : "IPv6"),
+				peer->p_hdr.info.config.pic_flags.pro4 == PI_P4_DEFAULT ? "." :
+					(peer->p_hdr.info.config.pic_flags.pro4 == PI_P4_TCP ? "TCP" : "SCTP"),
+				peer->p_hdr.info.config.pic_flags.alg ? "PrefTCP" : ".",
+				peer->p_hdr.info.config.pic_flags.sec & PI_SEC_NONE ? "NoTLSok" :".",
+				peer->p_hdr.info.config.pic_flags.sec & PI_SEC_TLS_OLD ? "OldTLS" :".",
+				peer->p_hdr.info.config.pic_flags.exp ? "Expire" : ".",
+				peer->p_hdr.info.config.pic_flags.persist ? "Persist" : "."
 				);
 		fd_log_debug("\tLifetime : %d sec", peer->p_hdr.info.config.pic_lft);
Index: libfdcore/routing_dispatch.c
===================================================================
--- libfdcore/routing_dispatch.c	(revision 1014)
+++ libfdcore/routing_dispatch.c	(revision 1027)
@@ -362,7 +362,7 @@
 	
 	TRACE_DEBUG(FULL, "Processed Decorated NAI : '%.*s' became '%.*s' (%.*s)",
-				un->os.len, old_un,
-				at_idx, un->os.data,
-				dr->os.len, dr->os.data);
+				(int)un->os.len, old_un,
+				(int)at_idx, un->os.data,
+				(int)dr->os.len, dr->os.data);
 	
 	un->os.len = at_idx;
Index: libfdcore/sctp.c
===================================================================
--- libfdcore/sctp.c	(revision 974)
+++ libfdcore/sctp.c	(revision 1027)
@@ -1037,5 +1037,5 @@
 	mhdr.msg_controllen = sizeof(anci);
 	
-	TRACE_DEBUG(FULL, "Sending %db data on stream %hu of socket %d", len, strid, conn->cc_socket);
+	TRACE_DEBUG(FULL, "Sending %zdb data on stream %hu of socket %d", len, strid, conn->cc_socket);
 again:	
 	ret = sendmsg(conn->cc_socket, &mhdr, 0);
@@ -1135,5 +1135,5 @@
 		union sctp_notification * notif = (union sctp_notification *) data;
 		
-		TRACE_DEBUG(FULL, "Received %db data of notification on socket %d", datasize, conn->cc_socket);
+		TRACE_DEBUG(FULL, "Received %zdb data of notification on socket %d", datasize, conn->cc_socket);
 	
 		switch (notif->sn_header.sn_type) {
@@ -1233,7 +1233,7 @@
 			*strid = sndrcv->sinfo_stream;
 		}
-		TRACE_DEBUG(FULL, "Received %db data on socket %d, stream %hu", datasize, conn->cc_socket, *strid);
+		TRACE_DEBUG(FULL, "Received %zdb data on socket %d, stream %hu", datasize, conn->cc_socket, *strid);
 	} else {
-		TRACE_DEBUG(FULL, "Received %db data on socket %d (stream ignored)", datasize, conn->cc_socket);
+		TRACE_DEBUG(FULL, "Received %zdb data on socket %d (stream ignored)", datasize, conn->cc_socket);
 	}
 	
Index: libfdcore/sctps.c
===================================================================
--- libfdcore/sctps.c	(revision 1021)
+++ libfdcore/sctps.c	(revision 1027)
@@ -95,5 +95,5 @@
 					CHECK_FCT_DO(fd_event_send(conn->cc_sctps_data.array[strid].raw_recv, event, bufsz, buf), goto fatal );
 				} else {
-					TRACE_DEBUG(INFO, "Received packet (%d bytes) on out-of-range stream #%d from %s, discarded.", bufsz, strid, conn->cc_remid);
+					TRACE_DEBUG(INFO, "Received packet (%zd bytes) on out-of-range stream #%d from %s, discarded.", bufsz, strid, conn->cc_remid);
 					free(buf);
 				}
@@ -230,4 +230,7 @@
 
 /* Set the parameters of a session to use the appropriate fifo and stream information */
+#ifndef GNUTLS_VERSION_300
+# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif /* !GNUTLS_VERSION_300 */
 static void set_sess_transport(gnutls_session_t session, struct sctps_ctx *ctx)
 {
@@ -238,7 +241,5 @@
 #ifndef GNUTLS_VERSION_300
 	/* starting version 2.12, this call is not needed */
-	#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 	GNUTLS_TRACE( gnutls_transport_set_lowat( session, 0 ) );
-	#pragma GCC diagnostic warning "-Wdeprecated-declarations"
 #endif /* GNUTLS_VERSION_300 */
 	
@@ -249,4 +250,7 @@
 	return;
 }
+#ifndef GNUTLS_VERSION_300
+# pragma GCC diagnostic pop "-Wdeprecated-declarations"
+#endif /* !GNUTLS_VERSION_300 */
 
 /*************************************************************/
