From d69acf87dc1fcb7c2f06f6e82376192c9aadfd3b Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 18 Feb 2022 16:33:10 +0100 Subject: config: CONFIGURE_DISABLE_NEWLIB_REENTRANCY Do not initialize Thread_Control::libc_reent if CONFIGURE_DISABLE_NEWLIB_REENTRANCY is defined. This helps to catch errors with a NULL pointer exception rather than a corruption of the thread control block. --- cpukit/include/rtems/confdefs/threads.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'cpukit/include/rtems/confdefs/threads.h') diff --git a/cpukit/include/rtems/confdefs/threads.h b/cpukit/include/rtems/confdefs/threads.h index 279c6264db..503a4b20ec 100644 --- a/cpukit/include/rtems/confdefs/threads.h +++ b/cpukit/include/rtems/confdefs/threads.h @@ -161,8 +161,6 @@ struct Thread_Configured_control { #endif #ifdef _CONFIGURE_ENABLE_NEWLIB_REENTRANCY struct _reent Newlib; - #else - struct { /* Empty */ } Newlib; #endif }; @@ -176,13 +174,16 @@ const Thread_Control_add_on _Thread_Control_add_ons[] = { Control.API_Extensions[ THREAD_API_RTEMS ] ), offsetof( Thread_Configured_control, API_RTEMS ) - }, { - offsetof( - Thread_Configured_control, - Control.libc_reent - ), - offsetof( Thread_Configured_control, Newlib ) } + #ifdef _CONFIGURE_ENABLE_NEWLIB_REENTRANCY + , { + offsetof( + Thread_Configured_control, + Control.libc_reent + ), + offsetof( Thread_Configured_control, Newlib ) + } + #endif #if CONFIGURE_MAXIMUM_THREAD_NAME_SIZE > 1 , { offsetof( -- cgit v1.2.3