Skip to content

Explicitly export exception types. #332

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion include/gdalcpp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ DEALINGS IN THE SOFTWARE.
#include <ogr_api.h>
#include <ogrsf_frmts.h>

#include <osmium/util/compatibility.hpp>

#include <cstdint>
#include <algorithm>
#include <memory>
Expand All @@ -63,7 +65,7 @@ namespace gdalcpp {
/**
* Exception thrown for all errors in this class.
*/
class gdal_error : public std::runtime_error {
class OSMIUM_EXPORT gdal_error : public std::runtime_error {

std::string m_driver;
std::string m_dataset;
Expand Down
3 changes: 2 additions & 1 deletion include/osmium/geom/factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ DEALINGS IN THE SOFTWARE.
#include <osmium/osm/node_ref_list.hpp>
#include <osmium/osm/types.hpp>
#include <osmium/osm/way.hpp>
#include <osmium/util/compatibility.hpp>

#include <cstddef>
#include <stdexcept>
Expand All @@ -56,7 +57,7 @@ namespace osmium {
* Exception thrown when an invalid geometry is encountered. An example
* would be a linestring with less than two points.
*/
class geometry_error : public std::runtime_error {
class OSMIUM_EXPORT geometry_error : public std::runtime_error {

std::string m_message;
osmium::object_id_type m_id;
Expand Down
4 changes: 3 additions & 1 deletion include/osmium/geom/util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ DEALINGS IN THE SOFTWARE.

*/

#include <osmium/util/compatibility.hpp>

#include <stdexcept>
#include <string>

Expand All @@ -42,7 +44,7 @@ namespace osmium {
* Exception thrown when a projection object can not be initialized or the
* projection of some coordinates can not be calculated.
*/
struct projection_error : public std::runtime_error {
struct OSMIUM_EXPORT projection_error : public std::runtime_error {

explicit projection_error(const std::string& what) :
std::runtime_error(what) {
Expand Down
3 changes: 2 additions & 1 deletion include/osmium/handler/check_order.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ DEALINGS IN THE SOFTWARE.
#include <osmium/osm/relation.hpp>
#include <osmium/osm/types.hpp>
#include <osmium/osm/way.hpp>
#include <osmium/util/compatibility.hpp>

#include <limits>
#include <stdexcept>
Expand All @@ -50,7 +51,7 @@ namespace osmium {
* Exception thrown when a method in the CheckOrder class detects
* that the input is out of order.
*/
struct out_of_order_error : public std::runtime_error {
struct OSMIUM_EXPORT out_of_order_error : public std::runtime_error {

osmium::object_id_type object_id;

Expand Down
4 changes: 3 additions & 1 deletion include/osmium/index/index.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ DEALINGS IN THE SOFTWARE.

*/

#include <osmium/util/compatibility.hpp>

#include <cstddef>
#include <cstdint>
#include <limits>
Expand All @@ -45,7 +47,7 @@ namespace osmium {
* Exception signaling that an element could not be
* found in an index.
*/
struct not_found : public std::runtime_error {
struct OSMIUM_EXPORT not_found : public std::runtime_error {

explicit not_found(const std::string& what) :
std::runtime_error(what) {
Expand Down
3 changes: 2 additions & 1 deletion include/osmium/index/map.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ DEALINGS IN THE SOFTWARE.

*/

#include <osmium/util/compatibility.hpp>
#include <osmium/util/string.hpp>

#include <algorithm>
Expand All @@ -47,7 +48,7 @@ DEALINGS IN THE SOFTWARE.

namespace osmium {

struct map_factory_error : public std::runtime_error {
struct OSMIUM_EXPORT map_factory_error : public std::runtime_error {

explicit map_factory_error(const char* message) :
std::runtime_error(message) {
Expand Down
4 changes: 3 additions & 1 deletion include/osmium/io/error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ DEALINGS IN THE SOFTWARE.

*/

#include <osmium/util/compatibility.hpp>

#include <stdexcept>
#include <string>

Expand All @@ -41,7 +43,7 @@ namespace osmium {
/**
* Exception thrown when some kind of input/output operation failed.
*/
struct io_error : public std::runtime_error {
struct OSMIUM_EXPORT io_error : public std::runtime_error {

explicit io_error(const std::string& what) :
std::runtime_error(what) {
Expand Down
2 changes: 1 addition & 1 deletion include/osmium/memory/buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace osmium {
* to write data into a buffer and it doesn't fit. Buffers with internal
* memory management will not throw this exception, but increase their size.
*/
struct buffer_is_full : public std::runtime_error {
struct OSMIUM_EXPORT buffer_is_full : public std::runtime_error {

buffer_is_full() :
std::runtime_error{"Osmium buffer is full"} {
Expand Down
4 changes: 3 additions & 1 deletion include/osmium/osm/item_type.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ DEALINGS IN THE SOFTWARE.

*/

#include <osmium/util/compatibility.hpp>

#include <cassert>
#include <cstdint> // IWYU pragma: keep
#include <iosfwd>
Expand Down Expand Up @@ -192,7 +194,7 @@ namespace osmium {
* probably means the buffer contains different kinds of objects than were
* expected or that there is some kind of data corruption.
*/
struct unknown_type : public std::runtime_error {
struct OSMIUM_EXPORT unknown_type : public std::runtime_error {

unknown_type() :
std::runtime_error("unknown item type") {
Expand Down
6 changes: 6 additions & 0 deletions include/osmium/util/compatibility.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,10 @@ DEALINGS IN THE SOFTWARE.
# define OSMIUM_DEPRECATED
#endif

#if defined(_MSC_VER)
# define OSMIUM_EXPORT __declspec(dllexport)
#else
# define OSMIUM_EXPORT __attribute__ ((visibility("default")))
#endif

#endif // OSMIUM_UTIL_COMPATIBILITY_HPP