diff --git a/binding.gyp b/binding.gyp index c138be552..2fbd8f4d4 100644 --- a/binding.gyp +++ b/binding.gyp @@ -52,6 +52,7 @@ '-Werror', '-Wall', '-Wextra', + '-Wshadow', '-Wno-variadic-macros', '-Wno-error=unused-parameter', '-frtti', diff --git a/src/compress_png.cpp b/src/compress_png.cpp index 699df5346..068abe65f 100644 --- a/src/compress_png.cpp +++ b/src/compress_png.cpp @@ -1,15 +1,13 @@ -#include -#include - +#include "compress_png.hpp" #include namespace node_mbgl { class CompressPNGWorker : public NanAsyncWorker { public: - CompressPNGWorker(NanCallback *callback, v8::Local buffer_, uint32_t width_, + CompressPNGWorker(NanCallback *callback_, v8::Local buffer_, uint32_t width_, uint32_t height_) - : NanAsyncWorker(callback), + : NanAsyncWorker(callback_), buffer(v8::Persistent::New(buffer_)), data(node::Buffer::Data(buffer_)), width(width_), diff --git a/src/compress_png.hpp b/src/compress_png.hpp index 754b383e7..805181a63 100644 --- a/src/compress_png.hpp +++ b/src/compress_png.hpp @@ -1,8 +1,14 @@ +#pragma once + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#pragma GCC diagnostic ignored "-Wshadow" #include #include +#pragma GCC diagnostic pop namespace node_mbgl { void InitCompressPNG(v8::Handle target); -} \ No newline at end of file +} diff --git a/src/node_file_source.cpp b/src/node_file_source.cpp index 2406264fc..e0b78008b 100644 --- a/src/node_file_source.cpp +++ b/src/node_file_source.cpp @@ -64,31 +64,31 @@ NodeFileSource::~NodeFileSource() { } mbgl::Request* NodeFileSource::request(const mbgl::Resource& resource, uv_loop_t* loop, Callback callback) { - auto request = new mbgl::Request(resource, loop, std::move(callback)); + auto req = new mbgl::Request(resource, loop, std::move(callback)); // This function can be called from any thread. Make sure we're executing the actual call in the // file source loop by sending it over the queue. It will be processed in processAction(). - queue->send(Action{ Action::Add, request }); - return request; + queue->send(Action{ Action::Add, req }); + return req; } -void NodeFileSource::cancel(mbgl::Request* request) { - request->cancel(); +void NodeFileSource::cancel(mbgl::Request* req) { + req->cancel(); // This function can be called from any thread. Make sure we're executing the actual call in the // file source loop by sending it over the queue. It will be processed in processAction(). - queue->send(Action{ Action::Cancel, request }); + queue->send(Action{ Action::Cancel, req }); } void NodeFileSource::request(const mbgl::Resource& resource, Callback callback) { - auto request = new mbgl::Request(resource, nullptr, std::move(callback)); + auto req = new mbgl::Request(resource, nullptr, std::move(callback)); // This function can be called from any thread. Make sure we're executing the actual call in the // file source loop by sending it over the queue. It will be processed in processAction(). - queue->send(Action{ Action::Add, request }); + queue->send(Action{ Action::Add, req }); } -void NodeFileSource::processAdd(mbgl::Request *request) { +void NodeFileSource::processAdd(mbgl::Request *req) { NanScope(); // Make sure the loop stays alive as long as request is pending. @@ -96,17 +96,17 @@ void NodeFileSource::processAdd(mbgl::Request *request) { queue->ref(); } - auto requestHandle = v8::Local::New(NodeRequest::Create(handle_, request)); - pending.emplace(request, std::move(v8::Persistent::New(requestHandle))); + auto requestHandle = v8::Local::New(NodeRequest::Create(handle_, req)); + pending.emplace(req, std::move(v8::Persistent::New(requestHandle))); v8::Local argv[] = { requestHandle }; NanMakeCallback(handle_, NanNew("request"), 1, argv); } -void NodeFileSource::processCancel(mbgl::Request *request) { +void NodeFileSource::processCancel(mbgl::Request *req) { NanScope(); - auto it = pending.find(request); + auto it = pending.find(req); if (it == pending.end()) { // The response callback was already fired. There is no point in calling the cancelation // callback because the request is already completed. @@ -132,12 +132,12 @@ void NodeFileSource::processCancel(mbgl::Request *request) { } // Finally, destruct the request object - request->destruct(); + req->destruct(); } -void NodeFileSource::notify(mbgl::Request *request, const std::shared_ptr& response) { +void NodeFileSource::notify(mbgl::Request *req, const std::shared_ptr& response) { // First, remove the request, since it might be destructed at any point now. - auto it = pending.find(request); + auto it = pending.find(req); if (it != pending.end()) { it->second.Dispose(); pending.erase(it); @@ -148,7 +148,7 @@ void NodeFileSource::notify(mbgl::Request *request, const std::shared_ptrnotify(response); + req->notify(response); } } diff --git a/src/node_file_source.hpp b/src/node_file_source.hpp index 4221f9875..791b96969 100644 --- a/src/node_file_source.hpp +++ b/src/node_file_source.hpp @@ -2,8 +2,12 @@ #include +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#pragma GCC diagnostic ignored "-Wshadow" #include #include +#pragma GCC diagnostic pop #include diff --git a/src/node_log.hpp b/src/node_log.hpp index c9a8ef360..5c0048d26 100644 --- a/src/node_log.hpp +++ b/src/node_log.hpp @@ -2,8 +2,12 @@ #include +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#pragma GCC diagnostic ignored "-Wshadow" #include #include +#pragma GCC diagnostic pop namespace node_mbgl { diff --git a/src/node_map.hpp b/src/node_map.hpp index 9b52df520..39784fef5 100644 --- a/src/node_map.hpp +++ b/src/node_map.hpp @@ -3,8 +3,12 @@ #include #include +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#pragma GCC diagnostic ignored "-Wshadow" #include #include +#pragma GCC diagnostic pop #include diff --git a/src/node_mapbox_gl_native.cpp b/src/node_mapbox_gl_native.cpp index 09250b784..e784681a0 100644 --- a/src/node_mapbox_gl_native.cpp +++ b/src/node_mapbox_gl_native.cpp @@ -1,5 +1,9 @@ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#pragma GCC diagnostic ignored "-Wshadow" #include #include +#pragma GCC diagnostic pop #include "node_file_source.hpp" #include "node_map.hpp" diff --git a/src/node_request.hpp b/src/node_request.hpp index d07e93d42..ebbd962d4 100644 --- a/src/node_request.hpp +++ b/src/node_request.hpp @@ -1,7 +1,11 @@ #pragma once +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#pragma GCC diagnostic ignored "-Wshadow" #include #include +#pragma GCC diagnostic pop class NodeFileSource; namespace mbgl { class Request; }