diff options
author | Joel Rosdahl <joel@rosdahl.net> | 2022-10-05 19:52:45 +0200 |
---|---|---|
committer | Joel Rosdahl <joel@rosdahl.net> | 2022-10-05 19:52:45 +0200 |
commit | f3fca98dae712370b279d881594e8bc1087daf24 (patch) | |
tree | 6ec1845a11c056088ff0f9effc92240cf1b543a1 /src/core | |
parent | 8b65880b5ad817156b58c58b5133aafc99b0a264 (diff) | |
download | ccache-f3fca98dae712370b279d881594e8bc1087daf24.tar.gz |
Revert "feat: Support auto depend mode for MSVC without /showIncludes (#1158)"
This reverts commit 8b65880b5ad817156b58c58b5133aafc99b0a264.
See <https://github.com/ccache/ccache/pull/1158#issuecomment-1268748557>.
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/core/ResultRetriever.cpp | 6 | ||||
-rw-r--r-- | src/core/ShowIncludesParser.cpp | 78 | ||||
-rw-r--r-- | src/core/ShowIncludesParser.hpp | 33 |
4 files changed, 1 insertions, 117 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 6932336f..d2431be3 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -6,7 +6,6 @@ set( ResultExtractor.cpp ResultInspector.cpp ResultRetriever.cpp - ShowIncludesParser.cpp Statistics.cpp StatisticsCounters.cpp StatsLog.cpp diff --git a/src/core/ResultRetriever.cpp b/src/core/ResultRetriever.cpp index 95925836..bdefc19f 100644 --- a/src/core/ResultRetriever.cpp +++ b/src/core/ResultRetriever.cpp @@ -24,7 +24,6 @@ #include <Context.hpp> #include <Stat.hpp> -#include <core/ShowIncludesParser.hpp> #include <core/exceptions.hpp> #include <core/wincompat.hpp> #include <fmtmacros.hpp> @@ -62,10 +61,7 @@ ResultRetriever::on_embedded_file(uint8_t file_number, data.size()); if (file_type == FileType::stdout_output) { - std::string str = util::to_string(util::to_string_view(data)); - Util::send_to_fd(m_ctx, - ShowIncludesParser::strip_includes(m_ctx, std::move(str)), - STDOUT_FILENO); + Util::send_to_fd(m_ctx, util::to_string_view(data), STDOUT_FILENO); } else if (file_type == FileType::stderr_output) { Util::send_to_fd(m_ctx, util::to_string_view(data), STDERR_FILENO); } else { diff --git a/src/core/ShowIncludesParser.cpp b/src/core/ShowIncludesParser.cpp deleted file mode 100644 index 318e8237..00000000 --- a/src/core/ShowIncludesParser.cpp +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (C) 2022 Joel Rosdahl and other contributors -// -// See doc/AUTHORS.adoc for a complete list of contributors. -// -// This program is free software; you can redistribute it and/or modify it -// under the terms of the GNU General Public License as published by the Free -// Software Foundation; either version 3 of the License, or (at your option) -// any later version. -// -// This program is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -// more details. -// -// You should have received a copy of the GNU General Public License along with -// this program; if not, write to the Free Software Foundation, Inc., 51 -// Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -#include "ShowIncludesParser.hpp" - -#include <Context.hpp> -#include <Util.hpp> -#include <util/string.hpp> - -namespace core::ShowIncludesParser { - -std::vector<std::string_view> -tokenize(std::string_view file_content, std::string_view prefix) -{ - // -showIncludes output is written to stdout together with other messages. - // Every line of it is '<prefix> <spaces> <file>', prefix is 'Note: including - // file:' in English but can be localized. - - if (prefix.empty()) { - prefix = "Note: including file:"; - } - - std::vector<std::string_view> result; - // This will split at each \r or \n, but that simply means there will be empty - // "lines". - for (std::string_view line : Util::split_into_views(file_content, "\r\n")) { - if (util::starts_with(line, prefix)) { - size_t pos = prefix.size(); - while (pos < line.size() && isspace(line[pos])) { - ++pos; - } - std::string_view include = line.substr(pos); - if (!include.empty()) { - result.push_back(include); - } - } - } - return result; -} - -std::string -strip_includes(const Context& ctx, std::string&& stdout_data) -{ - using util::Tokenizer; - using Mode = Tokenizer::Mode; - using IncludeDelimiter = Tokenizer::IncludeDelimiter; - - if (stdout_data.empty() || !ctx.auto_depend_mode - || ctx.config.compiler_type() != CompilerType::msvc) { - return std::move(stdout_data); - } - - std::string new_stdout_text; - for (const auto line : Tokenizer( - stdout_data, "\n", Mode::include_empty, IncludeDelimiter::yes)) { - if (!util::starts_with(line, "Note: including file:")) { - new_stdout_text.append(line.data(), line.length()); - } - } - return new_stdout_text; -} - -} // namespace core::ShowIncludesParser diff --git a/src/core/ShowIncludesParser.hpp b/src/core/ShowIncludesParser.hpp deleted file mode 100644 index ebc2284b..00000000 --- a/src/core/ShowIncludesParser.hpp +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2022 Joel Rosdahl and other contributors -// -// See doc/AUTHORS.adoc for a complete list of contributors. -// -// This program is free software; you can redistribute it and/or modify it -// under the terms of the GNU General Public License as published by the Free -// Software Foundation; either version 3 of the License, or (at your option) -// any later version. -// -// This program is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -// more details. -// -// You should have received a copy of the GNU General Public License along with -// this program; if not, write to the Free Software Foundation, Inc., 51 -// Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -#pragma once - -#include <string_view> -#include <vector> - -class Context; - -namespace core::ShowIncludesParser { - -std::vector<std::string_view> tokenize(std::string_view file_content, - std::string_view prefix); - -std::string strip_includes(const Context& ctx, std::string&& stdout_data); - -} // namespace core::ShowIncludesParser |