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

TRACE_EVENT expands to 3 statements #18

Open
olvaffe opened this issue May 17, 2021 · 3 comments
Open

TRACE_EVENT expands to 3 statements #18

olvaffe opened this issue May 17, 2021 · 3 comments

Comments

@olvaffe
Copy link
Owner

olvaffe commented May 17, 2021

It seems TRACE_EVENT expands to 3 statements. That might not work with

if (some_condition)
    TRACE_EVENT(...);

without braces.

@Wallbraker
Copy link
Contributor

You can fix that with a do { /* ...what was in TRACE_EVENT before... */ } while (false) statement.

@olvaffe
Copy link
Owner Author

olvaffe commented Jun 14, 2021

That will fail

{
  TRACE_EVENT(...);
  function_that_is_slow_and_is_to_be_traced();
}

@Wallbraker
Copy link
Contributor

Oh you are right, there really is no way around it.

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

No branches or pull requests

2 participants