-
-
Notifications
You must be signed in to change notification settings - Fork 542
Feat/compile time wrap check #7074
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
Open
shivansh023023
wants to merge
10
commits into
TheHPXProject:master
Choose a base branch
from
shivansh023023:feat/compile-time-wrap-check
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+47
−0
Open
Changes from 6 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ea3eaf6
Add hpx/local.hpp convenience header for single-node usage
shivansh023023 685ef35
build: add compile-time linker wrap check for Linux static builds
shivansh023023 d3567f8
fix: add missing static_linker_check.hpp and resolve CI failures
501de6e
fix: resolve CI failures for clang-format, circular-deps, inspect, an…
2bc2a5c
fix: resolve inspect and build failures
60b3bac
Suppress unused parameter warnings in local_header.cpp test
b5d25c3
PR#7074: finalize compile-time wrap check, remove rejected local.hpp
20e9e24
Fix C++20 modules build: remove export macro from single_sender_value…
571d5de
Fix inspect: replace non-ASCII em-dashes with ASCII -- in static_link…
4bd6baf
chore: remove redundant hpxinspect suppression
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
libs/core/config/include/hpx/config/static_linker_check.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| // Copyright (c) 2026 The STE||AR-Group | ||
| // | ||
| // SPDX-License-Identifier: BSL-1.0 | ||
| // Distributed under the Boost Software License, Version 1.0. (See accompanying | ||
| // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||
|
|
||
| // hpxinspect:linelength | ||
| #pragma once | ||
|
|
||
| #include <hpx/config/defines.hpp> | ||
|
|
||
| #if defined(HPX_HAVE_DYNAMIC_HPX_MAIN) | ||
| #if (defined(__linux) || defined(__linux__) || defined(linux) || \ | ||
| defined(__APPLE__)) && \ | ||
| defined(HPX_HAVE_STATIC_LINKING) && \ | ||
| !defined(HPX_HAVE_WRAP_MAIN_CONFIGURED) | ||
| #warning \ | ||
| "You are statically linking HPX on Linux/macOS while using hpx_main.hpp. Please ensure you manually configure the linker to use wrap_main, or use the CMake target HPX::wrap_main to avoid linking errors." | ||
| #endif | ||
| #endif | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| // Copyright (c) 2020-2026 The STE||AR-Group | ||
| // | ||
| // SPDX-License-Identifier: BSL-1.0 | ||
| // Distributed under the Boost Software License, Version 1.0. (See accompanying | ||
| // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||
|
|
||
| /// \file hpx/local.hpp | ||
| /// \brief Single-include convenience header for single-node HPX usage. | ||
| /// | ||
| /// This header bundles the **Standard Parallel Toolkit** -- the most commonly | ||
| /// used HPX facilities for local (single-node) execution: | ||
| /// | ||
| /// - \c hpx/modules/algorithms.hpp -- Parallel algorithms (for_each, sort, ...) | ||
| /// - \c hpx/modules/execution.hpp -- Execution policies (par, par_unseq, seq) | ||
| /// - \c hpx/modules/futures.hpp -- Futures and dataflow | ||
| /// - \c hpx/numeric.hpp -- Parallel numeric (reduce, transform_reduce, ...) | ||
| /// | ||
| /// **Selection criteria**: each header is part of the HPX core module, | ||
| /// provides ISO C++ Standard Library parallel equivalents, and has no | ||
| /// dependency on the distributed runtime or networking layer. | ||
| /// | ||
| /// \note This header intentionally does NOT include hpx/hpx_main.hpp. | ||
| /// Including hpx_main.hpp has observable side effects: it emits | ||
| /// non-weak symbol definitions and redefines 'main' via a | ||
| /// preprocessor macro. Users who need the zero-boilerplate HPX | ||
| /// runtime entry-point should include hpx/hpx_main.hpp explicitly. | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <hpx/config.hpp> | ||
|
|
||
| // --- Standard Parallel Toolkit (core, no networking dependency) --- | ||
| #include <hpx/modules/algorithms.hpp> | ||
| #include <hpx/modules/execution.hpp> | ||
| #include <hpx/modules/futures.hpp> | ||
| #include <hpx/numeric.hpp> | ||
|
hkaiser marked this conversation as resolved.
Outdated
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,26 @@ | ||
| # Copyright (c) 2020-2021 The STE||AR-Group | ||
| # Copyright (c) 2026 The STE||AR-Group | ||
| # | ||
| # SPDX-License-Identifier: BSL-1.0 | ||
| # Distributed under the Boost Software License, Version 1.0. (See accompanying | ||
| # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||
|
|
||
| set(tests local_header) | ||
|
|
||
| set(local_header_FLAGS NOLIBS DEPENDENCIES HPX::hpx HPX::wrap_main) | ||
|
|
||
| foreach(test ${tests}) | ||
| set(sources ${test}.cpp) | ||
|
|
||
| source_group("Source Files" FILES ${sources}) | ||
|
|
||
| set(folder_name "Tests/Unit/Modules/Core/IncludeLocal") | ||
|
|
||
| add_hpx_executable( | ||
| ${test}_test INTERNAL_FLAGS | ||
| SOURCES ${sources} ${${test}_FLAGS} | ||
| EXCLUDE_FROM_ALL | ||
| FOLDER ${folder_name} | ||
| ) | ||
|
|
||
| add_hpx_unit_test("modules.include_local" ${test} ${${test}_PARAMETERS}) | ||
| endforeach() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| // Copyright (c) 2020-2026 The STE||AR-Group | ||
| // | ||
| // SPDX-License-Identifier: BSL-1.0 | ||
| // Distributed under the Boost Software License, Version 1.0. (See accompanying | ||
| // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||
|
|
||
| // Verify that hpx/local.hpp provides access to the Standard Parallel Toolkit: | ||
| // parallel algorithms, numeric algorithms, and execution policies. | ||
| // | ||
| // We use hpx::local::init to drive the HPX runtime without requiring any | ||
| // dependency on the wrap module (hpx_main.hpp / HPX::wrap_main). | ||
|
|
||
| #include <hpx/config.hpp> | ||
| #include <hpx/init.hpp> | ||
| #include <hpx/local.hpp> | ||
|
|
||
| #include <cstddef> | ||
| #include <iostream> | ||
| #include <numeric> | ||
| #include <vector> | ||
|
|
||
| int test_main(int argc, char* argv[]) | ||
| { | ||
| (void) argc; | ||
| (void) argv; | ||
| // 1. Verify parallel algorithms are reachable via hpx/local.hpp | ||
| std::vector<int> v(100); | ||
| std::iota(v.begin(), v.end(), 1); | ||
|
|
||
| hpx::for_each( | ||
| hpx::execution::par, v.begin(), v.end(), [](int& x) { x *= 2; }); | ||
|
|
||
| // 2. Verify numeric algorithms are reachable | ||
| int sum = hpx::reduce(hpx::execution::par, v.begin(), v.end(), 0); | ||
|
|
||
| std::cout << "reduce sum: " << sum << std::endl; | ||
|
|
||
| return hpx::local::finalize(); | ||
| } | ||
|
|
||
| int main(int argc, char* argv[]) | ||
| { | ||
| return hpx::local::init(test_main, argc, argv); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @hkaiser
Yes, we still need it. I kept the suppression because the #warning diagnostic message explaining how to fix the linker issue (using HPX::wrap_main or -Wl,--wrap=main) is longer than 80 characters.
I wanted the message to be as clear and actionable as possible for the user, which unfortunately makes it fail the inspect tool's line-length check. If you’d prefer, I can try to break the warning across multiple lines, but the suppression was the cleanest way to keep the message readable in the compiler output.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But you have split the line using
\continuation characters. I don't think inspect will concatenate the split line to check whether its longer than allowed. This comment should not be necessary.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That’s a fair point. I was under the impression that the tool might evaluate the logical line length, but if it only checks physical line length, then you're right,the line continuations already solve the problem.
I’ll remove the hpxinspect:linelength suppression and push the change now. If the CI 'inspect' tool still flags it for some reason, I'll know for sure, but it's better to keep the code clean of unnecessary suppressions. Thanks for the correction!