export missed symbols

Enable `-fvisibility=hidden` and `-fvisibility-inlines-hidden` by default in CI builds to ensure all public symbols are exported correctly.
This commit is contained in:
Sergiu Deitsch
2021-05-18 14:38:55 +02:00
committed by Victor Zverovich
parent 71fb113818
commit 13e652939b
6 changed files with 27 additions and 10 deletions

View File

@@ -253,6 +253,10 @@
# endif
#else
# define FMT_CLASS_API
# if defined(__GNUC__) || defined(__clang__)
# define FMT_API __attribute__((visibility("default")))
# define FMT_EXTERN_TEMPLATE_API FMT_API
# endif
#endif
#ifndef FMT_API
# define FMT_API

View File

@@ -852,7 +852,7 @@ template <typename T = void> struct basic_data {
// GCC generates slightly better code for pairs than chars.
using digit_pair = char[2];
static constexpr const digit_pair digits[] = {
FMT_API static constexpr const digit_pair digits[] = {
{'0', '0'}, {'0', '1'}, {'0', '2'}, {'0', '3'}, {'0', '4'}, {'0', '5'},
{'0', '6'}, {'0', '7'}, {'0', '8'}, {'0', '9'}, {'1', '0'}, {'1', '1'},
{'1', '2'}, {'1', '3'}, {'1', '4'}, {'1', '5'}, {'1', '6'}, {'1', '7'},
@@ -871,14 +871,19 @@ template <typename T = void> struct basic_data {
{'9', '0'}, {'9', '1'}, {'9', '2'}, {'9', '3'}, {'9', '4'}, {'9', '5'},
{'9', '6'}, {'9', '7'}, {'9', '8'}, {'9', '9'}};
static constexpr const char hex_digits[] = "0123456789abcdef";
static constexpr const char signs[] = {0, '-', '+', ' '};
static constexpr const unsigned prefixes[4] = {0, 0, 0x1000000u | '+',
FMT_API static constexpr const char hex_digits[] = "0123456789abcdef";
FMT_API static constexpr const char signs[] = {0, '-', '+', ' '};
FMT_API static constexpr const unsigned prefixes[4] = {0, 0, 0x1000000u | '+',
0x1000000u | ' '};
static constexpr const char left_padding_shifts[] = {31, 31, 0, 1, 0};
static constexpr const char right_padding_shifts[] = {0, 31, 0, 1, 0};
FMT_API static constexpr const char left_padding_shifts[] = {31, 31, 0, 1, 0};
FMT_API static constexpr const char right_padding_shifts[] = {0, 31, 0, 1, 0};
};
#ifndef FMT_HEADER_ONLY
// Required for -flto, -fivisibility=hidden and -shared to work
extern template struct basic_data<void>;
#endif
// This is a struct rather than an alias to avoid shadowing warnings in gcc.
struct data : basic_data<> {};

View File

@@ -394,7 +394,7 @@ struct ostream_params {
static constexpr detail::buffer_size buffer_size;
/** A fast output stream which is not thread-safe. */
class ostream final : private detail::buffer<char> {
class FMT_API ostream final : private detail::buffer<char> {
private:
file file_;
@@ -404,7 +404,7 @@ class ostream final : private detail::buffer<char> {
clear();
}
FMT_API void grow(size_t) override final;
void grow(size_t) override;
ostream(cstring_view path, const detail::ostream_params& params)
: file_(path, params.oflag) {