From a7c47131fad4f06958db005be91f982a44a25789 Mon Sep 17 00:00:00 2001
From: Richard Barry <ribarry@amazon.com>
Date: Tue, 25 Jun 2013 13:39:50 +0000
Subject: [PATCH] Remove portALIGNMENT_ASSERT_pxCurrentTCB() macro, which
 serves no purpose.

---
 FreeRTOS/Source/include/FreeRTOS.h                    |  4 ----
 FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/portmacro.h  |  4 ----
 FreeRTOS/Source/portable/GCC/ARM_CM4F/portmacro.h     |  4 ----
 FreeRTOS/Source/portable/GCC/RX100/portmacro.h        |  3 ---
 FreeRTOS/Source/portable/GCC/TriCore_1782/portmacro.h |  4 ----
 FreeRTOS/Source/portable/IAR/ARM_CM4F/portmacro.h     |  5 -----
 FreeRTOS/Source/portable/IAR/RX100/portmacro.h        |  3 ---
 FreeRTOS/Source/portable/RVDS/ARM_CM4F/portmacro.h    |  5 -----
 FreeRTOS/Source/portable/Renesas/RX100/portmacro.h    |  3 ---
 FreeRTOS/Source/portable/Renesas/RX200/portmacro.h    |  3 ---
 FreeRTOS/Source/portable/Tasking/ARM_CM4F/portmacro.h |  4 ----
 FreeRTOS/Source/tasks.c                               | 11 ++++-------
 12 files changed, 4 insertions(+), 49 deletions(-)

diff --git a/FreeRTOS/Source/include/FreeRTOS.h b/FreeRTOS/Source/include/FreeRTOS.h
index 34fc489722..852e24c798 100644
--- a/FreeRTOS/Source/include/FreeRTOS.h
+++ b/FreeRTOS/Source/include/FreeRTOS.h
@@ -231,10 +231,6 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * );
 	#define configASSERT( x )
 #endif
 
-#ifndef portALIGNMENT_ASSERT_pxCurrentTCB
-	#define portALIGNMENT_ASSERT_pxCurrentTCB configASSERT
-#endif
-
 /* The timers module relies on xTaskGetSchedulerState(). */
 #if configUSE_TIMERS == 1
 
diff --git a/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/portmacro.h b/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/portmacro.h
index 218c959758..a313a645e1 100644
--- a/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/portmacro.h
+++ b/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/portmacro.h
@@ -214,10 +214,6 @@ extern void vPortExitCritical( void );
 
 #define portNOP()
 
-/* There are an uneven number of items on the initial stack, so
-portALIGNMENT_ASSERT_pxCurrentTCB() will trigger false positive asserts. */
-#define portALIGNMENT_ASSERT_pxCurrentTCB ( void )
-
 
 #ifdef __cplusplus
 }
diff --git a/FreeRTOS/Source/portable/GCC/ARM_CM4F/portmacro.h b/FreeRTOS/Source/portable/GCC/ARM_CM4F/portmacro.h
index 3ad77b20cd..7d58e7b824 100644
--- a/FreeRTOS/Source/portable/GCC/ARM_CM4F/portmacro.h
+++ b/FreeRTOS/Source/portable/GCC/ARM_CM4F/portmacro.h
@@ -136,10 +136,6 @@ extern void vPortClearInterruptMask( unsigned long ulNewMaskValue );
 #define portENTER_CRITICAL()					vPortEnterCritical()
 #define portEXIT_CRITICAL()						vPortExitCritical()
 
-/* There are an uneven number of items on the initial stack, so
-portALIGNMENT_ASSERT_pxCurrentTCB() will trigger false positive asserts. */
-#define portALIGNMENT_ASSERT_pxCurrentTCB ( void )
-
 /*-----------------------------------------------------------*/
 
 /* Task function macros as described on the FreeRTOS.org WEB site.  These are
diff --git a/FreeRTOS/Source/portable/GCC/RX100/portmacro.h b/FreeRTOS/Source/portable/GCC/RX100/portmacro.h
index b10cd8ab60..f5317c07b4 100644
--- a/FreeRTOS/Source/portable/GCC/RX100/portmacro.h
+++ b/FreeRTOS/Source/portable/GCC/RX100/portmacro.h
@@ -159,9 +159,6 @@ void vPortSetIPL( unsigned long ulNewIPL ) __attribute__((naked));
 	#endif
 #endif
 
-/* This macro is not appropriate for this port so is defined away. */
-#define portALIGNMENT_ASSERT_pxCurrentTCB( x )
-
 /*-----------------------------------------------------------*/
 
 /* Task function macros as described on the FreeRTOS.org WEB site. */
diff --git a/FreeRTOS/Source/portable/GCC/TriCore_1782/portmacro.h b/FreeRTOS/Source/portable/GCC/TriCore_1782/portmacro.h
index e06fa3851a..9448ea6c8c 100644
--- a/FreeRTOS/Source/portable/GCC/TriCore_1782/portmacro.h
+++ b/FreeRTOS/Source/portable/GCC/TriCore_1782/portmacro.h
@@ -188,10 +188,6 @@ extern void vTaskExitCritical( void );
 extern unsigned long uxPortSetInterruptMaskFromISR( void );
 #define portSET_INTERRUPT_MASK_FROM_ISR() 	uxPortSetInterruptMaskFromISR()
 
-/* As this port holds a CSA address in pxTopOfStack, the assert that checks the
-pxTopOfStack alignment is removed. */
-#define portALIGNMENT_ASSERT_pxCurrentTCB ( void )
-
 /* Pend a priority 1 interrupt, which will take care of the context switch. */
 #define portYIELD_FROM_ISR( xHigherPriorityTaskWoken ) 		if( xHigherPriorityTaskWoken != pdFALSE ) {	CPU_SRC0.bits.SETR = 1; _isync(); }
 
diff --git a/FreeRTOS/Source/portable/IAR/ARM_CM4F/portmacro.h b/FreeRTOS/Source/portable/IAR/ARM_CM4F/portmacro.h
index a9c6e8890f..8ef0e07245 100644
--- a/FreeRTOS/Source/portable/IAR/ARM_CM4F/portmacro.h
+++ b/FreeRTOS/Source/portable/IAR/ARM_CM4F/portmacro.h
@@ -157,11 +157,6 @@ extern void vPortClearInterruptMask( unsigned long ulNewMask );
 #define portCLEAR_INTERRUPT_MASK_FROM_ISR(x)	vPortClearInterruptMask( x )
 /*-----------------------------------------------------------*/
 
-/* There are an uneven number of items on the initial stack, so
-portALIGNMENT_ASSERT_pxCurrentTCB() will trigger false positive asserts. */
-#define portALIGNMENT_ASSERT_pxCurrentTCB ( void )
-/*-----------------------------------------------------------*/
-
 /* Tickless idle/low power functionality. */
 #ifndef portSUPPRESS_TICKS_AND_SLEEP
 	extern void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime );
diff --git a/FreeRTOS/Source/portable/IAR/RX100/portmacro.h b/FreeRTOS/Source/portable/IAR/RX100/portmacro.h
index c3cfe6c1bf..d8c421fb9c 100644
--- a/FreeRTOS/Source/portable/IAR/RX100/portmacro.h
+++ b/FreeRTOS/Source/portable/IAR/RX100/portmacro.h
@@ -167,9 +167,6 @@ void vPortSetIPL( unsigned long ulNewIPL );
 #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters )
 #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )
 
-/* This macro is not appropriate for this port so is defined away. */
-#define portALIGNMENT_ASSERT_pxCurrentTCB( x )
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/FreeRTOS/Source/portable/RVDS/ARM_CM4F/portmacro.h b/FreeRTOS/Source/portable/RVDS/ARM_CM4F/portmacro.h
index a3c1748a86..ef8fa62522 100644
--- a/FreeRTOS/Source/portable/RVDS/ARM_CM4F/portmacro.h
+++ b/FreeRTOS/Source/portable/RVDS/ARM_CM4F/portmacro.h
@@ -138,11 +138,6 @@ extern void vPortExitCritical( void );
 
 /*-----------------------------------------------------------*/
 
-/* There are an uneven number of items on the initial stack, so
-portALIGNMENT_ASSERT_pxCurrentTCB() will trigger false positive asserts. */
-#define portALIGNMENT_ASSERT_pxCurrentTCB ( void )
-/*-----------------------------------------------------------*/
-
 /* Tickless idle/low power functionality. */
 #ifndef portSUPPRESS_TICKS_AND_SLEEP
 	extern void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime );
diff --git a/FreeRTOS/Source/portable/Renesas/RX100/portmacro.h b/FreeRTOS/Source/portable/Renesas/RX100/portmacro.h
index ceea81dbf8..88c3ddc3a1 100644
--- a/FreeRTOS/Source/portable/Renesas/RX100/portmacro.h
+++ b/FreeRTOS/Source/portable/Renesas/RX100/portmacro.h
@@ -172,9 +172,6 @@ extern void vTaskExitCritical( void );
 #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters )
 #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )
 
-/* This macro is not appropriate for this port so is defined away. */
-#define portALIGNMENT_ASSERT_pxCurrentTCB( x )
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/FreeRTOS/Source/portable/Renesas/RX200/portmacro.h b/FreeRTOS/Source/portable/Renesas/RX200/portmacro.h
index a3e234f53b..c9ef3f132a 100644
--- a/FreeRTOS/Source/portable/Renesas/RX200/portmacro.h
+++ b/FreeRTOS/Source/portable/Renesas/RX200/portmacro.h
@@ -162,9 +162,6 @@ extern void vTaskExitCritical( void );
 #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters )
 #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )
 
-/* This macro is not appropriate for this port so is defined away. */
-#define portALIGNMENT_ASSERT_pxCurrentTCB( x )
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/FreeRTOS/Source/portable/Tasking/ARM_CM4F/portmacro.h b/FreeRTOS/Source/portable/Tasking/ARM_CM4F/portmacro.h
index 9f12a88f15..c6313b21cb 100644
--- a/FreeRTOS/Source/portable/Tasking/ARM_CM4F/portmacro.h
+++ b/FreeRTOS/Source/portable/Tasking/ARM_CM4F/portmacro.h
@@ -155,10 +155,6 @@ extern void vPortExitCritical( void );
 #define portENTER_CRITICAL()		vPortEnterCritical()
 #define portEXIT_CRITICAL()			vPortExitCritical()
 
-/* There are an uneven number of items on the initial stack, so
-portALIGNMENT_ASSERT_pxCurrentTCB() will trigger false positive asserts. */
-#define portALIGNMENT_ASSERT_pxCurrentTCB ( void )
-
 /*-----------------------------------------------------------*/
 
 /* Task function macros as described on the FreeRTOS.org WEB site. */
diff --git a/FreeRTOS/Source/tasks.c b/FreeRTOS/Source/tasks.c
index abe3440669..6232e7eb43 100644
--- a/FreeRTOS/Source/tasks.c
+++ b/FreeRTOS/Source/tasks.c
@@ -540,9 +540,6 @@ tskTCB * pxNewTCB;
 		}
 		#endif /* portUSING_MPU_WRAPPERS */
 
-		/* Check the alignment of the initialised stack. */
-		portALIGNMENT_ASSERT_pxCurrentTCB( ( ( ( unsigned long ) pxNewTCB->pxTopOfStack & ( unsigned long ) portBYTE_ALIGNMENT_MASK ) == 0UL ) );
-
 		if( ( void * ) pxCreatedTask != NULL )
 		{
 			/* Pass the TCB out - in an anonymous way.  The calling function/
@@ -1843,10 +1840,10 @@ void vTaskSwitchContext( void )
 					ulTotalRunTime = portGET_RUN_TIME_COUNTER_VALUE();
 				#endif
 
-				/* Add the amount of time the task has been running to the 
-				accumulated	time so far.  The time the task started running was 
-				stored in ulTaskSwitchedInTime.  Note that there is no overflow 
-				protection here	so count values are only valid until the timer 
+				/* Add the amount of time the task has been running to the
+				accumulated	time so far.  The time the task started running was
+				stored in ulTaskSwitchedInTime.  Note that there is no overflow
+				protection here	so count values are only valid until the timer
 				overflows.  The guard against negative values is to protect
 				against suspect run time stat counter implementations - which
 				are provided by the application, not the kernel. */