• 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

90.0
/libs/full/components_base/include/hpx/components_base/server/wrapper_heap_list.hpp
1
//  Copyright (c) 1998-2021 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
#pragma once
8

9
#include <hpx/components_base/component_type.hpp>
10
#include <hpx/components_base/generate_unique_ids.hpp>
11
#include <hpx/components_base/server/one_size_heap_list.hpp>
12
#include <hpx/naming_base/id_type.hpp>
13
#include <hpx/thread_support/unlock_guard.hpp>
14

15
#include <type_traits>
16

17
///////////////////////////////////////////////////////////////////////////////
18
namespace hpx { namespace components { namespace detail {
19

20
    ///////////////////////////////////////////////////////////////////////////
21
    // list of managed_component heaps
22
    template <typename Heap>
23
    class wrapper_heap_list : public util::one_size_heap_list
2,723✔
24
    {
25
        using base_type = util::one_size_heap_list;
26
        using value_type = typename Heap::value_type;
27

28
        using storage_type = std::aligned_storage_t<sizeof(value_type),
29
            std::alignment_of<value_type>::value>;
30

31
        enum
32
        {
33
            // default initial number of elements
34
            heap_capacity = 0xFFF,
35
            // Alignment of one element
36
            heap_element_alignment = std::alignment_of_v<value_type>,
37
            // size of one element in the heap
38
            heap_element_size = sizeof(storage_type)
39
        };
40

41
    public:
42
        wrapper_heap_list()
6,082✔
43
          : base_type(
3,041✔
44
                get_component_type_name(
3,041✔
45
                    get_component_type<typename value_type::wrapped_type>()),
3,041✔
46
                base_type::heap_parameters{
3,041✔
47
                    heap_capacity, heap_element_alignment, heap_element_size},
48
                (Heap*) nullptr)
49
          , type_(get_component_type<typename value_type::wrapped_type>())
3,041✔
50
        {
3,041✔
51
        }
3,041✔
52

53
        naming::gid_type get_gid(void* p)
809,781✔
54
        {
55
            std::unique_lock guard(this->mtx_);
809,784✔
56

57
            using iterator = typename base_type::const_iterator;
58

59
            iterator end = this->heap_list_.end();
809,784✔
60
            for (iterator it = this->heap_list_.begin(); it != end; ++it)
809,781✔
61
            {
62
                if ((*it)->did_alloc(p))
809,784✔
63
                {
64
                    unlock_guard ul(guard);
809,782✔
65
                    return (*it)->get_gid(id_range_, p, type_);
809,782✔
66
                }
809,782✔
67
            }
×
68
            return naming::invalid_gid;
×
69
        }
809,784✔
70

71
        void set_range(
72
            naming::gid_type const& lower, naming::gid_type const& upper)
73
        {
74
            std::scoped_lock guard(this->mtx_);
75
            id_range_.set_range(lower, upper);
76
        }
77

78
    private:
79
        util::unique_id_ranges id_range_;
80
        components::component_type type_;
81
    };
82

83
}}}    // namespace hpx::components::detail
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

© 2025 Coveralls, Inc