Skip to content

actions_base: reimplement HPX_DEFINE_PLAIN_ACTION_2 using C++26 reflection#7280

Draft
Priyanshi507 wants to merge 1 commit into
TheHPXProject:masterfrom
Priyanshi507:reflect-plain-action-macro
Draft

actions_base: reimplement HPX_DEFINE_PLAIN_ACTION_2 using C++26 reflection#7280
Priyanshi507 wants to merge 1 commit into
TheHPXProject:masterfrom
Priyanshi507:reflect-plain-action-macro

Conversation

@Priyanshi507
Copy link
Copy Markdown
Contributor

Summary

When HPX_HAVE_CXX26_REFLECTION is defined, HPX_DEFINE_PLAIN_ACTION_2
now uses reflect_action<^^func> internally:

Before:

struct name : hpx::actions::make_action_t<decltype(&func), &func, name> {};

After (with reflection):

using name = hpx::actions::reflect_action<^^func>;

Key insight

The first macro argument func is a named entity at the call site —
not a template parameter — so ^^func works correctly on both
GCC trunk and Clang P2996.

User impact

Zero — same macro syntax, reflection used internally:

HPX_PLAIN_ACTION(app::compute, compute_action)  // unchanged

Backwards compatibility

Non-reflection paths (NVCC/CUDACC and standard C++) are preserved unchanged.

Checklist

  • I have added a new feature and have added tests to go along with it.

When HPX_HAVE_CXX26_REFLECTION is defined, HPX_DEFINE_PLAIN_ACTION_2
now expands to:

  using name = hpx::actions::reflect_action<^^func>

instead of the verbose make_action_t struct definition. This keeps
the exact same user-facing macro syntax (HPX_PLAIN_ACTION/
HPX_DEFINE_PLAIN_ACTION) while using C++26 reflection internally,
eliminating the need for HPX_REGISTER_ACTION.

The non-reflection paths (NVCC/CUDACC and standard) are preserved
unchanged for backwards compatibility.

Signed-off-by: Priyanshi507 <hiiuiuiabi@gmail.com>
@Priyanshi507 Priyanshi507 requested a review from hkaiser as a code owner May 19, 2026 23:38
@codacy-production
Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@StellarBot
Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@Priyanshi507 Priyanshi507 marked this pull request as draft May 20, 2026 00:07
@Priyanshi507
Copy link
Copy Markdown
Contributor Author

Priyanshi507 commented May 20, 2026

@hkaiser
Converting this to draft the macro change is correct but \reflect_actionneeds to inherit frombasic_action<detail::plain_function, func_type, reflect_action> to provide the required typedefs (component_type, result_type, etc.) for transfer_action. I've verified the two-step approach works in isolation. The next PR will add this inheritance to reflect_action and then this macro change will follow. Marking as draft until then.

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