Patch for missing #if in tasks.c

tasks.c is missing #if ( configGENERATE_RUN_TIME_STATS == 1 ) bracketing the call to portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() at line 1122. — tasks.c (revision 2690)
+++ tasks.c (revision 2692)
@@ -1116,11 +1116,13 @@
xSchedulerRunning = pdTRUE;
xTickCount = ( portTickType ) 0; +                #if ( configGENERATE_RUN_TIME_STATS == 1 )
/* If configGENERATE_RUN_TIME_STATS is defined then the following
macro must be defined to configure the timer/counter used to generate
the run time counter time base. */
portCONFIGURE_TIMER_FOR_RUN_TIME_STATS();
-
+ #endif
+
/* Setting up the timer tick is hardware specific and thus in the
portable interface. */
if( xPortStartScheduler() )

Patch for missing #if in tasks.c

I don’t understand this patch and can only assume you are using an old version of FreeRTOS or have modified the code yourself.  If an #endif was missing, nothing would compile, surely? The code between lines 1104 and 1135 looks like this, there are no conditional compilations.
    if( xReturn == pdPASS )
    {
        /* Interrupts are turned off here, to ensure a tick does not occur
        before or during the call to xPortStartScheduler().  The stacks of
        the created tasks contain a status word with interrupts switched on
        so interrupts will automatically get re-enabled when the first task
        starts to run.
        STEPPING THROUGH HERE USING A DEBUGGER CAN CAUSE BIG PROBLEMS IF THE
        DEBUGGER ALLOWS INTERRUPTS TO BE PROCESSED. */
        portDISABLE_INTERRUPTS();
        xSchedulerRunning = pdTRUE;
        xTickCount = ( portTickType ) 0;
        /* If configGENERATE_RUN_TIME_STATS is defined then the following
        macro must be defined to configure the timer/counter used to generate
        the run time counter time base. */
        portCONFIGURE_TIMER_FOR_RUN_TIME_STATS();

        /* Setting up the timer tick is hardware specific and thus in the
        portable interface. */
        if( xPortStartScheduler() )
        {
            /* Should not reach here as if the scheduler is running the
            function will not return. */
        }
        else
        {
            /* Should only reach here if a task calls xTaskEndScheduler(). */
        }
    }
regards.

Patch for missing #if in tasks.c

I am using 7.0.1.  It is the added #if that is the key thing, not a missing #endif.  You should not try to call portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() (which is at tasks.c line 1122) if configGENERATE_RUN_TIME_STATS is not defined.  Of course, defining portCONFIGURE_TIMER_FOR_RUN_TIME_STATS as a null macro in FreeRTOSConfig.h works just as well, but it seems cleaner to me not to try to call it in the first place.

Patch for missing #if in tasks.c

If portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() is not defined then it will get automatically removed by code in FreeRTOS.h
#ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
    #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
#endif
If you have a problem compiling then it is likely the header files are not included in the correct order, although it should not be a problem compiling tasks.c. Have you made any changes to the code?