mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-22 07:35:08 +00:00
Linux build fixes
This commit is contained in:
parent
ee20d79dcc
commit
e771f05f3f
@ -834,10 +834,10 @@ struct CacheManager {
|
||||
}
|
||||
|
||||
std::unique_ptr<Entry> UpdateAndReturnOldFile(std::unique_ptr<Entry> entry) {
|
||||
auto& it = files_.find(entry->file->path);
|
||||
const auto it = files_.find(entry->file->path);
|
||||
if (it != files_.end()) {
|
||||
std::unique_ptr<Entry> old = std::move(it->second);
|
||||
it->second = std::move(entry);
|
||||
files_[entry->file->path] = std::move(entry);
|
||||
return old;
|
||||
}
|
||||
|
||||
@ -1252,7 +1252,7 @@ struct InProcessIndexer : IIndexerProcess {
|
||||
ThreadedQueue<IndexProcess_Request>* messages_;
|
||||
Index_IndexProcess_Request_IndexQueue queue_;
|
||||
std::vector<std::thread> indexer_threads_;
|
||||
std::atomic<int> num_busy_indexers_ = 0;
|
||||
std::atomic<int> num_busy_indexers_;
|
||||
Config config_;
|
||||
IQueryDbResponder* responder_;
|
||||
|
||||
@ -1264,7 +1264,7 @@ struct InProcessIndexer : IIndexerProcess {
|
||||
FileConsumer::SharedState file_consumer_shared_;
|
||||
|
||||
explicit InProcessIndexer(IQueryDbResponder* responder, ThreadedQueue<IndexProcess_Request>* messages)
|
||||
: messages_(messages), responder_(responder) {}
|
||||
: messages_(messages), num_busy_indexers_(0), responder_(responder) {}
|
||||
|
||||
void Restart() override {} // no-op
|
||||
void EnableAutoRestart() override {} // no-op
|
||||
@ -1285,11 +1285,16 @@ struct InProcessIndexer : IIndexerProcess {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IndexProcess_Request::Type::kIndex: {
|
||||
case IndexProcess_Request::Type::kIndex: {
|
||||
// Dispatch the request so one of the indexers will pick it up.
|
||||
queue_.Enqueue(std::move(*message.index_args));
|
||||
break;
|
||||
}
|
||||
case IndexProcess_Request::Type::kInvalid:
|
||||
case IndexProcess_Request::Type::kQuit: {
|
||||
LOG_S(ERROR) << "Unhandled IndexProcess_Request::Type " << static_cast<int>(message.type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1343,10 +1348,7 @@ struct OutOfProcessIndexer : IIndexerProcess {
|
||||
void SetConfig(const Config& config) override {
|
||||
assert(!config_);
|
||||
config_ = config;
|
||||
|
||||
//std::lock_guard<std::recursive_mutex> processes_lock(processes_mutex_);
|
||||
for (auto& process : processes_)
|
||||
SendMessage(IndexProcess_Request::CreateInitialize(*config_));
|
||||
SendMessage(IndexProcess_Request::CreateInitialize(*config_));
|
||||
}
|
||||
|
||||
void SendMessage(IndexProcess_Request message) override {
|
||||
@ -1450,13 +1452,12 @@ struct OutOfProcessIndexer : IIndexerProcess {
|
||||
}
|
||||
};
|
||||
|
||||
constexpr const char* kIpcBufferName = "CqueryIpc";
|
||||
constexpr size_t kIpcBufferSize = 1024 * 8;
|
||||
|
||||
// Main function for the out-of-process indexer.
|
||||
void IndexProcessMain() {
|
||||
// TODO
|
||||
// querydb process is responsible for owning the buffer.
|
||||
//constexpr const char* kIpcBufferName = "CqueryIpc";
|
||||
//constexpr size_t kIpcBufferSize = 1024 * 8;
|
||||
//MessageQueue queue(Buffer::CreateSharedBuffer(kIpcBufferName, kIpcBufferSize), true /*buffer_has_data*/);
|
||||
|
||||
std::cerr << "Indexer process starting\n";
|
||||
|
@ -412,7 +412,9 @@ void Project::ForAllFilteredFiles(Config* config, std::function<void(int i, cons
|
||||
if (matcher.IsMatch(entry.filename, &failure_reason))
|
||||
action(i, entries[i]);
|
||||
else {
|
||||
LOG_IF_F(INFO, config->logSkippedPathsForIndex, "[%d/%d]: Failed %s; skipping %s", i + 1, entries.size(), failure_reason.c_str(), entry.filename.c_str());
|
||||
if (config->logSkippedPathsForIndex) {
|
||||
LOG_S(INFO) << "[" << i + 1 << "/" << entries.size() << "]: Failed " << failure_reason << "; skipping " << entry.filename;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,13 @@ void Reflect(Reader& visitor, uint64_t& value) {
|
||||
void Reflect(Writer& visitor, uint64_t& value) {
|
||||
visitor.Uint64(value);
|
||||
}
|
||||
// long long
|
||||
void Reflect(Reader& visitor, long long& value) {
|
||||
value = visitor.GetUint64();
|
||||
}
|
||||
void Reflect(Writer& visitor, long long& value) {
|
||||
visitor.Uint64(value);
|
||||
}
|
||||
// bool
|
||||
void Reflect(Reader& visitor, bool& value) {
|
||||
value = visitor.GetBool();
|
||||
|
@ -121,6 +121,9 @@ void Reflect(Writer& visitor, int64_t& value);
|
||||
// uint64_t
|
||||
void Reflect(Reader& visitor, uint64_t& value);
|
||||
void Reflect(Writer& visitor, uint64_t& value);
|
||||
// long long
|
||||
void Reflect(Reader& visitor, long long& value);
|
||||
void Reflect(Writer& visitor, long long& value);
|
||||
// bool
|
||||
void Reflect(Reader& visitor, bool& value);
|
||||
void Reflect(Writer& visitor, bool& value);
|
||||
@ -225,4 +228,4 @@ void ReflectMember(Reader& visitor, const char* name, T& value) {
|
||||
std::string Serialize(IndexFile& file);
|
||||
std::unique_ptr<IndexFile> Deserialize(std::string path, std::string serialized, optional<int> expected_version);
|
||||
|
||||
void SetTestOutputMode();
|
||||
void SetTestOutputMode();
|
||||
|
@ -96,7 +96,7 @@ public:
|
||||
// Get the first element from the queue. Blocks until one is available.
|
||||
// Executes |action| with an acquired |mutex_|.
|
||||
template<typename TAction>
|
||||
T DequeuePlusAction(TAction& action) {
|
||||
T DequeuePlusAction(TAction action) {
|
||||
std::unique_lock<std::mutex> lock(mutex_);
|
||||
waiter_->cv.wait(lock, [&]() {
|
||||
return !priority_.empty() || !queue_.empty();
|
||||
|
@ -1,3 +1,4 @@
|
||||
#if defined(_WIN32)
|
||||
#include "process.hpp"
|
||||
#include <windows.h>
|
||||
#include <cstring>
|
||||
@ -176,7 +177,7 @@ void Process::close_fds() noexcept {
|
||||
stdout_thread.join();
|
||||
if(stderr_thread.joinable())
|
||||
stderr_thread.join();
|
||||
|
||||
|
||||
if(stdin_fd)
|
||||
close_stdin();
|
||||
if(stdout_fd) {
|
||||
@ -268,3 +269,4 @@ void Process::kill(id_type id, bool force) noexcept {
|
||||
}
|
||||
|
||||
} // TinyProsessLib
|
||||
#endif
|
||||
|
3
wscript
3
wscript
@ -125,6 +125,7 @@ def build(bld):
|
||||
if sys.platform == 'linux' or sys.platform == 'linux2':
|
||||
lib.append('rt')
|
||||
lib.append('pthread')
|
||||
lib.append('dl')
|
||||
elif sys.platform == 'darwin':
|
||||
lib.append('pthread')
|
||||
|
||||
@ -134,10 +135,12 @@ def build(bld):
|
||||
includes=[
|
||||
'third_party/',
|
||||
'third_party/doctest/',
|
||||
'third_party/loguru/',
|
||||
'third_party/rapidjson/include/',
|
||||
'third_party/sparsehash/src/',
|
||||
'third_party/sparsepp/',
|
||||
CLANG_INCLUDE_DIR],
|
||||
defines=['LOGURU_WITH_STREAMS=1'],
|
||||
lib=lib,
|
||||
libpath=[CLANG_LIB_DIR],
|
||||
rpath=[CLANG_LIB_DIR],
|
||||
|
Loading…
Reference in New Issue
Block a user