Skip to content
New issue

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

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

Already on GitHub? # to your account

Fix disabling traces through the YOTTA_CFG_MBED_TRACE flag. #45

Merged
merged 1 commit into from
Jul 13, 2016

Conversation

tommikas
Copy link

Previously only the existence of the flag was checked. Thus tracing was always enabled if the flag was defined regardless of its actual value, including when it was defined as 0 or false.

Now tracing is enabled when YOTTA_CFG_MBED_TRACE is defined as an empty define (which was previously accepted), 1 or true.
Tracing is disabled when the flag is undefined, or defined as 0 or false.

@tommikas
Copy link
Author

@jupe @kjbracey-arm Could you have a look at this please.

@kjbracey
Copy link
Contributor

Changing to #if rather than #ifdef on the main test is correct, as it means true/false works as desired in the JSON.

Don't think the other hackery is worthwhile. It's supporting the option mbed-trace: "", or someone trying to simulate it, which is not what was ever intended.

If anyone is doing just "#define YOTTA_CFG_MBED_TRACE", they've made an error, and it will fail loudly.

Previously only the existence of the flag was checked. Thus tracing was always enabled if the flag was defined
regardless of its actual value, including when it was defined as 0 or false.

Now tracing is only enabled when YOTTA_CFG_MBED_TRACE is defined as 1 or true.
Tracing is disabled when the flag is undefined, or defined as 0 or false.
@tommikas tommikas force-pushed the trace-enable-change branch from 451187d to ae82036 Compare July 13, 2016 09:15
@tommikas
Copy link
Author

Now it only accepts 0/false, 1/true and undefined. There's at least some unittest related stuff I know of that does "#define XX", which will need to be changed.

@jupe
Copy link
Contributor

jupe commented Jul 13, 2016

looks that this is not anymore backward compatible,,,,not good, but maybe reasonable because yotta has proper dependency handling....
see example: https://github.com/ARMmbed/mbed-trace#usage-example

@jupe jupe merged commit 7030a75 into master Jul 13, 2016
@jupe jupe deleted the trace-enable-change branch July 13, 2016 11:12
tommikas pushed a commit that referenced this pull request Jun 16, 2017
* origin/master: (22 commits)
  output/ added to gitignore list (#66)
  Added include_directories(${CMAKE_CURRENT_SOURCE_DIR}/) include to resolve compilation error for Linux. (#63)
  Ensure tr_array doesn't print <null> when len == 0 (#65)
  Add CMakeLists.txt to support PAL Tools (#61)
  Fix header documentation (#58)
  Update README.md (#57)
  Provide environment-agnostic configuration macros. (#54)
  Flash size can be limited by defining MBED_TRACE_MAX_LEVEL
  Use temp variable in mutex release loop (#52)
  Fix race condition when unlocking mutex
  Add instructions for enabling the library in mbed OS 5. (#50)
  document update. (#47)
  Allow setting mutex locking/unlocking callbacks before trace init. (#46)
  Ipv6 helpers update (#44)
  Fix disabling traces through the YOTTA_CFG_MBED_TRACE flag. (#45)
  Deprecate the misnamed YOTTA_CFG_MTRACE_TMP_LINE_LENGTH flag, which is to be removed in the next release. (#43)
  Changed dummy definitions to match the actual functions' return types (#40)
  FEA_TRACE_SUPPORT flag is always set when traces are enabled. (#39)
  Release merge to master (#38)
  Add nanostack-libservice lib to CMakeLists (#31)
  ...
@jupe jupe added this to the v1.2.2 milestone Jul 5, 2017
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants