mirror of
				https://github.com/MaskRay/ccls.git
				synced 2025-11-03 22:04:24 +00:00 
			
		
		
		
	clang compile fixes
This commit is contained in:
		
							parent
							
								
									bea453af79
								
							
						
					
					
						commit
						24eb626cce
					
				
							
								
								
									
										9
									
								
								ipc.h
									
									
									
									
									
								
							
							
						
						
									
										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) {}
 | 
			
		||||
 | 
			
		||||
@ -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());
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -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…
	
		Reference in New Issue
	
	Block a user