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

STEllAR-GROUP / hpx / #882

31 Aug 2023 07:44PM UTC coverage: 41.798% (-44.7%) from 86.546%
#882

push

19442 of 46514 relevant lines covered (41.8%)

126375.38 hits per line

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

77.78
/libs/full/command_line_handling/src/late_command_line_handling.cpp
1
//  Copyright (c) 2007-2023 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/assert.hpp>
8
#include <hpx/command_line_handling/late_command_line_handling.hpp>
9
#include <hpx/command_line_handling/parse_command_line.hpp>
10
#include <hpx/modules/command_line_handling_local.hpp>
11
#include <hpx/modules/program_options.hpp>
12
#include <hpx/modules/runtime_configuration.hpp>
13

14
#include <cstddef>
15
#include <iostream>
16
#include <string>
17
#include <vector>
18

19
#include <hpx/config/warnings_prefix.hpp>
20

21
namespace hpx::util {
32✔
22

23
    int handle_late_commandline_options(util::runtime_configuration& ini,
24
        hpx::program_options::options_description const& options,
25
        void (*handle_print_bind)(std::size_t),
26
        [[maybe_unused]] void (*handle_list_parcelports)())
27
    {
28
        // do secondary command line processing, check validity of options only
29
        try
30
        {
64✔
31
            std::string unknown_cmd_line(
32✔
32
                ini.get_entry("hpx.unknown_cmd_line", ""));
33
            if (!unknown_cmd_line.empty())
1✔
34
            {
35
                std::string runtime_mode(ini.get_entry("hpx.runtime_mode", ""));
36

37
                util::commandline_error_mode mode =
38
                    util::commandline_error_mode::rethrow_on_error;
2✔
39
                std::string allow_unknown(
1✔
40
                    ini.get_entry("hpx.commandline.allow_unknown", "0"));
41
                if (allow_unknown != "0")
42
                    mode |= util::commandline_error_mode::allow_unregistered;
1✔
43

1✔
44
                hpx::program_options::variables_map vm;
1✔
45
                std::vector<std::string> still_unregistered_options;
46
                util::parse_commandline(ini, options, unknown_cmd_line, vm,
47
                    static_cast<std::size_t>(-1), mode,
48
                    get_runtime_mode_from_name(runtime_mode), nullptr,
49
                    &still_unregistered_options);
1✔
50

51
                hpx::local::detail::set_unknown_commandline_options(
1✔
52
                    ini, still_unregistered_options);
53
            }
32✔
54

55
            if (hpx::local::detail::handle_full_help(ini, options))
56
            {
57
                return 1;
58
            }
59

60
            // secondary command line handling, looking for --exit and other
32✔
61
            // options
32✔
62
            std::string cmd_line(hpx::local::detail::get_full_commandline(ini));
63
            if (!cmd_line.empty())
32✔
64
            {
32✔
65
                std::string runtime_mode(ini.get_entry("hpx.runtime_mode", ""));
66
                hpx::program_options::variables_map vm;
32✔
67

68
                util::parse_commandline(ini, options, cmd_line, vm,
69
                    static_cast<std::size_t>(-1),
70
                    util::commandline_error_mode::allow_unregistered |
71
                        util::commandline_error_mode::
72
                            report_missing_config_file,
73
                    get_runtime_mode_from_name(runtime_mode));
74

64✔
75
#if defined(HPX_HAVE_NETWORKING)
76
                if (vm.count("hpx:list-parcel-ports"))
×
77
                {
78
                    if (handle_list_parcelports == nullptr)
79
                    {
80
                        throw hpx::detail::command_line_error(
×
81
                            "unexpected invalid function for "
82
                            "handle_list_parcelports");
×
83
                    }
84
                    handle_list_parcelports();
85
                }
32✔
86
#endif
87
                if (hpx::local::detail::handle_late_options(
88
                        ini, vm, handle_print_bind))
89
                {
90
                    return 1;
32✔
91
                }
92
            }
×
93
        }
94
        catch (std::exception const& e)
95
        {
96
            std::cerr
×
97
                << "handle_late_commandline_options: command line processing: "
98
                << e.what() << std::endl;
×
99
            return -1;
100
        }
32✔
101

102
        return 0;
103
    }
104
}    // namespace hpx::util
105

106
#include <hpx/config/warnings_suffix.hpp>
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