Skip to content

Commit 83af3ef

Browse files
committed
Remove various workarounds for Windows compiler
They are not needed any more.
1 parent 156a460 commit 83af3ef

3 files changed

Lines changed: 12 additions & 27 deletions

File tree

include/osmium/geom/geos.hpp

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -70,20 +70,13 @@ DEALINGS IN THE SOFTWARE.
7070
#include <algorithm>
7171
#include <cassert>
7272
#include <cstddef>
73+
#include <exception>
7374
#include <iterator>
7475
#include <memory>
7576
#include <string>
7677
#include <utility>
7778
#include <vector>
7879

79-
// MSVC doesn't support throw_with_nested yet
80-
#ifdef _MSC_VER
81-
# define THROW throw
82-
#else
83-
# include <exception>
84-
# define THROW std::throw_with_nested
85-
#endif
86-
8780
namespace osmium {
8881

8982
struct geos_geometry_error : public geometry_error {
@@ -145,7 +138,7 @@ namespace osmium {
145138
try {
146139
return point_type{m_geos_factory->createPoint(geos::geom::Coordinate{xy.x, xy.y})};
147140
} catch (const geos::util::GEOSException& e) {
148-
THROW(osmium::geos_geometry_error(e.what()));
141+
std::throw_with_nested(osmium::geos_geometry_error(e.what()));
149142
}
150143
}
151144

@@ -155,23 +148,23 @@ namespace osmium {
155148
try {
156149
m_coordinate_sequence.reset(m_geos_factory->getCoordinateSequenceFactory()->create(static_cast<std::size_t>(0), 2));
157150
} catch (const geos::util::GEOSException& e) {
158-
THROW(osmium::geos_geometry_error(e.what()));
151+
std::throw_with_nested(osmium::geos_geometry_error(e.what()));
159152
}
160153
}
161154

162155
void linestring_add_location(const osmium::geom::Coordinates& xy) {
163156
try {
164157
m_coordinate_sequence->add(geos::geom::Coordinate{xy.x, xy.y});
165158
} catch (const geos::util::GEOSException& e) {
166-
THROW(osmium::geos_geometry_error(e.what()));
159+
std::throw_with_nested(osmium::geos_geometry_error(e.what()));
167160
}
168161
}
169162

170163
linestring_type linestring_finish(std::size_t /* num_points */) {
171164
try {
172165
return linestring_type{m_geos_factory->createLineString(m_coordinate_sequence.release())};
173166
} catch (const geos::util::GEOSException& e) {
174-
THROW(osmium::geos_geometry_error(e.what()));
167+
std::throw_with_nested(osmium::geos_geometry_error(e.what()));
175168
}
176169
}
177170

@@ -195,47 +188,47 @@ namespace osmium {
195188
m_polygons.emplace_back(m_geos_factory->createPolygon(m_rings[0].release(), inner_rings));
196189
m_rings.clear();
197190
} catch (const geos::util::GEOSException& e) {
198-
THROW(osmium::geos_geometry_error(e.what()));
191+
std::throw_with_nested(osmium::geos_geometry_error(e.what()));
199192
}
200193
}
201194

202195
void multipolygon_outer_ring_start() {
203196
try {
204197
m_coordinate_sequence.reset(m_geos_factory->getCoordinateSequenceFactory()->create(static_cast<std::size_t>(0), 2));
205198
} catch (const geos::util::GEOSException& e) {
206-
THROW(osmium::geos_geometry_error(e.what()));
199+
std::throw_with_nested(osmium::geos_geometry_error(e.what()));
207200
}
208201
}
209202

210203
void multipolygon_outer_ring_finish() {
211204
try {
212205
m_rings.emplace_back(m_geos_factory->createLinearRing(m_coordinate_sequence.release()));
213206
} catch (const geos::util::GEOSException& e) {
214-
THROW(osmium::geos_geometry_error(e.what()));
207+
std::throw_with_nested(osmium::geos_geometry_error(e.what()));
215208
}
216209
}
217210

218211
void multipolygon_inner_ring_start() {
219212
try {
220213
m_coordinate_sequence.reset(m_geos_factory->getCoordinateSequenceFactory()->create(static_cast<std::size_t>(0), 2));
221214
} catch (const geos::util::GEOSException& e) {
222-
THROW(osmium::geos_geometry_error(e.what()));
215+
std::throw_with_nested(osmium::geos_geometry_error(e.what()));
223216
}
224217
}
225218

226219
void multipolygon_inner_ring_finish() {
227220
try {
228221
m_rings.emplace_back(m_geos_factory->createLinearRing(m_coordinate_sequence.release()));
229222
} catch (const geos::util::GEOSException& e) {
230-
THROW(osmium::geos_geometry_error(e.what()));
223+
std::throw_with_nested(osmium::geos_geometry_error(e.what()));
231224
}
232225
}
233226

234227
void multipolygon_add_location(const osmium::geom::Coordinates& xy) {
235228
try {
236229
m_coordinate_sequence->add(geos::geom::Coordinate{xy.x, xy.y});
237230
} catch (const geos::util::GEOSException& e) {
238-
THROW(osmium::geos_geometry_error(e.what()));
231+
std::throw_with_nested(osmium::geos_geometry_error(e.what()));
239232
}
240233
}
241234

@@ -248,7 +241,7 @@ namespace osmium {
248241
m_polygons.clear();
249242
return multipolygon_type{m_geos_factory->createMultiPolygon(polygons)};
250243
} catch (const geos::util::GEOSException& e) {
251-
THROW(osmium::geos_geometry_error(e.what()));
244+
std::throw_with_nested(osmium::geos_geometry_error(e.what()));
252245
}
253246
}
254247

@@ -264,8 +257,6 @@ namespace osmium {
264257

265258
} // namespace osmium
266259

267-
#undef THROW
268-
269260
#endif
270261

271262
#endif // OSMIUM_GEOM_GEOS_HPP

test/data-tests/testdata-xml.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,6 @@ TEST_CASE("Reading OSM XML 140: Using Reader") {
368368

369369
REQUIRE(S_(uc) == t["unicode_xml"]);
370370

371-
// workaround for missing support for u8 string literals on Windows
372-
#if !defined(_MSC_VER)
373371
switch (count) {
374372
case 1:
375373
REQUIRE(S_(uc) == S_(u8"a"));
@@ -389,7 +387,6 @@ TEST_CASE("Reading OSM XML 140: Using Reader") {
389387
default:
390388
REQUIRE(false); // should not be here
391389
}
392-
#endif
393390
}
394391
REQUIRE(count == 5);
395392
}

test/t/io/test_output_utils.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,11 @@ TEST_CASE("UTF8 encoding: encode characters that are special in OPL") {
8787
REQUIRE(out == "%20%%0a%%2c%%3d%%40%");
8888
}
8989

90-
// workaround for missing support for u8 string literals on Windows
91-
#if !defined(_MSC_VER)
9290
TEST_CASE("UTF8 encoding: encode multibyte character") {
9391
std::string out;
9492
osmium::io::detail::append_utf8_encoded_string(out, u8cast(u8"\u30dc_\U0001d11e_\U0001f6eb"));
9593
REQUIRE(out == "%30dc%_%1d11e%_%1f6eb%");
9694
}
97-
#endif
9895

9996
TEST_CASE("html encoding does not encode normal characters") {
10097
const char* s = "abc123,.-";

0 commit comments

Comments
 (0)