correctly enforce symbol visibility

master
Daniel Kolesa 2020-09-19 04:16:26 +02:00
parent 78ffcafc00
commit 2077ff0752
11 changed files with 30 additions and 21 deletions

View File

@ -22,6 +22,12 @@ else
extra_cxxflags = []
endif
cxx = meson.get_compiler('cpp')
if cxx.has_argument('-fvisibility=hidden')
add_global_arguments('-fvisibility=hidden', language: 'cpp')
endif
subdir('src')
if get_option('build-tests')

View File

@ -41,7 +41,7 @@ namespace ostd {
*/
/** @brief The error thrown on parsing and other failures. */
struct arg_error: std::runtime_error {
struct OSTD_EXPORT arg_error: std::runtime_error {
using std::runtime_error::runtime_error;
/* empty, for vtable placement */
@ -98,7 +98,7 @@ enum class arg_value {
*
* This base class is abstract so it cannot be instantiated.
*/
struct arg_description {
struct OSTD_EXPORT arg_description {
friend struct arg_description_container;
friend struct arg_mutually_exclusive_group;
friend struct arg_group;
@ -138,7 +138,7 @@ protected:
*
* It's not instantiated directly.
*/
struct arg_argument: arg_description {
struct OSTD_EXPORT arg_argument: arg_description {
/* empty, for vtable placement */
virtual ~arg_argument();
@ -225,7 +225,7 @@ private:
*
*See ostd::basic_arg_parser for more.
*/
struct arg_optional: arg_argument {
struct OSTD_EXPORT arg_optional: arg_argument {
template<typename HelpFormatter>
friend struct basic_arg_parser;
friend struct arg_description_container;
@ -459,7 +459,7 @@ private:
*
*See ostd::basic_arg_parser for more.
*/
struct arg_positional: arg_argument {
struct OSTD_EXPORT arg_positional: arg_argument {
template<typename HelpFormatter>
friend struct basic_arg_parser;
friend struct arg_description_container;
@ -603,7 +603,7 @@ private:
* A mutually exclusive group can also have the `required` flag set
* in which case one of the arguments must always be used.
*/
struct arg_mutually_exclusive_group: arg_description {
struct OSTD_EXPORT arg_mutually_exclusive_group: arg_description {
friend struct arg_description_container;
/* empty, for vtable placement */
@ -940,7 +940,7 @@ protected:
* A group is named and can optionally have a title. The title is
* displayed in help listing. If not set, the name is displayed.
*/
struct arg_group: arg_description, arg_description_container {
struct OSTD_EXPORT arg_group: arg_description, arg_description_container {
friend struct arg_description_container;
/* empty, for vtable placement */

View File

@ -24,6 +24,7 @@
#include <stdexcept>
#include <memory>
#include <ostd/platform.hh>
#include <ostd/generic_condvar.hh>
namespace ostd {
@ -33,7 +34,7 @@ namespace ostd {
*/
/** @brief Thrown when manipulating a channel that has been closed. */
struct channel_error: std::logic_error {
struct OSTD_EXPORT channel_error: std::logic_error {
using std::logic_error::logic_error;
/* empty, for vtable placement */
virtual ~channel_error();

View File

@ -212,7 +212,7 @@ private:
* The `start` method will also set the internal current scheduler pointer
* so that APIs such as ostd::spawn() can work.
*/
struct scheduler {
struct OSTD_EXPORT scheduler {
private:
struct stack_allocator {
stack_allocator() = delete;
@ -544,7 +544,7 @@ namespace detail {
OSTD_EXPORT extern thread_local csched_task *current_csched_task;
struct csched_task: coroutine_context {
struct OSTD_EXPORT csched_task: coroutine_context {
friend struct coroutine_context;
csched_task() = delete;

View File

@ -54,14 +54,14 @@ namespace ostd {
*
* These can include a dead coroutine/generator call/access.
*/
struct coroutine_error: std::runtime_error {
struct OSTD_EXPORT coroutine_error: std::runtime_error {
using std::runtime_error::runtime_error;
/* empty, for vtable placement */
virtual ~coroutine_error();
};
namespace detail {
struct stack_free_iface {
struct OSTD_EXPORT stack_free_iface {
stack_free_iface() {}
/* empty, for vtable placement */
virtual ~stack_free_iface();
@ -84,7 +84,7 @@ namespace detail {
* managing the coroutine as well as its entry point. All coroutine types
* inherit from this.
*/
struct coroutine_context {
struct OSTD_EXPORT coroutine_context {
/** @brief Gets the currently executing coroutine context.
*
* Sometimes custom coroutine types might want to bypass being able

View File

@ -55,7 +55,7 @@ enum format_flags {
};
/** @brief Thrown when format string does not properly match the arguments. */
struct format_error: std::runtime_error {
struct OSTD_EXPORT format_error: std::runtime_error {
using std::runtime_error::runtime_error;
/* empty, for vtable placement */
virtual ~format_error();

View File

@ -16,6 +16,8 @@
#include <algorithm>
#include <condition_variable>
#include <ostd/platform.hh>
namespace ostd {
/** @addtogroup Concurrency
@ -23,7 +25,7 @@ namespace ostd {
*/
namespace detail {
struct cond_iface {
struct OSTD_EXPORT cond_iface {
cond_iface() {}
virtual ~cond_iface();
virtual void notify_one() = 0;

View File

@ -90,7 +90,7 @@ namespace detail {
*
* It inherits from std::runtime_error and has the same methods and behavior.
*/
struct path_error: std::runtime_error {
struct OSTD_EXPORT path_error: std::runtime_error {
using std::runtime_error::runtime_error;
/* empty, for vtable placement */

View File

@ -32,7 +32,7 @@ namespace ostd {
*/
/** @brief Thrown on errors in ostd::split_args(). */
struct word_error: std::runtime_error {
struct OSTD_EXPORT word_error: std::runtime_error {
using std::runtime_error::runtime_error;
/* empty, for vtable placement */
virtual ~word_error();
@ -81,7 +81,7 @@ Sink &&split_args(Sink &&out, string_range str) {
}
/** @brief Thrown on errors in ostd::subprocess. */
struct subprocess_error: std::runtime_error {
struct OSTD_EXPORT subprocess_error: std::runtime_error {
using std::runtime_error::runtime_error;
/* empty, for vtable placement */
virtual ~subprocess_error();

View File

@ -88,7 +88,7 @@ template<typename T = char, bool = std::is_trivial_v<T>>
struct stream_range;
/** @brief Thrown on stream errors. */
struct stream_error: std::system_error {
struct OSTD_EXPORT stream_error: std::system_error {
using std::system_error::system_error;
/* empty, for vtable placement */
virtual ~stream_error();
@ -102,7 +102,7 @@ struct stream_line_range;
* All streams derive from this, for example ostd::file_steram.
* They implement the virtual interface provided by this class.
*/
struct stream {
struct OSTD_EXPORT stream {
/** @brief The stream offset type. */
using offset_type = stream_off_t;

View File

@ -790,7 +790,7 @@ namespace utf {
static inline constexpr char32_t const max_unicode = 0x10FFFF;
/** @brief Thrown on UTF-8 decoding failure. */
struct utf_error: std::runtime_error {
struct OSTD_EXPORT utf_error: std::runtime_error {
using std::runtime_error::runtime_error;
/* empty, for vtable placement */
virtual ~utf_error();