Browse Source

clang compile fixes

pull/2/head
Jacob Dufault 8 years ago
parent
commit
24eb626cce
  1. 9
      ipc.h
  2. 16
      platform_linux.cc
  3. 2
      platform_win.cc

9
ipc.h

@ -11,6 +11,7 @@
#include "platform.h"
#include "serializer.h"
#include "utils.h"
// 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
};
namespace std {
template <>
struct hash<IpcId> {
size_t operator()(const IpcId& k) const {
return hash<int>()(static_cast<int>(k));
}
};
}
struct IpcMessage {
IpcMessage(IpcId ipc_id) : ipc_id(ipc_id) {}

16
platform_linux.cc

@ -54,7 +54,6 @@ struct PlatformScopedMutexLockLinux : public PlatformScopedMutexLock {
struct PlatformSharedMemoryLinux : public PlatformSharedMemory {
std::string name_;
int fd_;
void* shared_start_real_;
PlatformSharedMemoryLinux(const std::string& name) : name_(name) {
std::cout << "PlatformSharedMemoryLinux name=" << name << std::endl;
@ -71,11 +70,11 @@ struct PlatformSharedMemoryLinux : public PlatformSharedMemory {
//
//shmem_size
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*/);
std::cout << "mmap errno=" << errno << 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;
/*
@ -85,18 +84,11 @@ struct PlatformSharedMemoryLinux : public PlatformSharedMemory {
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 {
munmap(shared_start_real_, shmem_size);
munmap(shared, shmem_size);
shared = nullptr;
shm_unlink(name_.c_str());
}
};

2
platform_win.cc

@ -1,3 +1,4 @@
#ifdef _MSC_VER
#include "platform.h"
#include <cassert>
@ -86,3 +87,4 @@ std::string getexepath() {
return std::string( result, (count > 0) ? count : 0 );
}
*/
#endif

Loading…
Cancel
Save