mirror of
https://github.com/MaskRay/ccls.git
synced 2025-02-07 09:22:11 +00:00
clang compile fixes
This commit is contained in:
parent
bea453af79
commit
24eb626cce
11
ipc.h
11
ipc.h
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#include "serializer.h"
|
#include "serializer.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
// TODO: We need to add support for payloads larger than the maximum shared memory buffer size.
|
// TODO: We need to add support for payloads larger than the maximum shared memory buffer size.
|
||||||
|
|
||||||
@ -36,6 +37,14 @@ enum class IpcId : int {
|
|||||||
WorkspaceSymbolsResponse
|
WorkspaceSymbolsResponse
|
||||||
};
|
};
|
||||||
|
|
||||||
|
namespace std {
|
||||||
|
template <>
|
||||||
|
struct hash<IpcId> {
|
||||||
|
size_t operator()(const IpcId& k) const {
|
||||||
|
return hash<int>()(static_cast<int>(k));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
struct IpcMessage {
|
struct IpcMessage {
|
||||||
IpcMessage(IpcId ipc_id) : ipc_id(ipc_id) {}
|
IpcMessage(IpcId ipc_id) : ipc_id(ipc_id) {}
|
||||||
@ -135,4 +144,4 @@ struct IpcClient {
|
|||||||
private:
|
private:
|
||||||
IpcDirectionalChannel server_;
|
IpcDirectionalChannel server_;
|
||||||
IpcDirectionalChannel client_;
|
IpcDirectionalChannel client_;
|
||||||
};
|
};
|
||||||
|
@ -54,7 +54,6 @@ struct PlatformScopedMutexLockLinux : public PlatformScopedMutexLock {
|
|||||||
struct PlatformSharedMemoryLinux : public PlatformSharedMemory {
|
struct PlatformSharedMemoryLinux : public PlatformSharedMemory {
|
||||||
std::string name_;
|
std::string name_;
|
||||||
int fd_;
|
int fd_;
|
||||||
void* shared_start_real_;
|
|
||||||
|
|
||||||
PlatformSharedMemoryLinux(const std::string& name) : name_(name) {
|
PlatformSharedMemoryLinux(const std::string& name) : name_(name) {
|
||||||
std::cout << "PlatformSharedMemoryLinux name=" << name << std::endl;
|
std::cout << "PlatformSharedMemoryLinux name=" << name << std::endl;
|
||||||
@ -71,11 +70,11 @@ struct PlatformSharedMemoryLinux : public PlatformSharedMemory {
|
|||||||
//
|
//
|
||||||
//shmem_size
|
//shmem_size
|
||||||
std::cout << "3" << std::endl;
|
std::cout << "3" << std::endl;
|
||||||
shared_start_real_ = mmap(nullptr /*kernel assigned starting address*/,
|
shared = mmap(nullptr /*kernel assigned starting address*/,
|
||||||
shmem_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd_, 0 /*offset*/);
|
shmem_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd_, 0 /*offset*/);
|
||||||
std::cout << "mmap errno=" << errno << std::endl;
|
std::cout << "mmap errno=" << errno << std::endl;
|
||||||
std::cout << "fd_ = " << fd_ << std::endl;
|
std::cout << "fd_ = " << fd_ << std::endl;
|
||||||
std::cout << "shared_start_real_ = " << shared_start_real_ << std::endl;
|
std::cout << "shared = " << shared << std::endl;
|
||||||
std::cout << "4" << std::endl;
|
std::cout << "4" << std::endl;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -85,18 +84,11 @@ struct PlatformSharedMemoryLinux : public PlatformSharedMemory {
|
|||||||
|
|
||||||
sem_init(sem, 1, 1);
|
sem_init(sem, 1, 1);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
std::cout << "4a" << std::endl;
|
|
||||||
shared_bytes_used = reinterpret_cast<size_t*>(shared_start_real_);
|
|
||||||
std::cout << "4b" << std::endl;
|
|
||||||
*shared_bytes_used = 0;
|
|
||||||
std::cout << "4c" << std::endl;
|
|
||||||
shared_start = reinterpret_cast<char*>(shared_bytes_used + 1);
|
|
||||||
std::cout << "5" << std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~PlatformSharedMemoryLinux() override {
|
~PlatformSharedMemoryLinux() override {
|
||||||
munmap(shared_start_real_, shmem_size);
|
munmap(shared, shmem_size);
|
||||||
|
shared = nullptr;
|
||||||
shm_unlink(name_.c_str());
|
shm_unlink(name_.c_str());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#ifdef _MSC_VER
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
@ -85,4 +86,5 @@ std::string getexepath() {
|
|||||||
ssize_t count = readlink( "/proc/self/exe", result, PATH_MAX );
|
ssize_t count = readlink( "/proc/self/exe", result, PATH_MAX );
|
||||||
return std::string( result, (count > 0) ? count : 0 );
|
return std::string( result, (count > 0) ? count : 0 );
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user