Skip to content

Commit b08c19f

Browse files
authored
Define default values of macros before first use (#298)
configSTACK_ALLOCATION_FROM_SEPARATE_HEAP was added recently in #267. This macro was used in portable.h before its default value was defined, resulting in a warning when built with -Wundef. This changes moves the default value definition for configSTACK_ALLOCATION_FROM_SEPARATE_HEAP to portable.h to ensure that it is defined before first use. portUSING_MPU_WRAPPERS check in mpu_wrappers.h was updated in #285. The new check results in a warning when built with -Wundef because portUSING_MPU_WRAPPERS is not defined yet. This changes adds the default value definition for portUSING_MPU_WRAPPERS to portable.h to ensure that it is defined before first use. Signed-off-by: Gaurav Aggarwal <[email protected]>
1 parent 534eba6 commit b08c19f

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

include/FreeRTOS.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -896,11 +896,6 @@
896896
#define configSUPPORT_DYNAMIC_ALLOCATION 1
897897
#endif
898898

899-
#ifndef configSTACK_ALLOCATION_FROM_SEPARATE_HEAP
900-
/* Defaults to 0 for backward compatibility. */
901-
#define configSTACK_ALLOCATION_FROM_SEPARATE_HEAP 0
902-
#endif
903-
904899
#ifndef configSTACK_DEPTH_TYPE
905900

906901
/* Defaults to uint16_t for backward compatibility, but can be overridden

include/mpu_wrappers.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@
177177
#define PRIVILEGED_FUNCTION
178178
#define PRIVILEGED_DATA
179179
#define FREERTOS_SYSTEM_CALL
180-
#define portUSING_MPU_WRAPPERS 0
181180

182181
#endif /* portUSING_MPU_WRAPPERS */
183182

include/portable.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@
7979
#error "Invalid portBYTE_ALIGNMENT definition"
8080
#endif
8181

82+
#ifndef portUSING_MPU_WRAPPERS
83+
#define portUSING_MPU_WRAPPERS 0
84+
#endif
85+
8286
#ifndef portNUM_CONFIGURABLE_REGIONS
8387
#define portNUM_CONFIGURABLE_REGIONS 1
8488
#endif
@@ -91,6 +95,11 @@
9195
#define portARCH_NAME NULL
9296
#endif
9397

98+
#ifndef configSTACK_ALLOCATION_FROM_SEPARATE_HEAP
99+
/* Defaults to 0 for backward compatibility. */
100+
#define configSTACK_ALLOCATION_FROM_SEPARATE_HEAP 0
101+
#endif
102+
94103
/* *INDENT-OFF* */
95104
#ifdef __cplusplus
96105
extern "C" {

0 commit comments

Comments
 (0)