Skip to content

Configure: don't probe for the malloc()/free() return type #20806

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

Merged
merged 1 commit into from
Feb 13, 2023

Conversation

tonycoz
Copy link
Contributor

@tonycoz tonycoz commented Feb 13, 2023

We require a C99 compiler, or in the case that led to this commit, a C++ compiler, and for those the malloc() and free() return types are well defined.

This probe broke on Solaris when building with g++.

Unlike glibc, the libc headers on Solaris, when building using a C++ compiler, define the stdlib.h functions within the std:: namespace, then imports those names into the top level namespace with 'using std::malloc'.

This conflicts with the declarations used in the probe, causing the probe to fail to build, despite malloc() actually returning a void *.

Since these two functions have well defined return types according to the standard, assume their return values match.

Configure can still be invoked with different definitions for malloctype and freetype, or hints can override them, so someone on a non-standard system can at least get past this if they really need to (such a system will likely not build perl anyway.)

We require a C99 compiler, or in the case that led to this commit, a
C++ compiler, and for those the malloc() and free() return types are
well defined.

This probe broke on Solaris when building with g++.

Unlike glibc, the libc headers on Solaris, when building using a C++
compiler, define the stdlib.h functions within the std:: namespace,
then imports those names into the top level namespace with 'using
std::malloc'.

This conflicts with the declarations used in the probe, causing the
probe to fail to build, despite malloc() actually returning a void *.

Since these two functions have well defined return types according to
the standard, assume their return values match.

Configure can still be invoked with different definitions for
malloctype and freetype, or hints can override them, so someone on a
non-standard system can at least get past this if they really need to
(such a system will likely not build perl anyway.)
@tonycoz tonycoz merged commit d8a109c into Perl:blead Feb 13, 2023
@ilmari
Copy link
Member

ilmari commented Feb 14, 2023

Hardcoding malloctype and freetype seems like a bit of a half-way house. Could we not get rid of malloctype/Malloc_t and freetype/Free_t completely?

@tonycoz tonycoz deleted the solaris-malloctype-probe branch March 30, 2023 10:18
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.

5 participants