From a58ef62fc2286ed9f738a544bdfa94eac47f0178 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Wed, 2 Dec 2015 15:54:58 -0500 Subject: [PATCH 1/3] start fixing gcc 4.9 -Wshadow warnings --- include/mapnik/attribute.hpp | 4 ++-- include/mapnik/color.hpp | 10 +++++----- include/mapnik/enumeration.hpp | 4 ++-- include/mapnik/feature.hpp | 4 ++-- include/mapnik/marker.hpp | 10 +++++----- include/mapnik/simplify_converter.hpp | 12 ++++++------ include/mapnik/svg/svg_path_adapter.hpp | 2 +- include/mapnik/transform_path_adapter.hpp | 8 ++++---- include/mapnik/view_transform.hpp | 14 +++++++------- include/mapnik/warning_ignore.hpp | 2 +- 10 files changed, 35 insertions(+), 35 deletions(-) diff --git a/include/mapnik/attribute.hpp b/include/mapnik/attribute.hpp index b0cf6839a..edfaebefc 100644 --- a/include/mapnik/attribute.hpp +++ b/include/mapnik/attribute.hpp @@ -36,8 +36,8 @@ namespace mapnik { struct attribute { std::string name_; - explicit attribute(std::string const& name) - : name_(name) {} + explicit attribute(std::string const& _name) + : name_(_name) {} template V const& value(F const& f) const diff --git a/include/mapnik/color.hpp b/include/mapnik/color.hpp index b22a9989d..c593c54dd 100644 --- a/include/mapnik/color.hpp +++ b/include/mapnik/color.hpp @@ -55,11 +55,11 @@ public: premultiplied_(false) {} - color(std::uint8_t red, std::uint8_t green, std::uint8_t blue, std::uint8_t alpha = 0xff, bool premultiplied = false) - : red_(red), - green_(green), - blue_(blue), - alpha_(alpha), + color(std::uint8_t _red, std::uint8_t _green, std::uint8_t _blue, std::uint8_t _alpha = 0xff, bool premultiplied = false) + : red_(_red), + green_(_green), + blue_(_blue), + alpha_(_alpha), premultiplied_(premultiplied) {} diff --git a/include/mapnik/enumeration.hpp b/include/mapnik/enumeration.hpp index c0cfe1e8a..cee70474d 100644 --- a/include/mapnik/enumeration.hpp +++ b/include/mapnik/enumeration.hpp @@ -41,8 +41,8 @@ public: illegal_enum_value(): what_() {} - illegal_enum_value( std::string const& what ) : - what_( what ) + illegal_enum_value( std::string const& _what ) : + what_( _what ) { } virtual ~illegal_enum_value() throw() {} diff --git a/include/mapnik/feature.hpp b/include/mapnik/feature.hpp index 769ca0579..ebcbe88e7 100644 --- a/include/mapnik/feature.hpp +++ b/include/mapnik/feature.hpp @@ -101,8 +101,8 @@ public: using cont_type = std::vector; using iterator = feature_kv_iterator; - feature_impl(context_ptr const& ctx, mapnik::value_integer id) - : id_(id), + feature_impl(context_ptr const& ctx, mapnik::value_integer _id) + : id_(_id), ctx_(ctx), data_(ctx_->mapping_.size()), geom_(geometry::geometry_empty()), diff --git a/include/mapnik/marker.hpp b/include/mapnik/marker.hpp index 6f7cbf02d..3aaa1cd84 100644 --- a/include/mapnik/marker.hpp +++ b/include/mapnik/marker.hpp @@ -70,9 +70,9 @@ public: box2d bounding_box() const { - std::size_t width = bitmap_data_.width(); - std::size_t height = bitmap_data_.height(); - return box2d(static_cast(0), static_cast(0), static_cast(width), static_cast(height)); + std::size_t _width = bitmap_data_.width(); + std::size_t _height = bitmap_data_.height(); + return box2d(static_cast(0), static_cast(0), static_cast(_width), static_cast(_height)); } inline double width() const @@ -189,8 +189,8 @@ struct marker : marker_base marker() = default; template - marker(T && data) noexcept - : marker_base(std::move(data)) {} + marker(T && _data) noexcept + : marker_base(std::move(_data)) {} double width() const { diff --git a/include/mapnik/simplify_converter.hpp b/include/mapnik/simplify_converter.hpp index 77d367426..92f81b461 100644 --- a/include/mapnik/simplify_converter.hpp +++ b/include/mapnik/simplify_converter.hpp @@ -76,16 +76,16 @@ struct sleeve bool inside(vertex2d const& q) { - bool inside=false; + bool _inside=false; for (unsigned i=0;i<4;++i) { if ((((v[i+1].y <= q.y) && (q.y < v[i].y)) || ((v[i].y <= q.y) && (q.y < v[i+1].y))) && (q.x < (v[i].x - v[i+1].x) * (q.y - v[i+1].y)/ (v[i].y - v[i+1].y) + v[i+1].x)) - inside=!inside; + _inside=!_inside; } - return inside; + return _inside; } }; @@ -592,11 +592,11 @@ private: } // Slurp the points back out that haven't been marked as discarded - for (vertex2d const& vertex : vertices) + for (vertex2d const& v : vertices) { - if (vertex.cmd != SEG_END) + if (v.cmd != SEG_END) { - vertices_.emplace_back(vertex); + vertices_.emplace_back(v); } } diff --git a/include/mapnik/svg/svg_path_adapter.hpp b/include/mapnik/svg/svg_path_adapter.hpp index beb8222cb..3b09af4bc 100644 --- a/include/mapnik/svg/svg_path_adapter.hpp +++ b/include/mapnik/svg/svg_path_adapter.hpp @@ -49,7 +49,7 @@ public: using self_type = path_adapter; //-------------------------------------------------------------------- - path_adapter(VertexContainer & vertices) : vertices_(vertices), iterator_(0) {} + path_adapter(VertexContainer & _vertices) : vertices_(_vertices), iterator_(0) {} //void remove_all() { vertices_.remove_all(); iterator_ = 0; } //void free_all() { vertices_.free_all(); iterator_ = 0; } diff --git a/include/mapnik/transform_path_adapter.hpp b/include/mapnik/transform_path_adapter.hpp index cb68e9139..5f9a5f34b 100644 --- a/include/mapnik/transform_path_adapter.hpp +++ b/include/mapnik/transform_path_adapter.hpp @@ -56,11 +56,11 @@ struct transform_path_adapter using size_type = std::size_t; using value_type = typename select_value_type::type; - transform_path_adapter(Transform const& t, - Geometry & geom, + transform_path_adapter(Transform const& _t, + Geometry & _geom, proj_transform const& prj_trans) - : t_(&t), - geom_(geom), + : t_(&_t), + geom_(_geom), prj_trans_(&prj_trans) {} explicit transform_path_adapter(Geometry & geom) diff --git a/include/mapnik/view_transform.hpp b/include/mapnik/view_transform.hpp index 2f5108c5f..fa116c4ac 100644 --- a/include/mapnik/view_transform.hpp +++ b/include/mapnik/view_transform.hpp @@ -44,15 +44,15 @@ private: int offset_; public: - view_transform(int width, int height, box2d const& extent, - double offset_x = 0.0, double offset_y = 0.0) - : width_(width), - height_(height), - extent_(extent), + view_transform(int _width, int _height, box2d const& _extent, + double _offset_x = 0.0, double _offset_y = 0.0) + : width_(_width), + height_(_height), + extent_(_extent), sx_(extent_.width() > 0 ? static_cast(width_) / extent_.width() : 1.0), sy_(extent_.height() > 0 ? static_cast(height_) / extent_.height() : 1.0), - offset_x_(offset_x), - offset_y_(offset_y), + offset_x_(_offset_x), + offset_y_(_offset_y), offset_(0) {} view_transform(view_transform const&) = default; diff --git a/include/mapnik/warning_ignore.hpp b/include/mapnik/warning_ignore.hpp index 186087bb0..63eea1714 100644 --- a/include/mapnik/warning_ignore.hpp +++ b/include/mapnik/warning_ignore.hpp @@ -22,8 +22,8 @@ #pragma GCC diagnostic ignored "-Wunknown-pragmas" // clang+gcc -#pragma GCC diagnostic ignored "-Wno-unknown-pragmas" // clang #pragma GCC diagnostic ignored "-Wno-pragmas" // gcc +#pragma GCC diagnostic ignored "-Wno-unknown-pragmas" // clang #pragma GCC diagnostic ignored "-Wno-unsequenced" #pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wunused-parameter" From e424ef1d77db9c3017ac4f5b2485df00be4225f1 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Wed, 2 Dec 2015 15:55:26 -0500 Subject: [PATCH 2/3] start fixing gcc 4.9 -Wshadow warnings --- deps/agg/include/agg_array.h | 78 ++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/deps/agg/include/agg_array.h b/deps/agg/include/agg_array.h index 80e02c205..d07e46b0b 100644 --- a/deps/agg/include/agg_array.h +++ b/deps/agg/include/agg_array.h @@ -27,8 +27,8 @@ namespace agg { public: typedef T value_type; - pod_array_adaptor(T* array, unsigned size) : - m_array(array), m_size(size) {} + pod_array_adaptor(T* array, unsigned _size) : + m_array(array), m_size(_size) {} unsigned size() const { return m_size; } const T& operator [] (unsigned i) const { return m_array[i]; } @@ -87,7 +87,7 @@ namespace agg void clear() { m_size = 0; } void add(const T& v) { m_array[m_size++] = v; } void push_back(const T& v) { m_array[m_size++] = v; } - void inc_size(unsigned size) { m_size += size; } + void inc_size(unsigned _size) { m_size += _size; } unsigned size() const { return m_size; } const T& operator [] (unsigned i) const { return m_array[i]; } @@ -112,9 +112,9 @@ namespace agg ~pod_array() { pod_allocator::deallocate(m_array, m_size); } pod_array() : m_array(0), m_size(0) {} - pod_array(unsigned size) : - m_array(pod_allocator::allocate(size)), - m_size(size) + pod_array(unsigned _size) : + m_array(pod_allocator::allocate(_size)), + m_size(_size) {} pod_array(const self_type& v) : @@ -124,12 +124,12 @@ namespace agg memcpy(m_array, v.m_array, sizeof(T) * m_size); } - void resize(unsigned size) + void resize(unsigned _size) { - if(size != m_size) + if(_size != m_size) { pod_allocator::deallocate(m_array, m_size); - m_array = pod_allocator::allocate(m_size = size); + m_array = pod_allocator::allocate(m_size = _size); } } const self_type& operator = (const self_type& v) @@ -191,7 +191,7 @@ namespace agg void add(const T& v) { m_array[m_size++] = v; } void push_back(const T& v) { m_array[m_size++] = v; } void insert_at(unsigned pos, const T& val); - void inc_size(unsigned size) { m_size += size; } + void inc_size(unsigned _size) { m_size += _size; } unsigned size() const { return m_size; } unsigned byte_size() const { return m_size * sizeof(T); } void serialize(int8u* ptr) const; @@ -230,10 +230,10 @@ namespace agg //------------------------------------------------------------------------ template - void pod_vector::allocate(unsigned size, unsigned extra_tail) + void pod_vector::allocate(unsigned _size, unsigned extra_tail) { - capacity(size, extra_tail); - m_size = size; + capacity(_size, extra_tail); + m_size = _size; } @@ -245,10 +245,10 @@ namespace agg { if(new_size > m_capacity) { - T* data = pod_allocator::allocate(new_size); - memcpy(data, m_array, m_size * sizeof(T)); + T* _data = pod_allocator::allocate(new_size); + memcpy(_data, m_array, m_size * sizeof(T)); pod_allocator::deallocate(m_array, m_capacity); - m_array = data; + m_array = _data; } } else @@ -289,11 +289,11 @@ namespace agg //------------------------------------------------------------------------ template - void pod_vector::deserialize(const int8u* data, unsigned byte_size) + void pod_vector::deserialize(const int8u* _data, unsigned _byte_size) { - byte_size /= sizeof(T); - allocate(byte_size); - if(byte_size) memcpy(m_array, data, byte_size * sizeof(T)); + _byte_size /= sizeof(T); + allocate(_byte_size); + if(_byte_size) memcpy(m_array, _data, _byte_size * sizeof(T)); } //------------------------------------------------------------------------ @@ -371,9 +371,9 @@ namespace agg } } - void cut_at(unsigned size) + void cut_at(unsigned _size) { - if(size < m_size) m_size = size; + if(_size < m_size) m_size = _size; } unsigned size() const { return m_size; } @@ -529,11 +529,11 @@ namespace agg //------------------------------------------------------------------------ template - void pod_bvector::free_tail(unsigned size) + void pod_bvector::free_tail(unsigned _size) { - if(size < m_size) + if(_size < m_size) { - unsigned nb = (size + block_mask) >> block_shift; + unsigned nb = (_size + block_mask) >> block_shift; while(m_num_blocks > nb) { pod_allocator::deallocate(m_blocks[--m_num_blocks], block_size); @@ -544,7 +544,7 @@ namespace agg m_blocks = 0; m_max_blocks = 0; } - m_size = size; + m_size = _size; } } @@ -728,16 +728,16 @@ namespace agg //------------------------------------------------------------------------ template - void pod_bvector::deserialize(const int8u* data, unsigned byte_size) + void pod_bvector::deserialize(const int8u* _data, unsigned _byte_size) { remove_all(); - byte_size /= sizeof(T); - for(unsigned i = 0; i < byte_size; ++i) + _byte_size /= sizeof(T); + for(unsigned i = 0; i < _byte_size; ++i) { T* ptr = data_ptr(); - memcpy(ptr, data, sizeof(T)); + memcpy(ptr, _data, sizeof(T)); ++m_size; - data += sizeof(T); + _data += sizeof(T); } } @@ -746,27 +746,27 @@ namespace agg //------------------------------------------------------------------------ template void pod_bvector::deserialize(unsigned start, const T& empty_val, - const int8u* data, unsigned byte_size) + const int8u* _data, unsigned _byte_size) { while(m_size < start) { add(empty_val); } - byte_size /= sizeof(T); - for(unsigned i = 0; i < byte_size; ++i) + _byte_size /= sizeof(T); + for(unsigned i = 0; i < _byte_size; ++i) { if(start + i < m_size) { - memcpy(&((*this)[start + i]), data, sizeof(T)); + memcpy(&((*this)[start + i]), _data, sizeof(T)); } else { T* ptr = data_ptr(); - memcpy(ptr, data, sizeof(T)); + memcpy(ptr, _data, sizeof(T)); ++m_size; } - data += sizeof(T); + _data += sizeof(T); } } @@ -1087,8 +1087,8 @@ namespace agg public: typedef typename Array::value_type value_type; - range_adaptor(Array& array, unsigned start, unsigned size) : - m_array(array), m_start(start), m_size(size) + range_adaptor(Array& array, unsigned start, unsigned _size) : + m_array(array), m_start(start), m_size(_size) {} unsigned size() const { return m_size; } From 8e6e74dfa25f8444ad122a76375fcfb7bed78a98 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Thu, 3 Dec 2015 10:22:02 -0500 Subject: [PATCH 3/3] suppress -Wshadow warning from ogr --- plugins/input/ogr/ogr_converter.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/input/ogr/ogr_converter.cpp b/plugins/input/ogr/ogr_converter.cpp index f2eb60294..207c0e1e4 100644 --- a/plugins/input/ogr/ogr_converter.cpp +++ b/plugins/input/ogr/ogr_converter.cpp @@ -25,9 +25,12 @@ #include // ogr +#pragma GCC diagnostic push +#include #include "ogr_converter.hpp" #include #include +#pragma GCC diagnostic pop mapnik::geometry::geometry ogr_converter::convert_geometry(OGRGeometry* ogr_geom) {