Skip to content

Conversation

@Domiii
Copy link

@Domiii Domiii commented Jun 27, 2024

@Domiii Domiii self-assigned this Jun 27, 2024
@Domiii Domiii requested review from klochek and toshok and removed request for klochek and toshok June 27, 2024 16:32
… dominik/tt-1480-assert-more-counter-code
@Domiii
Copy link
Author

Domiii commented Jul 9, 2024

The access checks were a red herring.

@Domiii Domiii closed this Jul 9, 2024
@Domiii Domiii deleted the dominik/tt-1480-assert-more-counter-code branch July 9, 2024 18:24
@Domiii Domiii restored the dominik/tt-1480-assert-more-counter-code branch July 9, 2024 18:25
@Domiii
Copy link
Author

Domiii commented Jul 9, 2024

We still need the macro changes.

@Domiii Domiii reopened this Jul 9, 2024
@Domiii Domiii requested a review from toshok July 9, 2024 18:35
static_assert(true, "require semicolon")

// Same as |REPLAY_ASSERT| but won't Assert if the given condition is not true.
#define REPLAY_ASSERT_IF(cond, format, ...) \
Copy link

@toshok toshok Jul 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can these be defined in terms of one another?

e.g. REPLAY_ASSERT_IF could be:

#define REPLAY_ASSERT_IF(cond, format, ...) \
  if (cond) REPLAY_ASSERT(format, ##__VA_ARGS__)

and REPLAY_ASSERT_MAYBE_EVENTS_DISALLOWED could be:

#define REPLAY_ASSERT_MAYBE_EVENTS_DISALLOWED(format, ...) \
  REPLAY_ASSERT_IF(!recordreplay::AreEventsDisallowed(), format, ##__VA_ARGS__);

or REPLAY_ASSERT_IF could be the one that's ultimately evaluated with REPLAY_ASSERT being defined as:

#define REPLAY_ASSERT(format, ...) \
  REPLAY_ASSERT_IF(true, format, ## __VA_ARGS__)

otherwise I'd be concerned about things diverging between the macros.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. ❌Your first suggestion is a no-go, because suddenly you are evaluating cond even when things are enabled.
  2. 🤷‍♀️ I don't like the unnecessary if (true) in your third suggestion.
  3. ✅ I'm not concerned at all, since this is is going to be a very small set of often-used macros.

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.

2 participants