summaryrefslogtreecommitdiffstats
path: root/testsuites/libtests
diff options
context:
space:
mode:
authorMatt Joyce <matthew.joyce@embedded-brains.de>2022-05-23 12:27:56 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2022-07-21 07:22:13 +0200
commit6d4b390f99af0e9d5873a3cb8ebaccfa05cbe37b (patch)
tree69d86bdace4793f3546d387fc00297917c234467 /testsuites/libtests
parentsptests: Disable Newlib reentrancy (diff)
downloadrtems-6d4b390f99af0e9d5873a3cb8ebaccfa05cbe37b.tar.bz2
Support _REENT_THREAD_LOCAL Newlib configuration
In case the Newlib _REENT_THREAD_LOCAL configuration option is enabled, the struct _reent is not defined (there is only a forward declaration in <sys/reent.h>). Instead, the usual members of struct _reent are available as dedicatd thread-local storage objects. Update #4560.
Diffstat (limited to 'testsuites/libtests')
-rw-r--r--testsuites/libtests/newlib01/init.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/testsuites/libtests/newlib01/init.c b/testsuites/libtests/newlib01/init.c
index 0bb3c4628b..6edae3adbd 100644
--- a/testsuites/libtests/newlib01/init.c
+++ b/testsuites/libtests/newlib01/init.c
@@ -43,6 +43,10 @@
#include "tmacros.h"
+#ifndef _REENT_CLEANUP
+#define _REENT_CLEANUP(ptr) ((ptr)->__cleanup)
+#endif
+
const char rtems_test_name[] = "NEWLIB 1";
static const char stdio_file_path[] = "/stdio-file";
@@ -129,7 +133,6 @@ static void test_lrand48(void)
static void stdio_file_worker(rtems_task_argument arg)
{
test_context *ctx = &test_instance;
- struct _reent *reent = _REENT;
FILE *output;
char buf[1] = { 'x' };
size_t n;
@@ -137,7 +140,7 @@ static void stdio_file_worker(rtems_task_argument arg)
test_rand();
test_lrand48();
- rtems_test_assert(reent->__cleanup == NULL);
+ rtems_test_assert(_REENT_CLEANUP(_REENT) == NULL);
output = stdout = fopen(&stdio_file_path[0], "r+");
rtems_test_assert(stdout != NULL);
@@ -145,9 +148,9 @@ static void stdio_file_worker(rtems_task_argument arg)
/*
* Check newlib's __sinit does not touch our assigned file pointer.
*/
- rtems_test_assert(reent->__cleanup == NULL);
+ rtems_test_assert(_REENT_CLEANUP(_REENT) == NULL);
rtems_test_assert(fflush(stdout) == 0);
- rtems_test_assert(reent->__cleanup != NULL);
+ rtems_test_assert(_REENT_CLEANUP(_REENT) != NULL);
rtems_test_assert(stdout == output);
n = fwrite(&buf[0], sizeof(buf), 1, stdout);