Skip to content

Commit

Permalink
export names only once
Browse files Browse the repository at this point in the history
names declared to be exported at the point of introduction into a namespace *must not* be (re-)declared as exported later in the TU, e.g. when they are redeclared, defined, or specialized. [module.export]/6

Drive-by fix found during module testing: add a missing `detail::` name qualification
  • Loading branch information
DanielaE committed Apr 19, 2023
1 parent 0489c19 commit 78e0071
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
2 changes: 0 additions & 2 deletions include/fmt/args.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ class dynamic_arg_list {
}
};
} // namespace detail
FMT_BEGIN_EXPORT

/**
\rst
Expand Down Expand Up @@ -230,7 +229,6 @@ class dynamic_format_arg_store
}
};

FMT_END_EXPORT
FMT_END_NAMESPACE

#endif // FMT_ARGS_H_
7 changes: 3 additions & 4 deletions include/fmt/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -1482,7 +1482,6 @@ enum { max_packed_args = 62 / packed_arg_bits };
enum : unsigned long long { is_unpacked_bit = 1ULL << 63 };
enum : unsigned long long { has_named_args_bit = 1ULL << 62 };
} // namespace detail
FMT_BEGIN_EXPORT

// An output iterator that appends to a buffer.
// It is used to reduce symbol sizes for the common case.
Expand Down Expand Up @@ -1560,6 +1559,7 @@ template <typename Context> class basic_format_arg {
``vis(value)`` will be called with the value of type ``double``.
\endrst
*/
FMT_MODULE_EXPORT
template <typename Visitor, typename Context>
FMT_CONSTEXPR FMT_INLINE auto visit_format_arg(
Visitor&& vis, const basic_format_arg<Context>& arg) -> decltype(vis(0)) {
Expand Down Expand Up @@ -1601,7 +1601,6 @@ FMT_CONSTEXPR FMT_INLINE auto visit_format_arg(
return vis(monostate());
}

FMT_END_EXPORT
namespace detail {

template <typename Char, typename InputIt>
Expand Down Expand Up @@ -1861,6 +1860,7 @@ inline auto arg(const Char* name, const T& arg) -> detail::named_arg<Char, T> {
static_assert(!detail::is_named_arg<T>(), "nested named arguments");
return {name, arg};
}
FMT_END_EXPORT

/**
\rst
Expand Down Expand Up @@ -1986,7 +1986,7 @@ template <typename Context> class basic_format_args {
/** An alias to ``basic_format_args<format_context>``. */
// A separate type would result in shorter symbols but break ABI compatibility
// between clang and gcc on ARM (#1919).
using format_args = basic_format_args<format_context>;
FMT_MODULE_EXPORT using format_args = basic_format_args<format_context>;

// We cannot use enum classes as bit fields because of a gcc bug, so we put them
// in namespaces instead (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61414).
Expand All @@ -2007,7 +2007,6 @@ enum type FMT_ENUM_UNDERLYING_TYPE(unsigned char){none, minus, plus, space};
}
using sign_t = sign::type;

FMT_END_EXPORT
namespace detail {

// Workaround an array initialization issue in gcc 4.8.
Expand Down
2 changes: 1 addition & 1 deletion include/fmt/ostream.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ struct basic_ostream_formatter : formatter<basic_string_view<Char>, Char> {
auto format(const T& value, basic_format_context<OutputIt, Char>& ctx) const
-> OutputIt {
auto buffer = basic_memory_buffer<Char>();
format_value(buffer, value, ctx.locale());
detail::format_value(buffer, value, ctx.locale());
return formatter<basic_string_view<Char>, Char>::format(
{buffer.data(), buffer.size()}, ctx);
}
Expand Down

0 comments on commit 78e0071

Please sign in to comment.