Skip to content
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

Merged
merged 1 commit into from
Apr 18, 2023
Merged

fix and improve module #3386

merged 1 commit into from
Apr 18, 2023

Conversation

DanielaE
Copy link
Contributor

  • 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

Copy link
Contributor

@vitaut vitaut left a 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.

@@ -258,6 +258,7 @@ FMT_GCC_PRAGMA("GCC optimize(\"Og\")")
#endif

FMT_BEGIN_NAMESPACE
FMT_BEGIN_EXPORT
Copy link
Contributor

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 Show resolved Hide resolved
@@ -2024,6 +2036,7 @@ template <typename Char> struct fill_t {
}
};
} // namespace detail
FMT_BEGIN_EXPORT
Copy link
Contributor

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.

@@ -73,6 +73,7 @@ inline void write_escaped_path<std::filesystem::path::value_type>(
}

} // namespace detail
FMT_BEGIN_EXPORT
Copy link
Contributor

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
Copy link
Contributor

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.

Comment on lines +783 to +785
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;
Copy link
Contributor

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?

Copy link
Contributor Author

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 🤦‍♂️

@vitaut vitaut mentioned this pull request Apr 17, 2023
@vitaut vitaut changed the title fix and improve module: fix and improve module Apr 18, 2023
@vitaut vitaut merged commit 0489c19 into fmtlib:master Apr 18, 2023
@vitaut
Copy link
Contributor

vitaut commented Apr 18, 2023

Merged, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants