Skip to content

Commit

Permalink
[vcpkg] Fix microsoft#13094 by avoiding the comma operator. (microsof…
Browse files Browse the repository at this point in the history
…t#13117)

* Fix microsoft#13094 by avoiding the comma operator.

Drive-by remove unused parenthesis and remove macro inversion in metrics.cpp.
  • Loading branch information
BillyONeal committed Aug 25, 2020
1 parent f24b34d commit 7e5b515
Show file tree
Hide file tree
Showing 17 changed files with 32 additions and 33 deletions.
8 changes: 6 additions & 2 deletions src/vcpkg-test/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ namespace vcpkg::Test
ec.assign(errno, std::system_category());
}
#else
(void)(target, file, ec);
(void)target;
(void)file;
(void)ec;
vcpkg::Checks::exit_with_message(VCPKG_LINE_INFO, no_filesystem_message);
#endif
}
Expand All @@ -217,7 +219,9 @@ namespace vcpkg::Test
#elif FILESYSTEM_SYMLINK == FILESYSTEM_SYMLINK_UNIX
::vcpkg::Test::create_symlink(target, file, ec);
#else
(void)(target, file, ec);
(void)target;
(void)file;
(void)ec;
vcpkg::Checks::exit_with_message(VCPKG_LINE_INFO, no_filesystem_message);
#endif
}
Expand Down
2 changes: 1 addition & 1 deletion src/vcpkg/base/files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ namespace vcpkg::Files
std::error_code& ec) override
{
this->rename(oldpath, newpath, ec);
(void)(temp_suffix);
(void)temp_suffix;
#if !defined(_WIN32)
if (ec)
{
Expand Down
2 changes: 1 addition & 1 deletion src/vcpkg/base/system.print.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace vcpkg::System
#else
// TODO: add color handling code
// it should probably use VT-220 codes
(void)(c);
(void)c;
System::print2(message);
#endif
}
Expand Down
2 changes: 1 addition & 1 deletion src/vcpkg/commands.create.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace vcpkg::Commands::Create

int perform(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{
(void)(args.parse_arguments(COMMAND_STRUCTURE));
(void)args.parse_arguments(COMMAND_STRUCTURE);
const std::string port_name = args.command_arguments.at(0);
const std::string url = args.command_arguments.at(1);

Expand Down
3 changes: 1 addition & 2 deletions src/vcpkg/commands.fetch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ namespace vcpkg::Commands::Fetch

void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{
(void)(args.parse_arguments(COMMAND_STRUCTURE));

(void)args.parse_arguments(COMMAND_STRUCTURE);
const std::string tool = args.command_arguments[0];
const fs::path tool_path = paths.get_tool_exe(tool);
System::print2(fs::u8string(tool_path), '\n');
Expand Down
2 changes: 1 addition & 1 deletion src/vcpkg/commands.hash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace vcpkg::Commands::Hash

void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{
(void)(args.parse_arguments(COMMAND_STRUCTURE));
(void)args.parse_arguments(COMMAND_STRUCTURE);

const fs::path file_to_hash = args.command_arguments[0];

Expand Down
2 changes: 1 addition & 1 deletion src/vcpkg/commands.integrate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console

void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{
(void)(args.parse_arguments(COMMAND_STRUCTURE));
(void)args.parse_arguments(COMMAND_STRUCTURE);

if (args.command_arguments[0] == Subcommand::INSTALL)
{
Expand Down
2 changes: 1 addition & 1 deletion src/vcpkg/commands.owns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace vcpkg::Commands::Owns

void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{
(void)(args.parse_arguments(COMMAND_STRUCTURE));
(void)args.parse_arguments(COMMAND_STRUCTURE);

const StatusParagraphs status_db = database_load_check(paths);
search_file(paths, args.command_arguments[0], status_db);
Expand Down
3 changes: 1 addition & 2 deletions src/vcpkg/commands.porthistory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ namespace vcpkg::Commands::PortHistory

void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{
(void)(args.parse_arguments(COMMAND_STRUCTURE));

(void)args.parse_arguments(COMMAND_STRUCTURE);
std::string port_name = args.command_arguments.at(0);
std::vector<PortControlVersion> versions = read_versions_from_log(paths, port_name);
System::print2(" version date vcpkg commit\n");
Expand Down
3 changes: 1 addition & 2 deletions src/vcpkg/commands.portsdiff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,7 @@ namespace vcpkg::Commands::PortsDiff

void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{
(void)(args.parse_arguments(COMMAND_STRUCTURE));

(void)args.parse_arguments(COMMAND_STRUCTURE);
const fs::path& git_exe = paths.get_tool_exe(Tools::GIT);

const std::string git_commit_id_for_previous_snapshot = args.command_arguments.at(0);
Expand Down
3 changes: 1 addition & 2 deletions src/vcpkg/commands.version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ namespace vcpkg::Commands::Version

void perform_and_exit(const VcpkgCmdArguments& args, Files::Filesystem&)
{
(void)(args.parse_arguments(COMMAND_STRUCTURE));

(void)args.parse_arguments(COMMAND_STRUCTURE);
System::print2("Vcpkg package management program version ",
version(),
"\n"
Expand Down
3 changes: 2 additions & 1 deletion src/vcpkg/commands.xvsinstances.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ namespace vcpkg::Commands::X_VSInstances

Checks::exit_success(VCPKG_LINE_INFO);
#else
(void)(args, paths);
(void)args;
(void)paths;
Checks::exit_with_message(VCPKG_LINE_INFO, "This command is not supported on non-windows platforms.");
#endif
}
Expand Down
2 changes: 1 addition & 1 deletion src/vcpkg/help.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ namespace vcpkg::Help

void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{
(void)(args.parse_arguments(COMMAND_STRUCTURE));
(void)args.parse_arguments(COMMAND_STRUCTURE);

if (args.command_arguments.empty())
{
Expand Down
10 changes: 5 additions & 5 deletions src/vcpkg/metrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,9 +380,7 @@ namespace vcpkg::Metrics
return;
}

#if !defined(_WIN32)
(void)(payload);
#else
#if defined(_WIN32)
HINTERNET connect = nullptr, request = nullptr;
BOOL results = FALSE;

Expand Down Expand Up @@ -464,13 +462,15 @@ namespace vcpkg::Metrics
__debugbreak();
auto err = GetLastError();
std::cerr << "[DEBUG] failed to connect to server: " << err << "\n";
#endif
#endif // NDEBUG
}

if (request) WinHttpCloseHandle(request);
if (connect) WinHttpCloseHandle(connect);
if (session) WinHttpCloseHandle(session);
#endif
#else // ^^^ _WIN32 // !_WIN32 vvv
(void)payload;
#endif // ^^^ !_WIN32
}

void Metrics::flush(Files::Filesystem& fs)
Expand Down
3 changes: 2 additions & 1 deletion src/vcpkg/postbuildlint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,8 @@ namespace vcpkg::PostBuildLint
return LintStatus::ERROR_DETECTED;
}
#endif
(void)expected_architecture, (void)files;
(void)expected_architecture;
(void)files;
return LintStatus::SUCCESS;
}

Expand Down
13 changes: 5 additions & 8 deletions src/vcpkg/tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,7 @@ namespace vcpkg
virtual const std::string& exe_stem() const = 0;
virtual std::array<int, 3> default_min_version() const = 0;

virtual void add_special_paths(std::vector<fs::path>& out_candidate_paths) const
{
(void)(out_candidate_paths);
}
virtual void add_special_paths(std::vector<fs::path>& out_candidate_paths) const { (void)out_candidate_paths; }
virtual Optional<std::string> get_version(const VcpkgPaths& paths, const fs::path& path_to_exe) const = 0;
};

Expand Down Expand Up @@ -283,7 +280,7 @@ namespace vcpkg
out_candidate_paths.push_back(*pf / "CMake" / "bin" / "cmake.exe");
#else
// TODO: figure out if this should do anything on non-Windows
(void)(out_candidate_paths);
(void)out_candidate_paths;
#endif
}
virtual Optional<std::string> get_version(const VcpkgPaths&, const fs::path& path_to_exe) const override
Expand Down Expand Up @@ -342,7 +339,7 @@ CMake suite maintained and supported by Kitware (kitware.com/cmake).
#ifndef _WIN32
cmd.path_arg(paths.get_tool_exe(Tools::MONO));
#else
(void)(paths);
(void)paths;
#endif
cmd.path_arg(path_to_exe);
const auto rc = System::cmd_execute_and_capture_output(cmd.extract());
Expand Down Expand Up @@ -380,7 +377,7 @@ Type 'NuGet help <command>' for help on a specific command.
out_candidate_paths.push_back(*pf / "git" / "cmd" / "git.exe");
#else
// TODO: figure out if this should do anything on non-windows
(void)(out_candidate_paths);
(void)out_candidate_paths;
#endif
}

Expand Down Expand Up @@ -441,7 +438,7 @@ Mono JIT compiler version 6.8.0.105 (Debian 6.8.0.105+dfsg-2 Wed Feb 26 23:23:50

virtual void add_special_paths(std::vector<fs::path>& out_candidate_paths) const override
{
(void)(out_candidate_paths);
(void)out_candidate_paths;
// TODO: Uncomment later
// const std::vector<fs::path> from_path = Files::find_from_PATH("installerbase");
// candidate_paths.insert(candidate_paths.end(), from_path.cbegin(), from_path.cend());
Expand Down
2 changes: 1 addition & 1 deletion src/vcpkg/update.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ namespace vcpkg::Update

void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{
(void)(args.parse_arguments(COMMAND_STRUCTURE));
(void)args.parse_arguments(COMMAND_STRUCTURE);
System::print2("Using local portfile versions. To update the local portfiles, use `git pull`.\n");

const StatusParagraphs status_db = database_load_check(paths);
Expand Down

0 comments on commit 7e5b515

Please sign in to comment.