Skip to content

Refer to HPX by its fully qualified name in macros - #8175

Merged
hkaiser merged 2 commits into
masterfrom
qualify-hpx-in-macros
Nov 21, 2026
Merged

hkaiser merged 2 commits into
masterfrom
qualify-hpx-in-macros

Conversation

@hkaiser

@hkaiser hkaiser commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

HPX's macros referred to HPX as hpx::.... Inside a namespace that has a nested namespace hpx of its own, that name finds the nested namespace instead. For instance, HPX_ASSERT inside thrust::system::hpx (the HPX backend of Thrust, NVIDIA/cccl#7680) doesn't compile in Debug builds: no member named 'util' in namespace 'thrust::system::hpx'.

The macros in the public headers now use ::hpx:: (197 places in 26 headers): assertions, errors, futures, logging, tracing, serialization, type support, functional, plugins, runtime configuration, actions, components, channels, parcelset and the compression filters. namespace hpx::... { and the class heads of explicit specializations are left as they are: the first can't be qualified, and both are only used at namespace scope.

The new test macros_nested_hpx_namespace (in the include module) uses the macros inside a namespace with a nested hpx namespace: at function scope (assertions, exceptions, exceptional futures, logging), at class scope (HPX_SERIALIZATION_SPLIT_MEMBER, HPX_DEFINE_COMPONENT_ACTION) and at namespace scope (HPX_DEFINE_PLAIN_ACTION). With the previous headers it fails to compile.

While at it: in the Pth context (OS X before 10.5), HPX_COROUTINE_DESTROY_CONTEXT was part of HPX_COROUTINE_SWAP_CONTEXT because of a missing line break. It is now defined separately.

Tested with a Debug build with clang 23 (the libraries, the examples and the unit tests of the changed modules); the 89 unit tests of these modules pass.

A missing line break made the definition of HPX_COROUTINE_DESTROY_CONTEXT
part of HPX_COROUTINE_SWAP_CONTEXT in the Pth context (OS X before 10.5).

Signed-off-by: Hartmut Kaiser <hartmut.kaiser@gmail.com>
Inside a namespace with a nested namespace hpx of its own (as for instance
thrust::system::hpx), the unqualified hpx:: of the macros found the nested
namespace instead. They now use ::hpx::, except in 'namespace hpx::... {'
and in the class heads of explicit specializations, which are at namespace
scope only. The new test macros_nested_hpx_namespace uses the macros inside
such a namespace.

Signed-off-by: Hartmut Kaiser <hartmut.kaiser@gmail.com>
@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • Improved the reliability of HPX macros when used inside namespaces that define their own hpx namespace.
    • Added a unit test covering common macros in this nested-namespace scenario.

The changes add global ::hpx qualification to macro references across HPX core and full libraries. A new unit test exercises selected macros from a namespace that contains a nested hpx namespace.

Changes: Macro namespace qualification

Layer / File(s) Summary
Core utility and execution macros
libs/core/assertion/.../macros.hpp, libs/core/coroutines/.../context_posix.hpp, libs/core/errors/.../macros.hpp, libs/core/execution/..., libs/core/execution_base/..., libs/core/futures/..., libs/core/iterator_support/..., libs/core/logging/..., libs/core/prefix/..., libs/core/tracing/...
Core assertion, coroutine, error, execution, future, iterator, logging, prefix, and tracing macro references now use globally qualified HPX names.
Serialization macros
libs/core/serialization/include/hpx/serialization/macros.hpp
Serialization archive types, registration functions, and related type references now use globally qualified HPX names.
Filter, plugin, and component registration macros
components/parcel_plugins/binary_filter/*/include/hpx/..., libs/core/plugin/include/hpx/plugin/macros.hpp, libs/core/runtime_configuration/.../macros.hpp, libs/core/runtime_local/.../macros.hpp, libs/full/components_base/.../macros.hpp, libs/full/plugin_factories/.../macros.hpp, libs/full/runtime_components/.../macros.hpp
Binary-filter, plugin, runtime-configuration, and component registration macros now use globally qualified HPX types and functions.
Action and asynchronous registration macros
libs/full/actions/include/hpx/actions/macros.hpp, libs/full/actions_base/include/hpx/actions_base/macros.hpp, libs/full/async_colocated/include/hpx/async_colocated/macros.hpp, libs/full/lcos_distributed/include/hpx/lcos_distributed/macros.hpp
Action, async-colocated, and channel registration macros now use globally qualified HPX names.
Nested-namespace test coverage
libs/full/include/tests/unit/CMakeLists.txt, libs/full/include/tests/unit/macros_nested_hpx_namespace.cpp
The unit test list adds a test that exercises selected HPX macros inside a namespace containing a nested hpx namespace.

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Bug fix

Suggested reviewers: v4xsh, rohanonkeys

Merge Risk: Minimal · up to 16c8f

The change qualifies HPX names in public macros so they resolve correctly when used inside a namespace that contains a nested hpx namespace. No actionable merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: HPX macros now refer to HPX by its fully qualified name. The raw summary confirms the bulk of the changeset replaces relative hpx:: references with ::hpx:: across …
Description check Passed The description explains the cause (a nested hpx namespace hides ::hpx in unqualified lookup), lists the affected header areas, describes the new macros_nested_hpx_namespace test, and notes the …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: HPX macros now refer to HPX by its fully qualified name. The raw summary confirms the bulk of the changeset replaces relative hpx:: references with ::hpx:: across public macro headers. The title is specific and matches the objectives.

Full details: Description check

Explanation

The description explains the cause (a nested hpx namespace hides ::hpx in unqualified lookup), lists the affected header areas, describes the new macros_nested_hpx_namespace test, and notes the Pth context macro fix. These match the raw summary and objectives.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 530a192f-5636-4827-8b8d-6ac6b4762f46
Commits

Reviewing files that changed from the base of the PR and between 0a77777 and 16c8ffd.

Files selected for processing: 28

  • components/parcel_plugins/binary_filter/bzip2/include/hpx/binary_filter/bzip2_serialization_filter_registration.hpp
  • components/parcel_plugins/binary_filter/snappy/include/hpx/binary_filter/snappy_serialization_filter_registration.hpp
  • components/parcel_plugins/binary_filter/zlib/include/hpx/binary_filter/zlib_serialization_filter_registration.hpp
  • libs/core/assertion/include/hpx/assertion/macros.hpp
  • libs/core/coroutines/include/hpx/coroutines/detail/context_posix.hpp
  • libs/core/errors/include/hpx/errors/macros.hpp
  • libs/core/execution/include/hpx/execution/algorithms/detail/predicates.hpp
  • libs/core/execution/include/hpx/execution/executors/execution_parameters.hpp
  • libs/core/execution_base/include/hpx/execution_base/traits/is_executor.hpp
  • libs/core/futures/include/hpx/futures/macros.hpp
  • libs/core/iterator_support/include/hpx/iterator_support/iterator_facade.hpp
  • libs/core/logging/include/hpx/logging/detail/macros.hpp
  • libs/core/logging/include/hpx/logging/macros.hpp
  • libs/core/plugin/include/hpx/plugin/macros.hpp
  • libs/core/prefix/include/hpx/prefix/macros.hpp
  • libs/core/runtime_configuration/include/hpx/runtime_configuration/macros.hpp
  • libs/core/runtime_local/include/hpx/runtime_local/macros.hpp
  • libs/core/serialization/include/hpx/serialization/macros.hpp
  • libs/core/tracing/include/hpx/tracing/macros.hpp
  • libs/full/actions/include/hpx/actions/macros.hpp
  • libs/full/actions_base/include/hpx/actions_base/macros.hpp
  • libs/full/async_colocated/include/hpx/async_colocated/macros.hpp
  • libs/full/components_base/include/hpx/components_base/macros.hpp
  • libs/full/include/tests/unit/CMakeLists.txt
  • libs/full/include/tests/unit/macros_nested_hpx_namespace.cpp
  • libs/full/lcos_distributed/include/hpx/lcos_distributed/macros.hpp
  • libs/full/plugin_factories/include/hpx/plugin_factories/macros.hpp
  • libs/full/runtime_components/include/hpx/runtime_components/macros.hpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

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.

@hkaiser
hkaiser merged commit e662f93 into master Nov 21, 2026
160 checks passed
@hkaiser
hkaiser deleted the qualify-hpx-in-macros branch November 21, 2026 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant