Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[build] add back -Werror
Browse files Browse the repository at this point in the history
  • Loading branch information
kkaefer committed Sep 30, 2016
1 parent d4888cb commit b470a65
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 28 deletions.
13 changes: 9 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,23 @@ mason_use(boost VERSION 1.60.0 HEADER_ONLY)
mason_use(geojsonvt VERSION 6.1.3 HEADER_ONLY)
mason_use(supercluster VERSION 0.2.0 HEADER_ONLY)
mason_use(kdbush VERSION 0.1.1 HEADER_ONLY)
mason_use(earcut VERSION 0.11 HEADER_ONLY)
mason_use(earcut VERSION 0.12.1 HEADER_ONLY)
mason_use(protozero VERSION 1.4.2 HEADER_ONLY)
mason_use(pixelmatch VERSION 0.9.0 HEADER_ONLY)
mason_use(geojson VERSION 0.3.1 HEADER_ONLY)
mason_use(pixelmatch VERSION 0.10.0 HEADER_ONLY)
mason_use(geojson VERSION 0.3.2 HEADER_ONLY)

if(WITH_COVERAGE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage")
endif(WITH_COVERAGE)

set(CMAKE_CONFIGURATION_TYPES Debug Release)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -Wextra -Wshadow -Wno-variadic-macros -Wno-unknown-pragmas")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -Wextra -Wshadow -Werror -Wno-variadic-macros -Wno-unknown-pragmas")
if(APPLE)
# -Wno-error=unused-command-line-argument is required due to https://llvm.org/bugs/show_bug.cgi?id=7798
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=unused-command-line-argument")
endif()

if(NOT EXISTS ${CMAKE_SOURCE_DIR}/platform/${MBGL_PLATFORM}/config.cmake)
message(ERROR "Can't find config.cmake file for platform ${MBGL_PLATFORM}")
Expand Down
14 changes: 7 additions & 7 deletions src/mbgl/geometry/buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

namespace mbgl {

template <size_t item_size,
template <uint32_t item_size,
gl::BufferType target = gl::BufferType::Vertex,
size_t defaultLength = 8192,
uint32_t defaultLength = 8192,
bool retainAfterUpload = false>
class Buffer : private util::noncopyable {
static_assert(target == gl::BufferType::Vertex || target == gl::BufferType::Element,
Expand All @@ -27,8 +27,8 @@ class Buffer : private util::noncopyable {

// Returns the number of elements in this buffer. This is not the number of
// bytes, but rather the number of coordinates with associated information.
size_t index() const {
return static_cast<size_t>(pos / itemSize);
uint32_t index() const {
return pos / itemSize;
}

bool empty() const {
Expand Down Expand Up @@ -96,17 +96,17 @@ class Buffer : private util::noncopyable {
}

public:
static const size_t itemSize = item_size;
static constexpr const uint32_t itemSize = item_size;

private:
// CPU buffer
void* array = nullptr;

// Byte position where we are writing.
size_t pos = 0;
uint32_t pos = 0;

// Number of bytes that are valid in this buffer.
size_t length = 0;
uint32_t length = 0;

// GL buffer object handle.
mbgl::optional<gl::UniqueBuffer> buffer;
Expand Down
4 changes: 2 additions & 2 deletions src/mbgl/geometry/collision_box_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

namespace mbgl {

size_t CollisionBoxVertexBuffer::add(int16_t x, int16_t y, float ox, float oy, float maxzoom, float placementZoom) {
const size_t idx = index();
uint32_t CollisionBoxVertexBuffer::add(int16_t x, int16_t y, float ox, float oy, float maxzoom, float placementZoom) {
const uint32_t idx = index();
void *data = addElement();

int16_t *shorts = static_cast<int16_t *>(data);
Expand Down
2 changes: 1 addition & 1 deletion src/mbgl/geometry/collision_box_buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class CollisionBoxVertexBuffer : public Buffer <
public:
typedef int16_t vertex_type;

size_t add(int16_t x, int16_t y, float ex, float ey, float maxzoom, float placementZoom);
uint32_t add(int16_t x, int16_t y, float ex, float ey, float maxzoom, float placementZoom);
};


Expand Down
8 changes: 4 additions & 4 deletions src/mbgl/geometry/elements_buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@

namespace mbgl {

template <size_t count>
template <uint8_t count>
struct ElementGroup : public util::noncopyable {
std::array<VertexArrayObject, count> array;
size_t vertex_length;
size_t elements_length;
uint32_t vertex_length;
uint32_t elements_length;

ElementGroup(size_t vertex_length_ = 0, size_t elements_length_ = 0)
ElementGroup(uint32_t vertex_length_ = 0, uint32_t elements_length_ = 0)
: vertex_length(vertex_length_)
, elements_length(elements_length_)
{
Expand Down
4 changes: 2 additions & 2 deletions src/mbgl/geometry/icon_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

namespace mbgl {

size_t IconVertexBuffer::add(int16_t x, int16_t y, float ox, float oy, int16_t tx, int16_t ty, float minzoom, float maxzoom, float labelminzoom, uint8_t labelangle) {
const size_t idx = index();
uint32_t IconVertexBuffer::add(int16_t x, int16_t y, float ox, float oy, int16_t tx, int16_t ty, float minzoom, float maxzoom, float labelminzoom, uint8_t labelangle) {
const uint32_t idx = index();
void *data = addElement();

int16_t *shorts = static_cast<int16_t *>(data);
Expand Down
2 changes: 1 addition & 1 deletion src/mbgl/geometry/icon_buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace mbgl {
16
> {
public:
size_t add(int16_t x, int16_t y, float ox, float oy, int16_t tx, int16_t ty, float minzoom, float maxzoom, float labelminzoom, uint8_t labelangle);
uint32_t add(int16_t x, int16_t y, float ox, float oy, int16_t tx, int16_t ty, float minzoom, float maxzoom, float labelminzoom, uint8_t labelangle);

};

Expand Down
4 changes: 2 additions & 2 deletions src/mbgl/geometry/line_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace mbgl {

size_t LineVertexBuffer::add(vertex_type x, vertex_type y, float ex, float ey, bool tx, bool ty, int8_t dir, int32_t linesofar) {
size_t idx = index();
uint32_t LineVertexBuffer::add(vertex_type x, vertex_type y, float ex, float ey, bool tx, bool ty, int8_t dir, int32_t linesofar) {
uint32_t idx = index();
void *data = addElement();

int16_t *coords = static_cast<int16_t *>(data);
Expand Down
2 changes: 1 addition & 1 deletion src/mbgl/geometry/line_buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class LineVertexBuffer : public Buffer<
* @param {number} ty texture normal
* @param {number} dir direction of the line cap (-1/0/1)
*/
size_t add(vertex_type x, vertex_type y, float ex, float ey, bool tx, bool ty, int8_t dir, int32_t linesofar = 0);
uint32_t add(vertex_type x, vertex_type y, float ex, float ey, bool tx, bool ty, int8_t dir, int32_t linesofar = 0);
};


Expand Down
4 changes: 2 additions & 2 deletions src/mbgl/geometry/text_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

namespace mbgl {

size_t TextVertexBuffer::add(int16_t x, int16_t y, float ox, float oy, uint16_t tx, uint16_t ty, float minzoom, float maxzoom, float labelminzoom, uint8_t labelangle) {
const size_t idx = index();
uint32_t TextVertexBuffer::add(int16_t x, int16_t y, float ox, float oy, uint16_t tx, uint16_t ty, float minzoom, float maxzoom, float labelminzoom, uint8_t labelangle) {
const uint32_t idx = index();
void *data = addElement();

int16_t *shorts = static_cast<int16_t *>(data);
Expand Down
2 changes: 1 addition & 1 deletion src/mbgl/geometry/text_buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class TextVertexBuffer : public Buffer <
public:
typedef int16_t vertex_type;

size_t add(int16_t x, int16_t y, float ox, float oy, uint16_t tx, uint16_t ty, float minzoom, float maxzoom, float labelminzoom, uint8_t labelangle);
uint32_t add(int16_t x, int16_t y, float ox, float oy, uint16_t tx, uint16_t ty, float minzoom, float maxzoom, float labelminzoom, uint8_t labelangle);
};


Expand Down
2 changes: 1 addition & 1 deletion test/storage/online_file_source.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ TEST(OnlineFileSource, TEST_REQUIRES_SERVER(RateLimitDefault)) {
auto req = fs.request({ Resource::Unknown, "http://127.0.0.1:3000/rate-limit" }, [&](Response res) {
ASSERT_NE(nullptr, res.error);
EXPECT_EQ(Response::Error::Reason::RateLimit, res.error->reason);
ASSERT_EQ(false, bool(res.error->retryAfter));
ASSERT_FALSE(res.error->retryAfter);
loop.stop();
});

Expand Down

0 comments on commit b470a65

Please sign in to comment.