mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-22 15:45:08 +00:00
fix some warnings
This commit is contained in:
parent
6a72712404
commit
539c779606
@ -77,7 +77,7 @@ std::string IndexedFile::ToString() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
IndexedTypeDef::IndexedTypeDef(TypeId id, const std::string& usr)
|
IndexedTypeDef::IndexedTypeDef(TypeId id, const std::string& usr)
|
||||||
: id(id), def(usr) {
|
: def(usr), id(id) {
|
||||||
assert(usr.size() > 0);
|
assert(usr.size() > 0);
|
||||||
// std::cerr << "Creating type with usr " << usr << std::endl;
|
// std::cerr << "Creating type with usr " << usr << std::endl;
|
||||||
}
|
}
|
||||||
|
18
indexer.h
18
indexer.h
@ -60,10 +60,11 @@ using VarId = Id<IndexedVarDef>;
|
|||||||
struct IdCache;
|
struct IdCache;
|
||||||
|
|
||||||
struct Location {
|
struct Location {
|
||||||
|
// TODO: cleanup types (make this type smaller).
|
||||||
bool interesting;
|
bool interesting;
|
||||||
int raw_file_id;
|
int64_t raw_file_id;
|
||||||
int line;
|
int32_t line;
|
||||||
int column;
|
int32_t column;
|
||||||
|
|
||||||
Location() {
|
Location() {
|
||||||
interesting = false;
|
interesting = false;
|
||||||
@ -72,7 +73,7 @@ struct Location {
|
|||||||
column = -1;
|
column = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Location(bool interesting, FileId file, uint32_t line, uint32_t column) {
|
Location(bool interesting, FileId file, int32_t line, int32_t column) {
|
||||||
this->interesting = interesting;
|
this->interesting = interesting;
|
||||||
this->raw_file_id = file.id;
|
this->raw_file_id = file.id;
|
||||||
this->line = line;
|
this->line = line;
|
||||||
@ -82,16 +83,13 @@ struct Location {
|
|||||||
FileId file_id() const { return FileId(raw_file_id); }
|
FileId file_id() const { return FileId(raw_file_id); }
|
||||||
|
|
||||||
explicit Location(const char* encoded) : Location() {
|
explicit Location(const char* encoded) : Location() {
|
||||||
int len = strlen(encoded);
|
|
||||||
assert(len >= 0);
|
|
||||||
|
|
||||||
if (*encoded == '*') {
|
if (*encoded == '*') {
|
||||||
interesting = true;
|
interesting = true;
|
||||||
++encoded;
|
++encoded;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(encoded);
|
assert(encoded);
|
||||||
raw_file_id = atoi(encoded);
|
raw_file_id = strtol(encoded, nullptr, 10);
|
||||||
while (*encoded && *encoded != ':')
|
while (*encoded && *encoded != ':')
|
||||||
++encoded;
|
++encoded;
|
||||||
if (*encoded == ':')
|
if (*encoded == ':')
|
||||||
@ -442,7 +440,7 @@ struct IndexedFuncDef {
|
|||||||
bool is_bad_def = true;
|
bool is_bad_def = true;
|
||||||
|
|
||||||
IndexedFuncDef() {} // For reflection.
|
IndexedFuncDef() {} // For reflection.
|
||||||
IndexedFuncDef(FuncId id, const std::string& usr) : id(id), def(usr) {
|
IndexedFuncDef(FuncId id, const std::string& usr) : def(usr), id(id) {
|
||||||
// assert(usr.size() > 0);
|
// assert(usr.size() > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -526,7 +524,7 @@ struct IndexedVarDef {
|
|||||||
|
|
||||||
IndexedVarDef() : def("") {} // For serialization
|
IndexedVarDef() : def("") {} // For serialization
|
||||||
|
|
||||||
IndexedVarDef(VarId id, const std::string& usr) : id(id), def(usr) {
|
IndexedVarDef(VarId id, const std::string& usr) : def(usr), id(id) {
|
||||||
// assert(usr.size() > 0);
|
// assert(usr.size() > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,18 +82,20 @@ enum class RepeatResult { RunAgain, Break };
|
|||||||
// Run |action| an arbitrary number of times.
|
// Run |action| an arbitrary number of times.
|
||||||
void Repeat(std::function<RepeatResult()> action) {
|
void Repeat(std::function<RepeatResult()> action) {
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
#if defined(MESSAGE_QUEUE_LOG)
|
||||||
int log_iteration_count = 0;
|
int log_iteration_count = 0;
|
||||||
int log_count = 0;
|
int log_count = 0;
|
||||||
|
#endif
|
||||||
while (true) {
|
while (true) {
|
||||||
if (!first) {
|
if (!first) {
|
||||||
|
#if defined(MESSAGE_QUEUE_LOG)
|
||||||
if (log_iteration_count > 1000) {
|
if (log_iteration_count > 1000) {
|
||||||
log_iteration_count = 0;
|
log_iteration_count = 0;
|
||||||
#if defined(MESSAGE_QUEUE_LOG)
|
|
||||||
std::cerr << "[info]: Buffer full, waiting (" << log_count++ << ")"
|
std::cerr << "[info]: Buffer full, waiting (" << log_count++ << ")"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
++log_iteration_count;
|
++log_iteration_count;
|
||||||
|
#endif
|
||||||
// TODO: See if we can figure out a way to use condition variables
|
// TODO: See if we can figure out a way to use condition variables
|
||||||
// cross-process.
|
// cross-process.
|
||||||
std::this_thread::sleep_for(std::chrono::microseconds(0));
|
std::this_thread::sleep_for(std::chrono::microseconds(0));
|
||||||
@ -107,7 +109,7 @@ void Repeat(std::function<RepeatResult()> action) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ResizableBuffer* CreateOrFindResizableBuffer(
|
ResizableBuffer* CreateOrFindResizableBuffer(
|
||||||
std::unordered_map<int, std::unique_ptr<ResizableBuffer>>&
|
std::unordered_map<uint32_t, std::unique_ptr<ResizableBuffer>>&
|
||||||
resizable_buffers,
|
resizable_buffers,
|
||||||
uint32_t id) {
|
uint32_t id) {
|
||||||
auto it = resizable_buffers.find(id);
|
auto it = resizable_buffers.find(id);
|
||||||
@ -119,7 +121,7 @@ ResizableBuffer* CreateOrFindResizableBuffer(
|
|||||||
std::unique_ptr<Buffer> MakeBuffer(void* content, size_t size) {
|
std::unique_ptr<Buffer> MakeBuffer(void* content, size_t size) {
|
||||||
auto buffer = Buffer::Create(size);
|
auto buffer = Buffer::Create(size);
|
||||||
memcpy(buffer->data, content, size);
|
memcpy(buffer->data, content, size);
|
||||||
return std::move(buffer);
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
@ -227,7 +229,8 @@ void MessageQueue::Enqueue(const Message& message) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::unique_ptr<Buffer>> MessageQueue::DequeueAll() {
|
std::vector<std::unique_ptr<Buffer>> MessageQueue::DequeueAll() {
|
||||||
std::unordered_map<int, std::unique_ptr<ResizableBuffer>> resizable_buffers;
|
std::unordered_map<uint32_t, std::unique_ptr<ResizableBuffer>>
|
||||||
|
resizable_buffers;
|
||||||
|
|
||||||
std::vector<std::unique_ptr<Buffer>> result;
|
std::vector<std::unique_ptr<Buffer>> result;
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
|
|
||||||
class ResizableBuffer;
|
struct ResizableBuffer;
|
||||||
|
|
||||||
struct Message {
|
struct Message {
|
||||||
Message(void* data, size_t size);
|
Message(void* data, size_t size);
|
||||||
|
2
wscript
2
wscript
@ -88,7 +88,7 @@ def build(bld):
|
|||||||
excl=['*tests/*', 'third_party/*'])
|
excl=['*tests/*', 'third_party/*'])
|
||||||
bld.program(
|
bld.program(
|
||||||
source=cc_files,
|
source=cc_files,
|
||||||
cxxflags=['-std=c++11'],
|
cxxflags=['-std=c++11', '-Wall'],
|
||||||
includes=['third_party/rapidjson/include', CLANG_INCLUDE_DIR],
|
includes=['third_party/rapidjson/include', CLANG_INCLUDE_DIR],
|
||||||
lib=['clang', 'rt', 'pthread'],
|
lib=['clang', 'rt', 'pthread'],
|
||||||
libpath=[CLANG_LIB_DIR],
|
libpath=[CLANG_LIB_DIR],
|
||||||
|
Loading…
Reference in New Issue
Block a user