<div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Aug 4, 2023 at 2:59 AM Sebastian Huber <<a href="mailto:sebastian.huber@embedded-brains.de">sebastian.huber@embedded-brains.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Make sure we have enough POSIX key value pairs available. This fixes a test<br>
failure on some targets.<br>
<br>
Make objects and functions static. Initialize variable to get rid of warnings.<br>
---<br>
testsuites/psxtests/psxkey07/init.c | 42 ++++++++++++++---------------<br>
1 file changed, 20 insertions(+), 22 deletions(-)<br>
<br>
diff --git a/testsuites/psxtests/psxkey07/init.c b/testsuites/psxtests/psxkey07/init.c<br>
index 15387264ba..ff7b3a0bd0 100644<br>
--- a/testsuites/psxtests/psxkey07/init.c<br>
+++ b/testsuites/psxtests/psxkey07/init.c<br>
@@ -39,32 +39,27 @@<br>
<br>
const char rtems_test_name[] = "PSXKEY 7";<br>
<br>
-/* forward declarations to avoid warnings */<br>
-rtems_task Init(rtems_task_argument argument);<br>
-rtems_task Test_Thread(rtems_task_argument argument);<br>
+#define INITIAL_TASK_COUNT 10<br>
<br>
-pthread_key_t Key;<br>
-int created_thread_count, setted_thread_count, got_thread_count;<br>
-int all_thread_created;<br>
-pthread_mutex_t mutex1, mutex2;<br>
-pthread_cond_t create_condition_var, set_condition_var;<br>
+#define ADDITIONAL_TASK_COUNT 13<br>
<br>
-rtems_task Test_Thread(rtems_task_argument argument)<br>
+static pthread_key_t Key;<br>
+static int created_thread_count, setted_thread_count, got_thread_count;<br>
+static int all_thread_created;<br>
+static pthread_mutex_t mutex1, mutex2;<br>
+static pthread_cond_t create_condition_var, set_condition_var;<br>
+<br>
+static rtems_task Test_Thread(rtems_task_argument argument)<br>
{<br>
int sc;<br>
int *value_p, *value_p2;<br>
<br>
value_p = malloc( sizeof( int ) );<br>
rtems_test_assert(value_p != NULL);<br>
-/*<br>
- * This was added to address the following warning.<br>
- * warning: 'value_p' may be used uninitialized<br>
- */<br>
-#pragma GCC diagnostic push<br>
-#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"<br>
- sc = pthread_setspecific( Key, value_p );<br>
-#pragma GCC diagnostic pop<br>
- rtems_test_assert( !sc );<br>
+<br>
+ *value_p = 123;<br>
+ sc = pthread_setspecific( Key, value_p );<br>
+ rtems_test_assert( !sc );<br>
<br>
pthread_mutex_lock( &mutex1 );<br>
++setted_thread_count;<br>
@@ -86,12 +81,13 @@ rtems_task Test_Thread(rtems_task_argument argument)<br>
rtems_task_exit();<br>
}<br>
<br>
-rtems_task Init(rtems_task_argument argument)<br>
+static rtems_task Init(rtems_task_argument argument)<br>
{<br>
rtems_status_code rc;<br>
int sc;<br>
struct timespec delay_request;<br>
- uintptr_t max_free_size = 13 * RTEMS_MINIMUM_STACK_SIZE;<br>
+ uintptr_t max_free_size =<br>
+ ADDITIONAL_TASK_COUNT * RTEMS_MINIMUM_STACK_SIZE;<br>
void *greedy;<br>
<br>
all_thread_created = 0;<br>
@@ -222,8 +218,10 @@ rtems_task Init(rtems_task_argument argument)<br>
<br>
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION<br>
<br>
-#define CONFIGURE_MAXIMUM_TASKS rtems_resource_unlimited(10)<br>
-#define CONFIGURE_MAXIMUM_POSIX_KEYS 1<br>
+#define CONFIGURE_MAXIMUM_TASKS rtems_resource_unlimited(INITIAL_TASK_COUNT)<br>
+#define CONFIGURE_MAXIMUM_POSIX_KEYS 1<br>
+#define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS \<br>
+ (INITIAL_TASK_COUNT + ADDITIONAL_TASK_COUNT)<br>
#define CONFIGURE_UNIFIED_WORK_AREAS<br>
<br>
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE<br>
-- <br>
2.35.3<br>
<br>
_______________________________________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
</blockquote></div>