• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

STEllAR-GROUP / hpx / #867

15 Jan 2023 08:00PM UTC coverage: 86.487% (+0.5%) from 85.951%
#867

push

StellarBot
Merge #6135

6135: Fixing warnings reported by MSVC analysis r=hkaiser a=hkaiser

- adding MSVC specific #pragma's to suppress the benign warnings


Co-authored-by: Hartmut Kaiser <hartmut.kaiser@gmail.com>

120 of 120 new or added lines in 33 files covered. (100.0%)

174599 of 201880 relevant lines covered (86.49%)

1945607.64 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

33.33
/libs/full/async_distributed/tests/unit/post_remote_client.cpp
1
//  Copyright (c) 2007-2015 Hartmut Kaiser
2
//
3
//  SPDX-License-Identifier: BSL-1.0
4
//  Distributed under the Boost Software License, Version 1.0. (See accompanying
5
//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6

7
#include <hpx/config.hpp>
8
#if !defined(HPX_COMPUTE_DEVICE_CODE)
9
#include <hpx/hpx_init.hpp>
10
#include <hpx/include/actions.hpp>
11
#include <hpx/include/components.hpp>
12
#include <hpx/include/lcos.hpp>
13
#include <hpx/include/post.hpp>
14
#include <hpx/include/runtime.hpp>
15
#include <hpx/modules/testing.hpp>
16

17
#include <atomic>
18
#include <cstdint>
19
#include <mutex>
20
#include <vector>
21

22
///////////////////////////////////////////////////////////////////////////////
23
bool root_locality = false;
24
std::int32_t final_result;
25
hpx::util::spinlock result_mutex;
1✔
26

27
void receive_result(std::int32_t i)
×
28
{
29
    std::lock_guard<hpx::util::spinlock> l(result_mutex);
×
30
    if (i > final_result)
×
31
        final_result = i;
×
32
}
×
33
HPX_PLAIN_ACTION(receive_result)
18✔
34

35
///////////////////////////////////////////////////////////////////////////////
36
std::atomic<std::int32_t> accumulator;
37

38
///////////////////////////////////////////////////////////////////////////////
39
struct increment_server
4✔
40
  : hpx::components::managed_component_base<increment_server>
41
{
42
    void call(hpx::id_type const& there, std::int32_t i) const
7✔
43
    {
44
        accumulator += i;
7✔
45
        hpx::post(receive_result_action(), there, accumulator.load());
7✔
46
    }
7✔
47

48
    HPX_DEFINE_COMPONENT_ACTION(increment_server, call)
49
};
50

51
typedef hpx::components::managed_component<increment_server> server_type;
52
HPX_REGISTER_COMPONENT(server_type, increment_server)
53✔
53

54
typedef increment_server::call_action call_action;
55
HPX_REGISTER_ACTION_DECLARATION(call_action)
56
HPX_REGISTER_ACTION(call_action)
10✔
57

58
///////////////////////////////////////////////////////////////////////////////
59
int hpx_main()
×
60
{
61
    hpx::id_type here = hpx::find_here();
×
62
    hpx::id_type there = here;
×
63
    root_locality = true;
×
64

65
    if (hpx::get_num_localities(hpx::launch::sync) > 1)
×
66
    {
67
        std::vector<hpx::id_type> localities = hpx::find_remote_localities();
×
68
        there = localities[0];
×
69
    }
×
70

71
    typedef hpx::components::client<increment_server> increment_client;
72

73
    {
74
        increment_client inc = hpx::components::new_<increment_client>(there);
×
75

76
        using hpx::placeholders::_1;
77
        using hpx::placeholders::_2;
78
        using hpx::placeholders::_3;
79

80
        call_action call;
81
        hpx::post(call, inc, here, 1);
×
82
        hpx::post(hpx::bind(call, inc, here, 1));
×
83
        hpx::post(hpx::bind(call, inc, here, _1), 1);
×
84
        hpx::post(hpx::bind(call, _1, here, 1), inc);
×
85
        hpx::post(hpx::bind(call, _1, _2, 1), inc, here);
×
86
        hpx::post(hpx::bind(call, _1, _2, _3), inc, here, 1);
×
87
    }
×
88

89
    {
90
        increment_client inc = hpx::components::new_<increment_client>(there);
×
91

92
        hpx::post<call_action>(inc, here, 1);
×
93
    }
×
94

95
    // Let finalize wait for every "apply" to be finished
96
    return hpx::finalize();
×
97
}
×
98

99
int main(int argc, char* argv[])
1✔
100
{
101
    accumulator.store(0);
1✔
102

103
    // Initialize and run HPX
104
    HPX_TEST_EQ_MSG(
1✔
105
        hpx::init(argc, argv), 0, "HPX main exited with non-zero status");
106

107
    // After hpx::init returns, all actions should have been executed
108
    // The final result is only accumulated on the root locality
109
    if (root_locality)
1✔
110
        HPX_TEST_EQ(final_result, 7);
×
111

112
    return hpx::util::report_errors();
1✔
113
}
×
114
#endif
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc