MSVC warnings in environment.hpp and default_launcher.hpp

Open Beginner friendly
#570 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
88/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
cpp

Research direction

Start with the two files named in the report: v2/environment.hpp near line 1504, where the loop over pathext declares p again and hides an outer local, and v2/windows/default_launcher.hpp near line 397, where build_command_line_impl takes an unused args parameter. Build on MSVC to reproduce warnings C4456 and C4100. Done when both warnings are gone and the Windows tests still pass without behavior changes.

Written by the indexing model from the issue text.

Description

The first one is: "v2\environment.hpp(1504,18): warning C4456: declaration of 'p' hides previous local declaration"
In this code:

for (auto ext : pathext)
{
    ec.clear();
    BOOST_PROCESS_V2_NAMESPACE::filesystem::path nm(name);
    nm.concat(ext.begin(), ext.end());

    auto p = pp / nm;

    if (detail::is_executable(p, ec) && !ec)
        return p;
}

Should be probably changed to p = pp / nm;
The second one is on 2 lines (371, 397), showing only one as they are essentially the same: "v2\windows\default_launcher.hpp(397,39): warning C4100: 'args': unreferenced parameter"
In this code:

template<typename Argv>
static std::wstring build_command_line_impl(
            const filesystem::path & pt, 
            const Argv & argv,
            basic_string_view<char> args)

Commenting out the parameter should fix the warning.

Dominant language
C++
Stars
147
Forks
153
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/process

All issues in boostorg/process

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.