Skip to content

Conversation

@jhendersonHDF
Copy link
Collaborator

@jhendersonHDF jhendersonHDF commented Dec 2, 2025

Important

Rewrites complex number configuration logic in ConfigureChecks.cmake to improve clarity and fix re-configuration issues by restructuring checks for C99 and MSVC complex types.

  • Behavior:
    • Rewrites complex number support check in ConfigureChecks.cmake to first check __STDC_NO_COMPLEX__ macro.
    • Checks for complex.h and C99 complex types (float _Complex, double _Complex, long double _Complex).
    • Separates MSVC complex type checks (_Fcomplex, _Dcomplex, _Lcomplex) if C99 types are unavailable.
    • Sets H5_HAVE_C99_COMPLEX_NUMBERS if C99 types are available.
    • Improved status messages for complex number support availability.
  • Misc:
    • Removes redundant checks and simplifies logic flow for complex number configuration.

This description was created by Ellipsis for 984bfda. You can customize this summary. It will automatically update as commits are pushed.


# Check if __STDC_NO_COMPLEX__ macro is defined, in which case complex number
# support is not available
HDF_FUNCTION_TEST (HAVE_STDC_NO_COMPLEX)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved this check to be first, as it is a standalone check that can tell us early if complex number support isn't available

CHECK_INCLUDE_FILE (complex.h ${HDF_PREFIX}_HAVE_COMPLEX_H)
if (${HDF_PREFIX}_HAVE_COMPLEX_H)
# Check for C99 complex number types first
HDF_CHECK_TYPE_SIZE ("float _Complex" ${HDF_PREFIX}_SIZEOF_C99_FLOAT_COMPLEX)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the variable names for these size checks so they aren't mixed with the final names used by the macros in H5pubconf.h

cmake_pop_check_state ()
if (${HDF_PREFIX}_SIZEOF__FCOMPLEX AND ${HDF_PREFIX}_SIZEOF__DCOMPLEX AND
${HDF_PREFIX}_SIZEOF__FCOMPLEX)
set (${HDF_PREFIX}_SIZEOF_FLOAT_COMPLEX ${${HDF_PREFIX}_SIZEOF__FCOMPLEX}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved setting the final size macro variables to as late as possible and updated the check below to avoid issues with mixing up when a particular type of complex numbers are available

@jhendersonHDF jhendersonHDF force-pushed the rewrite_complex_config_logic branch from 9dfe4ec to 984bfda Compare December 2, 2025 23:16
Copy link
Collaborator

@brtnfld brtnfld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice solution

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

Labels

Projects

Status: To be triaged

Development

Successfully merging this pull request may close these issues.

MSVC build fails on CMake re-configure due to cached C99 complex type size (Cache pollution)

3 participants