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

Remove a bunch of unnecessary macros. #482

Merged
merged 1 commit into from Mar 13, 2024

Conversation

clalancette
Copy link
Contributor

The main goal here is to sidestep differences between uncrustify 0.72 and 0.78. However, I realized that a lot of these macros were either duplicating functionality we already had, or were just as long as "inlining" the code would be. Just get rid of these macros.

In the one place that we can't do this, just mark the macro as not to be indented by uncrustify.

The main goal here is to sidestep differences between
uncrustify 0.72 and 0.78.  However, I realized that a
lot of these macros were either duplicating functionality
we already had, or were just as long as "inlining" the code
would be.  Just get rid of these macros.

In the one place that we can't do this, just mark the
macro as not to be indented by uncrustify.

Signed-off-by: Chris Lalancette <clalancette@gmail.com>
Comment on lines +4361 to +4405
// Attach subscriptions
ws->subs.resize(0);
if (subs) {
ws->subs.reserve(subs->subscriber_count);
for (size_t i = 0; i < subs->subscriber_count; i++) {
auto x = static_cast<CddsSubscription *>(subs->subscribers[i]);
ws->subs.push_back(x);
dds_waitset_attach(ws->waitseth, x->rdcondh, nelems++);
}
}

// Attach guard conditions
ws->gcs.resize(0);
if (gcs) {
ws->gcs.reserve(gcs->guard_condition_count);
for (size_t i = 0; i < gcs->guard_condition_count; i++) {
auto x = static_cast<CddsGuardCondition *>(gcs->guard_conditions[i]);
ws->gcs.push_back(x);
dds_waitset_attach(ws->waitseth, x->gcondh, nelems++);
}
}

// Attach service servers
ws->srvs.resize(0);
if (srvs) {
ws->srvs.reserve(srvs->service_count);
for (size_t i = 0; i < srvs->service_count; i++) {
auto x = static_cast<CddsService *>(srvs->services[i]);
ws->srvs.push_back(x);
dds_waitset_attach(ws->waitseth, x->service.sub->rdcondh, nelems++);
}
}

// Attach service clients
ws->cls.resize(0);
if (cls) {
ws->cls.reserve(cls->client_count);
for (size_t i = 0; i < cls->client_count; i++) {
auto x = static_cast<CddsClient *>(cls->clients[i]);
ws->cls.push_back(x);
dds_waitset_attach(ws->waitseth, x->client.sub->rdcondh, nelems++);
}
}

// Attach events
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note to reviewers: this piece of code (and the DETACH below) are the places most likely to have some kind of problem during expansion. So please do a careful review of this section.

@clalancette
Copy link
Contributor Author

CI:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

@wjwwood wjwwood self-requested a review March 7, 2024 18:08
Copy link
Collaborator

@eboasson eboasson left a comment

Choose a reason for hiding this comment

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

LGTM!

@clalancette clalancette merged commit 5e74a90 into rolling Mar 13, 2024
2 checks passed
@clalancette clalancette deleted the clalancette/new-uncrustify-fixes branch March 13, 2024 19:00
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.

None yet

2 participants