mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-29 11:01:57 +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) {
|
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()) {
|
if (it != files_.end()) {
|
||||||
std::unique_ptr<Entry> old = std::move(it->second);
|
std::unique_ptr<Entry> old = std::move(it->second);
|
||||||
it->second = std::move(entry);
|
files_[entry->file->path] = std::move(entry);
|
||||||
return old;
|
return old;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1252,7 +1252,7 @@ struct InProcessIndexer : IIndexerProcess {
|
|||||||
ThreadedQueue<IndexProcess_Request>* messages_;
|
ThreadedQueue<IndexProcess_Request>* messages_;
|
||||||
Index_IndexProcess_Request_IndexQueue queue_;
|
Index_IndexProcess_Request_IndexQueue queue_;
|
||||||
std::vector<std::thread> indexer_threads_;
|
std::vector<std::thread> indexer_threads_;
|
||||||
std::atomic<int> num_busy_indexers_ = 0;
|
std::atomic<int> num_busy_indexers_;
|
||||||
Config config_;
|
Config config_;
|
||||||
IQueryDbResponder* responder_;
|
IQueryDbResponder* responder_;
|
||||||
|
|
||||||
@ -1264,7 +1264,7 @@ struct InProcessIndexer : IIndexerProcess {
|
|||||||
FileConsumer::SharedState file_consumer_shared_;
|
FileConsumer::SharedState file_consumer_shared_;
|
||||||
|
|
||||||
explicit InProcessIndexer(IQueryDbResponder* responder, ThreadedQueue<IndexProcess_Request>* messages)
|
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 Restart() override {} // no-op
|
||||||
void EnableAutoRestart() override {} // no-op
|
void EnableAutoRestart() override {} // no-op
|
||||||
@ -1290,6 +1290,11 @@ struct InProcessIndexer : IIndexerProcess {
|
|||||||
queue_.Enqueue(std::move(*message.index_args));
|
queue_.Enqueue(std::move(*message.index_args));
|
||||||
break;
|
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,9 +1348,6 @@ struct OutOfProcessIndexer : IIndexerProcess {
|
|||||||
void SetConfig(const Config& config) override {
|
void SetConfig(const Config& config) override {
|
||||||
assert(!config_);
|
assert(!config_);
|
||||||
config_ = 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_));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -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.
|
// Main function for the out-of-process indexer.
|
||||||
void IndexProcessMain() {
|
void IndexProcessMain() {
|
||||||
// TODO
|
// TODO
|
||||||
// querydb process is responsible for owning the buffer.
|
// 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*/);
|
//MessageQueue queue(Buffer::CreateSharedBuffer(kIpcBufferName, kIpcBufferSize), true /*buffer_has_data*/);
|
||||||
|
|
||||||
std::cerr << "Indexer process starting\n";
|
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))
|
if (matcher.IsMatch(entry.filename, &failure_reason))
|
||||||
action(i, entries[i]);
|
action(i, entries[i]);
|
||||||
else {
|
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) {
|
void Reflect(Writer& visitor, uint64_t& value) {
|
||||||
visitor.Uint64(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
|
// bool
|
||||||
void Reflect(Reader& visitor, bool& value) {
|
void Reflect(Reader& visitor, bool& value) {
|
||||||
value = visitor.GetBool();
|
value = visitor.GetBool();
|
||||||
|
@ -121,6 +121,9 @@ void Reflect(Writer& visitor, int64_t& value);
|
|||||||
// uint64_t
|
// uint64_t
|
||||||
void Reflect(Reader& visitor, uint64_t& value);
|
void Reflect(Reader& visitor, uint64_t& value);
|
||||||
void Reflect(Writer& 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
|
// bool
|
||||||
void Reflect(Reader& visitor, bool& value);
|
void Reflect(Reader& visitor, bool& value);
|
||||||
void Reflect(Writer& visitor, bool& value);
|
void Reflect(Writer& visitor, bool& value);
|
||||||
|
@ -96,7 +96,7 @@ public:
|
|||||||
// Get the first element from the queue. Blocks until one is available.
|
// Get the first element from the queue. Blocks until one is available.
|
||||||
// Executes |action| with an acquired |mutex_|.
|
// Executes |action| with an acquired |mutex_|.
|
||||||
template<typename TAction>
|
template<typename TAction>
|
||||||
T DequeuePlusAction(TAction& action) {
|
T DequeuePlusAction(TAction action) {
|
||||||
std::unique_lock<std::mutex> lock(mutex_);
|
std::unique_lock<std::mutex> lock(mutex_);
|
||||||
waiter_->cv.wait(lock, [&]() {
|
waiter_->cv.wait(lock, [&]() {
|
||||||
return !priority_.empty() || !queue_.empty();
|
return !priority_.empty() || !queue_.empty();
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#if defined(_WIN32)
|
||||||
#include "process.hpp"
|
#include "process.hpp"
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
@ -268,3 +269,4 @@ void Process::kill(id_type id, bool force) noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // TinyProsessLib
|
} // TinyProsessLib
|
||||||
|
#endif
|
||||||
|
3
wscript
3
wscript
@ -125,6 +125,7 @@ def build(bld):
|
|||||||
if sys.platform == 'linux' or sys.platform == 'linux2':
|
if sys.platform == 'linux' or sys.platform == 'linux2':
|
||||||
lib.append('rt')
|
lib.append('rt')
|
||||||
lib.append('pthread')
|
lib.append('pthread')
|
||||||
|
lib.append('dl')
|
||||||
elif sys.platform == 'darwin':
|
elif sys.platform == 'darwin':
|
||||||
lib.append('pthread')
|
lib.append('pthread')
|
||||||
|
|
||||||
@ -134,10 +135,12 @@ def build(bld):
|
|||||||
includes=[
|
includes=[
|
||||||
'third_party/',
|
'third_party/',
|
||||||
'third_party/doctest/',
|
'third_party/doctest/',
|
||||||
|
'third_party/loguru/',
|
||||||
'third_party/rapidjson/include/',
|
'third_party/rapidjson/include/',
|
||||||
'third_party/sparsehash/src/',
|
'third_party/sparsehash/src/',
|
||||||
'third_party/sparsepp/',
|
'third_party/sparsepp/',
|
||||||
CLANG_INCLUDE_DIR],
|
CLANG_INCLUDE_DIR],
|
||||||
|
defines=['LOGURU_WITH_STREAMS=1'],
|
||||||
lib=lib,
|
lib=lib,
|
||||||
libpath=[CLANG_LIB_DIR],
|
libpath=[CLANG_LIB_DIR],
|
||||||
rpath=[CLANG_LIB_DIR],
|
rpath=[CLANG_LIB_DIR],
|
||||||
|
Loading…
Reference in New Issue
Block a user