ignore GCC diagnostics for node.h

This commit is contained in:
Mike Morris
2015-05-12 15:15:53 -04:00
parent 1eeb7b65e9
commit 1b9f98440a
9 changed files with 48 additions and 23 deletions

View File

@@ -52,6 +52,7 @@
'-Werror',
'-Wall',
'-Wextra',
'-Wshadow',
'-Wno-variadic-macros',
'-Wno-error=unused-parameter',
'-frtti',

View File

@@ -1,15 +1,13 @@
#include <node.h>
#include <nan.h>
#include "compress_png.hpp"
#include <mbgl/util/image.hpp>
namespace node_mbgl {
class CompressPNGWorker : public NanAsyncWorker {
public:
CompressPNGWorker(NanCallback *callback, v8::Local<v8::Object> buffer_, uint32_t width_,
CompressPNGWorker(NanCallback *callback_, v8::Local<v8::Object> buffer_, uint32_t width_,
uint32_t height_)
: NanAsyncWorker(callback),
: NanAsyncWorker(callback_),
buffer(v8::Persistent<v8::Object>::New(buffer_)),
data(node::Buffer::Data(buffer_)),
width(width_),

View File

@@ -1,8 +1,14 @@
#pragma once
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wshadow"
#include <node.h>
#include <nan.h>
#pragma GCC diagnostic pop
namespace node_mbgl {
void InitCompressPNG(v8::Handle<v8::Object> target);
}
}

View File

@@ -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<v8::Object>::New(NodeRequest::Create(handle_, request));
pending.emplace(request, std::move(v8::Persistent<v8::Object>::New(requestHandle)));
auto requestHandle = v8::Local<v8::Object>::New(NodeRequest::Create(handle_, req));
pending.emplace(req, std::move(v8::Persistent<v8::Object>::New(requestHandle)));
v8::Local<v8::Value> 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<const mbgl::Response>& response) {
void NodeFileSource::notify(mbgl::Request *req, const std::shared_ptr<const mbgl::Response>& 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_ptr<const
}
}
request->notify(response);
req->notify(response);
}
}

View File

@@ -2,8 +2,12 @@
#include <mbgl/storage/file_source.hpp>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wshadow"
#include <node.h>
#include <nan.h>
#pragma GCC diagnostic pop
#include <map>

View File

@@ -2,8 +2,12 @@
#include <mbgl/platform/log.hpp>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wshadow"
#include <node.h>
#include <nan.h>
#pragma GCC diagnostic pop
namespace node_mbgl {

View File

@@ -3,8 +3,12 @@
#include <mbgl/map/map.hpp>
#include <mbgl/platform/default/headless_view.hpp>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wshadow"
#include <node.h>
#include <nan.h>
#pragma GCC diagnostic pop
#include <queue>

View File

@@ -1,5 +1,9 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wshadow"
#include <node.h>
#include <nan.h>
#pragma GCC diagnostic pop
#include "node_file_source.hpp"
#include "node_map.hpp"

View File

@@ -1,7 +1,11 @@
#pragma once
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wshadow"
#include <node.h>
#include <nan.h>
#pragma GCC diagnostic pop
class NodeFileSource;
namespace mbgl { class Request; }