Skip to content

Fix Doxygen with default void std::enable_if_t#4314

Merged
WeiqunZhang merged 1 commit intoAMReX-Codes:developmentfrom
AlexanderSinn:fix_doxygen_with_default_void_enable_if_t
Jan 28, 2025
Merged

Fix Doxygen with default void std::enable_if_t#4314
WeiqunZhang merged 1 commit intoAMReX-Codes:developmentfrom
AlexanderSinn:fix_doxygen_with_default_void_enable_if_t

Conversation

@AlexanderSinn
Copy link
Copy Markdown
Member

@AlexanderSinn AlexanderSinn commented Jan 28, 2025

Summary

Since the Doxygen version changed from 1.9.1 to 1.9.8 in the job runner, that generates
https://amrex-codes.github.io/amrex/docs_xml/doxygen/amrex-doxygen-web.tag.xml, there is a problem where if a function is overloaded where the only difference is the std::enable_if in the return value and the second argument of std::enable_if is not specified, so it defaults to void, then errors are caused in downstream doxygen builds causing CI failures.

Additional background

In the example below, it can be seen how if there is a second argument in the std::enable_if expression, both overloads get combined into one in the documentation where the return value is replaced by the second argument of std::enable_if. But if there is no second argument both versions end up in the xml file with the full std::enable_if expressions.

template <typename T>
std::enable_if_t<std::is_same<std::decay_t<decltype(std::declval<T>().box())>, Box>::value,
                 Long>
get_tag_size (T const& tag) noexcept
{...}

template <typename T>
std::enable_if_t<std::is_integral<std::decay_t<decltype(std::declval<T>().size())> >::value,
                 Long>
get_tag_size (T const& tag) noexcept
{...}

template <typename T, typename F>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
std::enable_if_t<std::is_same<std::decay_t<decltype(std::declval<T>().box())>, Box>::value>
tagparfor_call_f (
#ifdef AMREX_USE_SYCL
    sycl::nd_item<1> const& item,
#endif
    int icell, T const& tag, F&& f) noexcept
{...}

template <typename T, typename F>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
std::enable_if_t<std::is_integral<std::decay_t<decltype(std::declval<T>().size())> >::value>
tagparfor_call_f (
#ifdef AMREX_USE_SYCL
    sycl::nd_item<1> const& item,
#endif
    int i, T const& tag, F&& f) noexcept
{...}
    <member kind="function">
      <type>Long</type>
      <name>get_tag_size</name>
      <anchorfile>namespaceamrex_1_1detail.html</anchorfile>
      <anchor>a5dabf23fc1d6b0482df819bdd5d465c9</anchor>
      <arglist>(T const &amp;tag) noexcept</arglist>
    </member>
    <member kind="function">
      <type>AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE std::enable_if_t&lt; std::is_same&lt; std::decay_t&lt; decltype(std::declval&lt; T &gt;().box())&gt;, Box &gt;::value</type>
      <name>tagparfor_call_f</name>
      <anchorfile>namespaceamrex_1_1detail.html</anchorfile>
      <anchor>a3d1c62850c82bc09be970a6c864d52aa</anchor>
      <arglist>(int icell, T const &amp;tag, F &amp;&amp;f) noexcept</arglist>
    </member>
    <member kind="function">
      <type>AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE std::enable_if_t&lt; std::is_integral&lt; std::decay_t&lt; decltype(std::declval&lt; T &gt;().size())&gt; &gt;::value</type>
      <name>tagparfor_call_f</name>
      <anchorfile>namespaceamrex_1_1detail.html</anchorfile>
      <anchor>ad534e2d6a6e6d52339476c692cbccd78</anchor>
      <arglist>(int i, T const &amp;tag, F &amp;&amp;f) noexcept</arglist>
    </member>

Checklist

The proposed changes:

  • fix a bug or incorrect behavior in AMReX
  • add new capabilities to AMReX
  • changes answers in the test suite to more than roundoff level
  • are likely to significantly affect the results of downstream AMReX users
  • include documentation in the code and/or rst files, if appropriate

@WeiqunZhang WeiqunZhang merged commit 2f3a8c7 into AMReX-Codes:development Jan 28, 2025
75 checks passed
@ax3l
Copy link
Copy Markdown
Member

ax3l commented Jan 28, 2025

Thank you, @AlexanderSinn !! 🚀 ✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants