summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common.gypi8
-rw-r--r--common/glfw_view.cpp4
-rw-r--r--common/http_request_baton_curl.cpp10
-rw-r--r--include/mbgl/geometry/buffer.hpp6
-rw-r--r--include/mbgl/util/pbf.hpp4
-rw-r--r--include/mbgl/util/transition.hpp8
-rwxr-xr-xsrc/clipper/clipper.cpp2
-rw-r--r--src/geometry/debug_font_buffer.cpp6
-rw-r--r--src/map/raster_tile_data.cpp4
-rw-r--r--src/map/tile.cpp16
-rw-r--r--src/map/transform_state.cpp4
-rw-r--r--src/map/vector_tile_data.cpp4
-rw-r--r--src/renderer/painter.cpp8
-rw-r--r--src/storage/file_source.cpp26
-rw-r--r--src/storage/http_request.cpp4
-rw-r--r--src/storage/response.cpp2
-rw-r--r--src/style/style.cpp1
-rw-r--r--src/style/style_parser.cpp2
-rw-r--r--src/util/image.cpp1
-rw-r--r--src/util/raster.cpp2
-rw-r--r--test/fixtures/fixture_log.cpp12
21 files changed, 72 insertions, 62 deletions
diff --git a/common.gypi b/common.gypi
index 596db5449d..627c186689 100644
--- a/common.gypi
+++ b/common.gypi
@@ -14,8 +14,14 @@
'GCC_WARN_UNINITIALIZED_AUTOS': 'YES_AGGRESSIVE',
},
}],
+ ['OS=="linux"', {
+ 'cflags_cc': [
+ '-Wno-unknown-pragmas', # We are using '#pragma mark', but it is only available on Darwin.
+ '-Wno-literal-suffix', # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61653
+ ],
+ }],
],
- 'cflags_cc!': [ '-std=c++11', '-Wall', '-Wextra', '-Wshadow', '-frtti', '-fexceptions' ],
+ 'cflags_cc': [ '-std=c++11', '-Werror', '-Wall', '-Wextra', '-Wshadow', '-frtti', '-fexceptions' ],
'configurations': {
'Debug': {
'cflags_cc': [ '-g', '-O0', '-fno-omit-frame-pointer','-fwrapv', '-fstack-protector-all', '-fno-common' ],
diff --git a/common/glfw_view.cpp b/common/glfw_view.cpp
index 53cd068d09..92d1e19085 100644
--- a/common/glfw_view.cpp
+++ b/common/glfw_view.cpp
@@ -13,8 +13,8 @@ GLFWView::~GLFWView() {
glfwTerminate();
}
-void GLFWView::initialize(mbgl::Map *map) {
- View::initialize(map);
+void GLFWView::initialize(mbgl::Map *map_) {
+ View::initialize(map_);
if (!glfwInit()) {
fprintf(stderr, "Failed to initialize glfw\n");
diff --git a/common/http_request_baton_curl.cpp b/common/http_request_baton_curl.cpp
index b5226e20ec..0c3d2b43fc 100644
--- a/common/http_request_baton_curl.cpp
+++ b/common/http_request_baton_curl.cpp
@@ -154,11 +154,11 @@ void curl_perform(uv_poll_t *req, int, int events) {
while ((message = curl_multi_info_read(multi, &pending))) {
switch (message->msg) {
case CURLMSG_DONE: {
- CURLContext *context = nullptr;
- curl_easy_getinfo(message->easy_handle, CURLINFO_PRIVATE, (char *)&context);
+ CURLContext *ctx = nullptr;
+ curl_easy_getinfo(message->easy_handle, CURLINFO_PRIVATE, (char *)&ctx);
// Make a copy so that the Baton stays around even after we are calling finish_request
- util::ptr<HTTPRequestBaton> baton = context->baton;
+ util::ptr<HTTPRequestBaton> baton = ctx->baton;
// Add human-readable error code
if (message->data.result != CURLE_OK) {
@@ -242,8 +242,8 @@ int handle_socket(CURL *handle, curl_socket_t sockfd, int action, void *, void *
}
if (action == CURL_POLL_REMOVE && socketp) {
uv_poll_stop(context->poll_handle);
- uv_close((uv_handle_t *)context->poll_handle, [](uv_handle_t *handle) {
- delete (uv_poll_t *)handle;
+ uv_close((uv_handle_t *)context->poll_handle, [](uv_handle_t *poll_handle) {
+ delete (uv_poll_t *)poll_handle;
});
context->poll_handle = nullptr;
curl_multi_assign(multi, sockfd, NULL);
diff --git a/include/mbgl/geometry/buffer.hpp b/include/mbgl/geometry/buffer.hpp
index 446177d443..80cc6b9d1a 100644
--- a/include/mbgl/geometry/buffer.hpp
+++ b/include/mbgl/geometry/buffer.hpp
@@ -84,15 +84,15 @@ protected:
}
// Get a pointer to the item at a given index.
- inline void *getElement(size_t index) {
+ inline void *getElement(size_t i) {
if (array == nullptr) {
throw std::runtime_error("Buffer was already deleted or doesn't contain elements");
}
- if (index * itemSize >= pos) {
+ if (i * itemSize >= pos) {
throw new std::runtime_error("Can't get element after array bounds");
} else {
- return static_cast<char *>(array) + (index * itemSize);
+ return static_cast<char *>(array) + (i * itemSize);
}
}
diff --git a/include/mbgl/util/pbf.hpp b/include/mbgl/util/pbf.hpp
index ab4d60cd37..d017219a52 100644
--- a/include/mbgl/util/pbf.hpp
+++ b/include/mbgl/util/pbf.hpp
@@ -132,9 +132,9 @@ double pbf::float64() {
std::string pbf::string() {
uint32_t bytes = static_cast<uint32_t>(varint());
- const char *string = reinterpret_cast<const char*>(data);
+ const char *string_data = reinterpret_cast<const char*>(data);
skipBytes(bytes);
- return std::string(string, bytes);
+ return std::string(string_data, bytes);
}
bool pbf::boolean() {
diff --git a/include/mbgl/util/transition.hpp b/include/mbgl/util/transition.hpp
index 16adc41ceb..b78abfa8fd 100644
--- a/include/mbgl/util/transition.hpp
+++ b/include/mbgl/util/transition.hpp
@@ -36,8 +36,8 @@ protected:
template <typename T>
class ease_transition : public transition {
public:
- ease_transition(T from_, T to_, T& value_, timestamp start, timestamp duration)
- : transition(start, duration),
+ ease_transition(T from_, T to_, T& value_, timestamp start_, timestamp duration_)
+ : transition(start_, duration_),
from(from_),
to(to_),
value(value_) {}
@@ -53,8 +53,8 @@ private:
template <typename T>
class timeout : public transition {
public:
- timeout(T final_value_, T& value_, timestamp start, timestamp duration)
- : transition(start, duration),
+ timeout(T final_value_, T& value_, timestamp start_, timestamp duration_)
+ : transition(start_, duration_),
final_value(final_value_),
value(value_) {}
diff --git a/src/clipper/clipper.cpp b/src/clipper/clipper.cpp
index 7571ae1439..ea468d69e4 100755
--- a/src/clipper/clipper.cpp
+++ b/src/clipper/clipper.cpp
@@ -48,6 +48,8 @@
#include <ostream>
#include <functional>
+#pragma GCC diagnostic ignored "-Wshadow"
+
namespace ClipperLib {
#ifdef use_int32
diff --git a/src/geometry/debug_font_buffer.cpp b/src/geometry/debug_font_buffer.cpp
index 387a646299..2a0924a1c4 100644
--- a/src/geometry/debug_font_buffer.cpp
+++ b/src/geometry/debug_font_buffer.cpp
@@ -10,9 +10,9 @@ using namespace mbgl;
void DebugFontBuffer::addText(const char *text, double left, double baseline, double scale) {
uint16_t *coords = nullptr;
- size_t length = strlen(text);
- for (size_t i = 0; i < length; ++i) {
- if (text[i] < 32 || text[i] > 127) {
+ const size_t len = strlen(text);
+ for (size_t i = 0; i < len; ++i) {
+ if (text[i] < 32 || (unsigned char)(text[i]) > 127) {
continue;
}
diff --git a/src/map/raster_tile_data.cpp b/src/map/raster_tile_data.cpp
index e7725b7abd..99ca327fe7 100644
--- a/src/map/raster_tile_data.cpp
+++ b/src/map/raster_tile_data.cpp
@@ -5,8 +5,8 @@
using namespace mbgl;
-RasterTileData::RasterTileData(Tile::ID id, Map &map, const util::ptr<SourceInfo> &source)
- : TileData(id, map, source),
+RasterTileData::RasterTileData(Tile::ID id_, Map &map_, const util::ptr<SourceInfo> &source_)
+ : TileData(id_, map_, source_),
bucket(map.getTexturepool(), properties) {
}
diff --git a/src/map/tile.cpp b/src/map/tile.cpp
index 1fe0faefde..3070d3fd96 100644
--- a/src/map/tile.cpp
+++ b/src/map/tile.cpp
@@ -25,13 +25,13 @@ std::forward_list<Tile::ID> Tile::ID::children(int32_t child_z) const {
assert(child_z > z);
int32_t factor = std::pow(2, child_z - z);
- std::forward_list<ID> children;
+ std::forward_list<ID> child_ids;
for (int32_t ty = y * factor, y_max = (y + 1) * factor; ty < y_max; ++ty) {
for (int32_t tx = x * factor, x_max = (x + 1) * factor; tx < x_max; ++tx) {
- children.emplace_front(child_z, tx, ty);
+ child_ids.emplace_front(child_z, tx, ty);
}
}
- return children;
+ return child_ids;
}
Tile::ID Tile::ID::normalized() const {
@@ -42,13 +42,13 @@ Tile::ID Tile::ID::normalized() const {
return ID { z, nx, ny };
}
-bool Tile::ID::isChildOf(const Tile::ID &parent) const {
- if (parent.z >= z || parent.w != w) {
+bool Tile::ID::isChildOf(const Tile::ID &parent_id) const {
+ if (parent_id.z >= z || parent_id.w != w) {
return false;
}
- int32_t scale = std::pow(2, z - parent.z);
- return parent.x == ((x < 0 ? x - scale + 1 : x) / scale) &&
- parent.y == y / scale;
+ int32_t scale = std::pow(2, z - parent_id.z);
+ return parent_id.x == ((x < 0 ? x - scale + 1 : x) / scale) &&
+ parent_id.y == y / scale;
}
diff --git a/src/map/transform_state.cpp b/src/map/transform_state.cpp
index fa521400c3..0a858bce6a 100644
--- a/src/map/transform_state.cpp
+++ b/src/map/transform_state.cpp
@@ -96,8 +96,8 @@ float TransformState::lngX(float lon) const {
}
float TransformState::latY(float lat) const {
- float latY = 180 / M_PI * std::log(std::tan(M_PI / 4 + lat * M_PI / 360));
- return (180 - latY) * worldSize() / 360;
+ float lat_y = 180 / M_PI * std::log(std::tan(M_PI / 4 + lat * M_PI / 360));
+ return (180 - lat_y) * worldSize() / 360;
}
std::array<float, 2> TransformState::locationCoordinate(float lon, float lat) const {
diff --git a/src/map/vector_tile_data.cpp b/src/map/vector_tile_data.cpp
index 48b46059a5..b94bc66dea 100644
--- a/src/map/vector_tile_data.cpp
+++ b/src/map/vector_tile_data.cpp
@@ -8,8 +8,8 @@
using namespace mbgl;
-VectorTileData::VectorTileData(Tile::ID id, Map &map, const util::ptr<SourceInfo> &source)
- : TileData(id, map, source),
+VectorTileData::VectorTileData(Tile::ID id_, Map &map_, const util::ptr<SourceInfo> &source_)
+ : TileData(id_, map_, source_),
depth(id.z >= source->max_zoom ? map.getMaxZoom() - id.z : 1) {
}
diff --git a/src/renderer/painter.cpp b/src/renderer/painter.cpp
index aa522734c5..38c2176aed 100644
--- a/src/renderer/painter.cpp
+++ b/src/renderer/painter.cpp
@@ -128,10 +128,10 @@ void Painter::useProgram(uint32_t program) {
}
}
-void Painter::lineWidth(float lineWidth) {
- if (gl_lineWidth != lineWidth) {
- glLineWidth(lineWidth);
- gl_lineWidth = lineWidth;
+void Painter::lineWidth(float line_width) {
+ if (gl_lineWidth != line_width) {
+ glLineWidth(line_width);
+ gl_lineWidth = line_width;
}
}
diff --git a/src/storage/file_source.cpp b/src/storage/file_source.cpp
index 12d924416c..70b4abe4c7 100644
--- a/src/storage/file_source.cpp
+++ b/src/storage/file_source.cpp
@@ -27,12 +27,12 @@ FileSource::~FileSource() {
// NOTE: We don't need to delete the messenger since it will be deleted by the
// uv_messenger_stop() function.
- util::ptr<BaseRequest> request;
+ util::ptr<BaseRequest> req;
// Send a cancel() message to all requests that we are still holding.
for (const std::pair<std::string, std::weak_ptr<BaseRequest>> &pair : pending) {
- if ((request = pair.second.lock())) {
- request->cancel();
+ if ((req = pair.second.lock())) {
+ req->cancel();
}
}
}
@@ -61,25 +61,25 @@ std::unique_ptr<Request> FileSource::request(ResourceType type, const std::strin
}
}();
- util::ptr<BaseRequest> request;
+ util::ptr<BaseRequest> req;
// First, try to find an existing Request object.
auto it = pending.find(absoluteURL);
if (it != pending.end()) {
- request = it->second.lock();
+ req = it->second.lock();
}
- if (!request) {
+ if (!req) {
if (absoluteURL.substr(0, 7) == "file://") {
- request = std::make_shared<FileRequest>(absoluteURL.substr(7), loop);
+ req = std::make_shared<FileRequest>(absoluteURL.substr(7), loop);
} else {
- request = std::make_shared<HTTPRequest>(type, absoluteURL, loop, store);
+ req = std::make_shared<HTTPRequest>(type, absoluteURL, loop, store);
}
- pending.emplace(absoluteURL, request);
+ pending.emplace(absoluteURL, req);
}
- return std::unique_ptr<Request>(new Request(request));
+ return std::unique_ptr<Request>(new Request(req));
}
void FileSource::prepare(std::function<void()> fn) {
@@ -93,10 +93,10 @@ void FileSource::prepare(std::function<void()> fn) {
void FileSource::retryAllPending() {
assert(thread_id == uv_thread_self());
- util::ptr<BaseRequest> request;
+ util::ptr<BaseRequest> req;
for (const std::pair<std::string, std::weak_ptr<BaseRequest>> &pair : pending) {
- if ((request = pair.second.lock())) {
- request->retryImmediately();
+ if ((req = pair.second.lock())) {
+ req->retryImmediately();
}
}
diff --git a/src/storage/http_request.cpp b/src/storage/http_request.cpp
index 3da4fc7c31..46b1d5e194 100644
--- a/src/storage/http_request.cpp
+++ b/src/storage/http_request.cpp
@@ -20,8 +20,8 @@ struct CacheRequestBaton {
util::ptr<SQLiteStore> store;
};
-HTTPRequest::HTTPRequest(ResourceType type_, const std::string &path, uv_loop_t *loop_, util::ptr<SQLiteStore> store_)
- : BaseRequest(path), thread_id(uv_thread_self()), loop(loop_), store(store_), type(type_) {
+HTTPRequest::HTTPRequest(ResourceType type_, const std::string &path_, uv_loop_t *loop_, util::ptr<SQLiteStore> store_)
+ : BaseRequest(path_), thread_id(uv_thread_self()), loop(loop_), store(store_), type(type_) {
if (store) {
startCacheRequest();
} else {
diff --git a/src/storage/response.cpp b/src/storage/response.cpp
index cdaf33e4e4..f1e1c35874 100644
--- a/src/storage/response.cpp
+++ b/src/storage/response.cpp
@@ -9,7 +9,7 @@ int64_t Response::parseCacheControl(const char *value) {
uint64_t seconds = 0;
// TODO: cache-control may contain other information as well:
// http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9
- if (std::sscanf(value, "max-age=%llu", &seconds) == 1) {
+ if (std::sscanf(value, "max-age=%lu", &seconds) == 1) {
return std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::system_clock::now().time_since_epoch()).count() +
seconds;
diff --git a/src/style/style.cpp b/src/style/style.cpp
index 6f0a0e3b28..aa5b150882 100644
--- a/src/style/style.cpp
+++ b/src/style/style.cpp
@@ -12,6 +12,7 @@
#include <rapidjson/document.h>
+#include <algorithm>
namespace mbgl {
diff --git a/src/style/style_parser.cpp b/src/style/style_parser.cpp
index b2714f5da5..47ff0c30ab 100644
--- a/src/style/style_parser.cpp
+++ b/src/style/style_parser.cpp
@@ -6,6 +6,8 @@
#include <mbgl/platform/log.hpp>
#include <csscolorparser/csscolorparser.hpp>
+#include <algorithm>
+
namespace mbgl {
using JSVal = const rapidjson::Value&;
diff --git a/src/util/image.cpp b/src/util/image.cpp
index ec218e0bed..fd0d34de2d 100644
--- a/src/util/image.cpp
+++ b/src/util/image.cpp
@@ -1,4 +1,5 @@
#include <mbgl/util/image.hpp>
+
#include <png.h>
#include <cassert>
diff --git a/src/util/raster.cpp b/src/util/raster.cpp
index c4d7a15400..76cd411223 100644
--- a/src/util/raster.cpp
+++ b/src/util/raster.cpp
@@ -6,8 +6,6 @@
#include <mbgl/util/uv_detail.hpp>
#include <mbgl/util/std.hpp>
-#include <png.h>
-
#include <cassert>
#include <cstring>
diff --git a/test/fixtures/fixture_log.cpp b/test/fixtures/fixture_log.cpp
index c2c10fc9eb..1b1646e665 100644
--- a/test/fixtures/fixture_log.cpp
+++ b/test/fixtures/fixture_log.cpp
@@ -9,25 +9,25 @@ FixtureLogBackend::~FixtureLogBackend() {
}
size_t FixtureLogBackend::count(const LogMessage &message) const {
- size_t count = 0;
+ size_t message_count = 0;
for (const LogMessage &msg : messages) {
if (msg == message) {
- count++;
+ message_count++;
msg.checked = true;
}
}
- return count;
+ return message_count;
}
std::vector<FixtureLogBackend::LogMessage> FixtureLogBackend::unchecked() const {
- std::vector<LogMessage> unchecked;
+ std::vector<LogMessage> unchecked_messages;
for (const LogMessage &msg : messages) {
if (!msg.checked) {
- unchecked.push_back(msg);
+ unchecked_messages.push_back(msg);
msg.checked = true;
}
}
- return unchecked;
+ return unchecked_messages;
}
::std::ostream& operator<<(::std::ostream& os, const std::vector<FixtureLogBackend::LogMessage>& messages) {