summaryrefslogtreecommitdiff
path: root/common_modules/module_lib/src/txm_timer_create.c
diff options
context:
space:
mode:
authorFrédéric Desbiens <[email protected]>2026-09-28 14:08:13 -0400
committerGitHub <[email protected]>2026-09-28 14:08:13 -0400
commitcf577c713719a2f1603624d7974ea55beb370d30 (patch)
treeaec7148b0ff2748745331f532b9acf4a0ccb1419 /common_modules/module_lib/src/txm_timer_create.c
parent83361990cb4d03da8851e30030688ed3abb4d840 (diff)
Made ThreadX object names const-qualifiable behind an option (#761)
Fixes #61 Object names are exposed as writable pointers throughout the kernel API, which rejects string literals in C++ and lets a caller modify a name an object still holds. Information services return those names through writable double pointers. Create services, control blocks, information services, the module manager and trace registration now preserve const qualification, behind TX_ENABLE_CONST_NAMES. The option defaults to off, so a build that says nothing gets exactly the types it got before. It is opt-in rather than opt-out because it changes the type of a public struct field: application code that copies a name into a writable CHAR * stops compiling, which is a reasonable thing to ask of a minor release and not of a patch one. Issue #780 tracks making it the default in 6.6. Two things the option reaches that its own call sites do not. TX_CHAR_TO_UCHAR_POINTER_CONVERT has exactly two users, both of them reading an object name in _tx_trace_object_register, and every form of that macro but the MISRA one casts the qualifier away without saying so; the conversion is now const in and const out, so nothing launders const to make the build pass. The FreeRTOS adapter holds the name pcTaskGetName retrieves in a TX_NAME_CONST pointer so that it tracks whichever declaration tx_thread_info_get has, and keeps its writable return type through an explicit MISRA C:2012 Rule 11.8 cast, because that signature is part of the FreeRTOS API. Default build: all seven host configurations and all five SMP configurations build with zero warnings and pass -- 113/113 on five host configurations, 100/100 on the two MISRA builds, 118/118 on SMP, 3/3 FreeRTOS. With TX_ENABLE_CONST_NAMES set, the host default and both MISRA configurations, the SMP trace configuration and the FreeRTOS adapter build with zero warnings and pass. Co-authored-by: Tilen Majerle <[email protected]> Assisted-by: Codex (gpt-6-astra) <[email protected]> Assisted-by: Claude Code (Opus 5) <[email protected]>
Diffstat (limited to 'common_modules/module_lib/src/txm_timer_create.c')
-rw-r--r--common_modules/module_lib/src/txm_timer_create.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/common_modules/module_lib/src/txm_timer_create.c b/common_modules/module_lib/src/txm_timer_create.c
index d65989eb..7adba901 100644
--- a/common_modules/module_lib/src/txm_timer_create.c
+++ b/common_modules/module_lib/src/txm_timer_create.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+/* Portions of this file were generated with AI assistance. */
+
/**************************************************************************/
/**************************************************************************/
@@ -65,7 +67,7 @@
/* Module application code */
/* */
/**************************************************************************/
-UINT _txe_timer_create(TX_TIMER *timer_ptr, CHAR *name_ptr, VOID (*expiration_function)(ULONG), ULONG expiration_input, ULONG initial_ticks, ULONG reschedule_ticks, UINT auto_activate, UINT timer_control_block_size)
+UINT _txe_timer_create(TX_TIMER *timer_ptr, TX_NAME_CONST CHAR *name_ptr, VOID (*expiration_function)(ULONG), ULONG expiration_input, ULONG initial_ticks, ULONG reschedule_ticks, UINT auto_activate, UINT timer_control_block_size)
{
UINT return_value;