Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

const: Add const keyword for all name pointer parameters #414

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MaJerle
Copy link

@MaJerle MaJerle commented Oct 2, 2024

This pull requests fixes the compiler warning when creating TX objects with literal strings since we are passing literal string to the function accepting CHAR *, that can, by design, modify input parameter and therefore cause undefined system behavior.

All name pointers become const CHAR* type.

There is no backward incompatibility when creating objects, but there is a potential backward in-compatibility when calling tx_<modulename>_name_get function, because parameter shall be changed to const char* variable.

Currently we can get the name as:

CHAR* name;
tx_thread_name_get(..., &name);

New required function call:

const CHAR* name;
tx_thread_name_get(..., &name);

I've not seen tests for getting the name in the threadx, I also clearly assume that people using _get api are the minority.
From safety and quality standpoint, this upgrade makes a lot of sense.

PR checklist

  • Updated function header with a short description and version number
  • Added test case for bug fix or new feature
  • Validated on real hardware C-M4, GCC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant