Skip to content

Improve GNU/XSI strerror_r check#529

Merged
ueno merged 2 commits intop11-glue:masterfrom
atsampson:strerror_r-crosscompile
Jul 4, 2023
Merged

Improve GNU/XSI strerror_r check#529
ueno merged 2 commits intop11-glue:masterfrom
atsampson:strerror_r-crosscompile

Conversation

@atsampson
Copy link
Contributor

The new test that was added to distinguish GNU/XSI strerror_r ran a compiled program, which doesn't work when cross-compiling. The only difference at compile time is that the GNU version returns char * and the XSI version returns int, so detect it by compiling a program that dereferences the return value.

Testing this revealed that the autoconf and meson version of the checks produce different results, because the meson version doesn't define _GNU_SOURCE (even though the rest of the code is compiled with it) - the second commit fixes that.

Copy link
Member

@ueno ueno left a comment

Choose a reason for hiding this comment

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

Looks good to me.

atsampson added 2 commits July 4, 2023 00:37
The new test that was added to distinguish GNU/XSI strerror_r ran a
compiled program, which doesn't work when cross-compiling. The only
difference at compile time is that the GNU version returns char * and
the XSI version returns int, so detect it by compiling a program that
dereferences the return value.

Signed-off-by: Adam Sampson <ats@offog.org>
The Meson check for GNU/XSI strerror_r didn't inherit the project
options that include _GNU_SOURCE (unlike the autoconf version), so the
result didn't match how the code that uses it will be compiled. Add
_GNU_SOURCE explicitly as with the following checks.

Signed-off-by: Adam Sampson <ats@offog.org>
@atsampson atsampson force-pushed the strerror_r-crosscompile branch from 400780b to cc618c0 Compare July 3, 2023 23:40
@coveralls
Copy link

Coverage Status

coverage: 69.89% (+0.001%) from 69.889% when pulling cc618c0 on atsampson:strerror_r-crosscompile into 76be1cf on p11-glue:master.

@ueno
Copy link
Member

ueno commented Jul 4, 2023

Thank you for the PR!

@ueno ueno merged commit 7aa6251 into p11-glue:master Jul 4, 2023
@ueno ueno added this to the 0.25.1 milestone Oct 19, 2023
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.

3 participants