Merge pull request #1292 from danh-arm/dh/spurious-dep-warn

 Suppress spurious deprecated declaration warnings
diff --git a/Makefile b/Makefile
index db15930..69f29e6 100644
--- a/Makefile
+++ b/Makefile
@@ -374,6 +374,12 @@
 $(error USE_COHERENT_MEM cannot be enabled with HW_ASSISTED_COHERENCY)
 endif
 
+ifneq ($(MULTI_CONSOLE_API), 0)
+    ifeq (${ARCH},aarch32)
+        $(error "Error: MULTI_CONSOLE_API is not supported for AArch32")
+    endif
+endif
+
 ################################################################################
 # Process platform overrideable behaviour
 ################################################################################
@@ -588,9 +594,9 @@
 msg_start:
 	@echo "Building ${PLAT}"
 
-# Check if deprecated declarations should be treated as error or not.
+# Check if deprecated declarations and cpp warnings should be treated as error or not.
 ifeq (${ERROR_DEPRECATED},0)
-    TF_CFLAGS		+= 	-Wno-error=deprecated-declarations
+    CPPFLAGS		+= 	-Wno-error=deprecated-declarations -Wno-error=cpp
 endif
 
 # Expand build macros for the different images
diff --git a/bl31/bl31_context_mgmt.c b/bl31/bl31_context_mgmt.c
index 123e623..7d2c893 100644
--- a/bl31/bl31_context_mgmt.c
+++ b/bl31/bl31_context_mgmt.c
@@ -79,7 +79,13 @@
 {
 	assert(sec_state_is_valid(security_state));
 
+	/*
+	 * Suppress deprecated declaration warning in compatibility function
+	 */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 	return cm_get_context_by_index(platform_get_core_pos(mpidr), security_state);
+#pragma GCC diagnostic pop
 }
 
 /*******************************************************************************
@@ -90,8 +96,14 @@
 {
 	assert(sec_state_is_valid(security_state));
 
+	/*
+	 * Suppress deprecated declaration warning in compatibility function
+	 */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 	cm_set_context_by_index(platform_get_core_pos(mpidr),
 						 context, security_state);
+#pragma GCC diagnostic pop
 }
 
 /*******************************************************************************
@@ -104,7 +116,15 @@
 	if ((mpidr & MPIDR_AFFINITY_MASK) ==
 			(read_mpidr_el1() & MPIDR_AFFINITY_MASK))
 		cm_init_my_context(ep);
-	else
+	else {
+		/*
+		 * Suppress deprecated declaration warning in compatibility
+		 * function
+		 */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 		cm_init_context_by_index(platform_get_core_pos(mpidr), ep);
+#pragma GCC diagnostic pop
+	}
 }
-#endif
+#endif /* ERROR_DEPRECATED */
diff --git a/drivers/arm/gic/v2/gicv2_main.c b/drivers/arm/gic/v2/gicv2_main.c
index c65f972..7e2c7a7 100644
--- a/drivers/arm/gic/v2/gicv2_main.c
+++ b/drivers/arm/gic/v2/gicv2_main.c
@@ -85,10 +85,17 @@
 				driver_data->interrupt_props_num);
 #if !ERROR_DEPRECATED
 	} else {
+		/*
+		 * Suppress deprecated declaration warnings in compatibility
+		 * function
+		 */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 		assert(driver_data->g0_interrupt_array);
 		gicv2_secure_ppi_sgi_setup(driver_data->gicd_base,
 				driver_data->g0_interrupt_num,
 				driver_data->g0_interrupt_array);
+#pragma GCC diagnostic pop
 	}
 #endif
 
@@ -128,12 +135,20 @@
 				driver_data->interrupt_props_num);
 #if !ERROR_DEPRECATED
 	} else {
+		/*
+		 * Suppress deprecated declaration warnings in compatibility
+		 * function
+		 */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
 		assert(driver_data->g0_interrupt_array);
 
 		/* Configure the G0 SPIs */
 		gicv2_secure_spis_configure(driver_data->gicd_base,
 				driver_data->g0_interrupt_num,
 				driver_data->g0_interrupt_array);
+#pragma GCC diagnostic pop
 	}
 #endif
 
@@ -156,6 +171,13 @@
 		/* Interrupt properties array size must be 0 */
 		assert(plat_driver_data->interrupt_props_num == 0);
 
+		/*
+		 * Suppress deprecated declaration warnings in compatibility
+		 * function
+		 */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
 		/* The platform should provide a list of secure interrupts */
 		assert(plat_driver_data->g0_interrupt_array);
 
@@ -166,6 +188,11 @@
 		assert(plat_driver_data->g0_interrupt_array ?
 				plat_driver_data->g0_interrupt_num :
 				plat_driver_data->g0_interrupt_num == 0);
+#pragma GCC diagnostic pop
+
+		WARN("Using deprecated integer interrupt array in "
+		     "gicv2_driver_data_t\n");
+		WARN("Please migrate to using an interrupt_prop_t array\n");
 	}
 #else
 	assert(plat_driver_data->interrupt_props != NULL);
diff --git a/drivers/arm/gic/v3/gicv3_main.c b/drivers/arm/gic/v3/gicv3_main.c
index 45a2e5b..f4a3ef8 100644
--- a/drivers/arm/gic/v3/gicv3_main.c
+++ b/drivers/arm/gic/v3/gicv3_main.c
@@ -73,6 +73,13 @@
 		assert(plat_driver_data->interrupt_props_num == 0);
 
 		/*
+		 * Suppress deprecated declaration warnings in compatibility
+		 * function
+		 */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
+		/*
 		 * The platform should provide a list of at least one type of
 		 * interrupt.
 		 */
@@ -89,6 +96,11 @@
 		assert(plat_driver_data->g1s_interrupt_array ?
 				plat_driver_data->g1s_interrupt_num :
 				plat_driver_data->g1s_interrupt_num == 0);
+#pragma GCC diagnostic pop
+
+		WARN("Using deprecated integer interrupt arrays in "
+		     "gicv3_driver_data_t\n");
+		WARN("Please migrate to using interrupt_prop_t arrays\n");
 	}
 #else
 	assert(plat_driver_data->interrupt_props != NULL);
@@ -189,6 +201,13 @@
 				gicv3_driver_data->interrupt_props_num);
 #if !ERROR_DEPRECATED
 	} else {
+		/*
+		 * Suppress deprecated declaration warnings in compatibility
+		 * function
+		 */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
 		assert(gicv3_driver_data->g1s_interrupt_array ||
 				gicv3_driver_data->g0_interrupt_array);
 
@@ -209,6 +228,7 @@
 					INTR_GROUP0);
 			bitmap |= CTLR_ENABLE_G0_BIT;
 		}
+#pragma GCC diagnostic pop
 	}
 #endif
 
@@ -253,6 +273,13 @@
 				gicv3_driver_data->interrupt_props_num);
 #if !ERROR_DEPRECATED
 	} else {
+		/*
+		 * Suppress deprecated declaration warnings in compatibility
+		 * function
+		 */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
 		assert(gicv3_driver_data->g1s_interrupt_array ||
 		       gicv3_driver_data->g0_interrupt_array);
 
@@ -273,6 +300,7 @@
 					INTR_GROUP0);
 			bitmap |= CTLR_ENABLE_G0_BIT;
 		}
+#pragma GCC diagnostic pop
 	}
 #endif
 
diff --git a/drivers/console/aarch64/deprecated_console.S b/drivers/console/aarch64/deprecated_console.S
index c83e246..d6ecc4d 100644
--- a/drivers/console/aarch64/deprecated_console.S
+++ b/drivers/console/aarch64/deprecated_console.S
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -9,6 +9,7 @@
  * This is the common console core code for the deprecated single-console API.
  * New platforms should set MULTI_CONSOLE_API=1 and not use this file.
  */
+#warning "Using deprecated console implementation. Please migrate to MULTI_CONSOLE_API"
 
 	.globl	console_init
 	.globl	console_uninit
diff --git a/include/drivers/arm/gicv2.h b/include/drivers/arm/gicv2.h
index 6e8322e..39c7302 100644
--- a/include/drivers/arm/gicv2.h
+++ b/include/drivers/arm/gicv2.h
@@ -155,8 +155,8 @@
 	uintptr_t gicd_base;
 	uintptr_t gicc_base;
 #if !ERROR_DEPRECATED
-	unsigned int g0_interrupt_num;
-	const unsigned int *g0_interrupt_array;
+	unsigned int g0_interrupt_num __deprecated;
+	const unsigned int *g0_interrupt_array __deprecated;
 #endif
 	unsigned int *target_masks;
 	unsigned int target_masks_num;
diff --git a/include/drivers/arm/gicv3.h b/include/drivers/arm/gicv3.h
index 5f265c6..37c92e4 100644
--- a/include/drivers/arm/gicv3.h
+++ b/include/drivers/arm/gicv3.h
@@ -310,10 +310,10 @@
 	uintptr_t gicd_base;
 	uintptr_t gicr_base;
 #if !ERROR_DEPRECATED
-	unsigned int g0_interrupt_num;
-	unsigned int g1s_interrupt_num;
-	const unsigned int *g0_interrupt_array;
-	const unsigned int *g1s_interrupt_array;
+	unsigned int g0_interrupt_num __deprecated;
+	unsigned int g1s_interrupt_num __deprecated;
+	const unsigned int *g0_interrupt_array __deprecated;
+	const unsigned int *g1s_interrupt_array __deprecated;
 #endif
 	const interrupt_prop_t *interrupt_props;
 	unsigned int interrupt_props_num;
diff --git a/include/drivers/console.h b/include/drivers/console.h
index 0629f57..f8ec83d 100644
--- a/include/drivers/console.h
+++ b/include/drivers/console.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2017, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -63,10 +63,10 @@
 int console_flush(void);
 
 #if !MULTI_CONSOLE_API
-/* DEPRECATED on AArch64 -- use console_<driver>_register() instead! */
+/* REMOVED on AArch64 -- use console_<driver>_register() instead! */
 int console_init(uintptr_t base_addr,
-		 unsigned int uart_clk, unsigned int baud_rate) __deprecated;
-void console_uninit(void) __deprecated;
+		 unsigned int uart_clk, unsigned int baud_rate);
+void console_uninit(void);
 #endif
 
 #endif /* __ASSEMBLY__ */
diff --git a/make_helpers/defaults.mk b/make_helpers/defaults.mk
index a80a491..751f834 100644
--- a/make_helpers/defaults.mk
+++ b/make_helpers/defaults.mk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved.
+# Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -98,9 +98,9 @@
 # Flag to enable new version of image loading
 LOAD_IMAGE_V2			:= 0
 
-# Use the new console API that allows registering more than one console instance
-# at once. Use = instead of := to dynamically default to ERROR_DEPRECATED.
-MULTI_CONSOLE_API		= $(ERROR_DEPRECATED)
+# Enable use of the console API allowing multiple consoles to be registered
+# at the same time.
+MULTI_CONSOLE_API		:= 0
 
 # NS timer register save and restore
 NS_TIMER_SWITCH			:= 0
diff --git a/plat/common/aarch64/plat_common.c b/plat/common/aarch64/plat_common.c
index 080d356..ddd29f2 100644
--- a/plat/common/aarch64/plat_common.c
+++ b/plat/common/aarch64/plat_common.c
@@ -65,7 +65,15 @@
 #if !ERROR_DEPRECATED
 unsigned int plat_get_syscnt_freq2(void)
 {
+	WARN("plat_get_syscnt_freq() is deprecated\n");
+	WARN("Please define plat_get_syscnt_freq2()\n");
+	/*
+	 * Suppress deprecated declaration warning in compatibility function
+	 */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 	unsigned long long freq = plat_get_syscnt_freq();
+#pragma GCC diagnostic pop
 
 	assert(freq >> 32 == 0);