-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
fix and improve module #3386
fix and improve module #3386
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR.
include/fmt/core.h
Outdated
@@ -258,6 +258,7 @@ FMT_GCC_PRAGMA("GCC optimize(\"Og\")") | |||
#endif | |||
|
|||
FMT_BEGIN_NAMESPACE | |||
FMT_BEGIN_EXPORT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The symbols below are undocumented and shouldn't be exported.
include/fmt/core.h
Outdated
@@ -2024,6 +2036,7 @@ template <typename Char> struct fill_t { | |||
} | |||
}; | |||
} // namespace detail | |||
FMT_BEGIN_EXPORT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are also undocumented APIs that we don't need to export yet.
include/fmt/std.h
Outdated
@@ -73,6 +73,7 @@ inline void write_escaped_path<std::filesystem::path::value_type>( | |||
} | |||
|
|||
} // namespace detail | |||
FMT_BEGIN_EXPORT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here and a few other places: no need for a block, it's enough to mark the single definition here with FMT_MODULE_EXPORT
.
* export public documented API * don't export `namespace detail` * add `std.h` into module * add missing namespace qualification in `xchar.h` * fix call to `detail::get_iterator` in `xchar.h` * fix ambiguous overload of `detail::isfinite` in `chrono.h`
@@ -59,6 +59,7 @@ class dynamic_arg_list { | |||
} | |||
}; | |||
} // namespace detail | |||
FMT_BEGIN_EXPORT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We only have one class template here so I suggest applying FMT_MODULE_EXPORT to it.
FMT_MODULE_EXPORT template <typename Context> class basic_format_arg; | ||
FMT_MODULE_EXPORT template <typename Context> class basic_format_args; | ||
FMT_MODULE_EXPORT template <typename Context> class dynamic_format_arg_store; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are just forward declarations. Do we still need to export them if the main templates are exported?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Names must be declared export
when introduced into a namespace [module.interface]/6. The compiler will then collect all semantic properties that pertain to that entity that is referenced by the name. This collection continues throughout the whole module purview up to the end of the TU or the start of the private module fragment, whichever comes first.
In this case, the (forward) declarations introduce the names. So they need to be marked as exported at this very place in the source text.
This reminds me to remove the export
declarations from the definitions of the primary templates 🤦♂️
Merged, thanks! |
namespace detail
std.h
into modulexchar.h
detail::get_iterator
inxchar.h
detail::isfinite
inchrono.h